~ubuntu-branches/ubuntu/quantal/wpasupplicant/quantal

« back to all changes in this revision

Viewing changes to src/wps/wps_upnp_ssdp.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2010-02-27 11:30:53 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100227113053-axxieaw3hmuqbqls
Tags: 0.6.10-2
* Switch to source format 3.0 (quilt), drop quilt build dependency
  and remove '--with quilt' from dh command in debian/rules.
* Fix "FTBFS on kfreebsd-gnu" with addition of 21_kfreebsd.patch.
  Thanks to work by Stefan Lippers-Hollmann and Petr Salinger.
  (Closes: #480572)
* Disable experimental feature CONFIG_IEEE80211W (management frame
  protection) due to it not being supported by any driver but ath9k
  and it generating ioctl errors which cause much concern among users
  for little to no benefit.
* Add traling blank line to debian/NEWS to assist apt-listchanges as
  per lintian advice.
* Cherry pick 30_cfg80211_association_optimisation.patch from upstream
  git. Add cfg80211-specific optimization to avoid silly behavior.

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
/**
230
230
 * advertisement_state_machine_stop - Stop SSDP advertisements
231
231
 * @sm: WPS UPnP state machine from upnp_wps_device_init()
 
232
 * @send_byebye: Send byebye advertisement messages immediately
232
233
 */
233
 
void advertisement_state_machine_stop(struct upnp_wps_device_sm *sm)
 
234
void advertisement_state_machine_stop(struct upnp_wps_device_sm *sm,
 
235
                                      int send_byebye)
234
236
{
 
237
        struct advertisement_state_machine *a = &sm->advertisement;
 
238
        int islast = 0;
 
239
        struct wpabuf *msg;
 
240
        struct sockaddr_in dest;
 
241
 
235
242
        eloop_cancel_timeout(advertisement_state_machine_handler, NULL, sm);
 
243
        if (!send_byebye || sm->multicast_sd < 0)
 
244
                return;
 
245
 
 
246
        a->type = ADVERTISE_DOWN;
 
247
        a->state = 0;
 
248
        a->sm = sm;
 
249
 
 
250
        os_memset(&dest, 0, sizeof(dest));
 
251
        dest.sin_family = AF_INET;
 
252
        dest.sin_addr.s_addr = inet_addr(UPNP_MULTICAST_ADDRESS);
 
253
        dest.sin_port = htons(UPNP_MULTICAST_PORT);
 
254
 
 
255
        while (!islast) {
 
256
                msg = next_advertisement(a, &islast);
 
257
                if (msg == NULL)
 
258
                        break;
 
259
                if (sendto(sm->multicast_sd, wpabuf_head(msg), wpabuf_len(msg),
 
260
                           0, (struct sockaddr *) &dest, sizeof(dest)) < 0) {
 
261
                        wpa_printf(MSG_INFO, "WPS UPnP: Advertisement sendto "
 
262
                                   "failed: %d (%s)", errno, strerror(errno));
 
263
                }
 
264
                wpabuf_free(msg);
 
265
                a->state++;
 
266
        }
236
267
}
237
268
 
238
269
 
318
349
        struct advertisement_state_machine *a = &sm->advertisement;
319
350
        int next_timeout_msec;
320
351
 
321
 
        advertisement_state_machine_stop(sm);
 
352
        advertisement_state_machine_stop(sm, 0);
322
353
 
323
354
        /*
324
355
         * Start out advertising down, this automatically switches
461
492
        a->type = MSEARCH_REPLY;
462
493
        a->state = 0;
463
494
        a->sm = sm;
464
 
        os_memcpy(&a->client, client, sizeof(client));
 
495
        os_memcpy(&a->client, client, sizeof(*client));
465
496
        /* Wait time depending on MX value */
466
497
        next_timeout_msec = (1000 * mx * (os_random() & 0xFF)) >> 8;
467
498
        next_timeout_sec = next_timeout_msec / 1000;
799
830
                goto fail;
800
831
 
801
832
        rt.rt_dev = net_if;
802
 
        sin = (struct sockaddr_in *) &rt.rt_dst;
 
833
        sin = aliasing_hide_typecast(&rt.rt_dst, struct sockaddr_in);
803
834
        sin->sin_family = AF_INET;
804
835
        sin->sin_port = 0;
805
836
        sin->sin_addr.s_addr = inet_addr(SSDP_TARGET);
806
 
        sin = (struct sockaddr_in *) &rt.rt_genmask;
 
837
        sin = aliasing_hide_typecast(&rt.rt_genmask, struct sockaddr_in);
807
838
        sin->sin_family = AF_INET;
808
839
        sin->sin_port = 0;
809
840
        sin->sin_addr.s_addr = inet_addr(SSDP_NETMASK);