diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/8021q/vlan.c | 28 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 2 | ||||
-rw-r--r-- | net/core/dev.c | 2 | ||||
-rw-r--r-- | net/core/pktgen.c | 4 | ||||
-rw-r--r-- | net/ipv4/arp.c | 5 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 146 | ||||
-rw-r--r-- | net/ipv4/ipip.c | 130 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 10 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 75 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 8 | ||||
-rw-r--r-- | net/ipv6/route.c | 12 | ||||
-rw-r--r-- | net/ipv6/sit.c | 89 | ||||
-rw-r--r-- | net/key/af_key.c | 2 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 29 | ||||
-rw-r--r-- | net/mac80211/util.c | 37 | ||||
-rw-r--r-- | net/mac80211/wext.c | 1 | ||||
-rw-r--r-- | net/sched/cls_api.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 11 |
19 files changed, 160 insertions, 435 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 2a739adaa92b..ab2225da0ee2 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -382,6 +382,18 @@ static void vlan_sync_address(struct net_device *dev, | |||
382 | memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); | 382 | memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); |
383 | } | 383 | } |
384 | 384 | ||
385 | static void vlan_transfer_features(struct net_device *dev, | ||
386 | struct net_device *vlandev) | ||
387 | { | ||
388 | unsigned long old_features = vlandev->features; | ||
389 | |||
390 | vlandev->features &= ~dev->vlan_features; | ||
391 | vlandev->features |= dev->features & dev->vlan_features; | ||
392 | |||
393 | if (old_features != vlandev->features) | ||
394 | netdev_features_change(vlandev); | ||
395 | } | ||
396 | |||
385 | static void __vlan_device_event(struct net_device *dev, unsigned long event) | 397 | static void __vlan_device_event(struct net_device *dev, unsigned long event) |
386 | { | 398 | { |
387 | switch (event) { | 399 | switch (event) { |
@@ -410,10 +422,8 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
410 | int i, flgs; | 422 | int i, flgs; |
411 | struct net_device *vlandev; | 423 | struct net_device *vlandev; |
412 | 424 | ||
413 | if (is_vlan_dev(dev)) { | 425 | if (is_vlan_dev(dev)) |
414 | __vlan_device_event(dev, event); | 426 | __vlan_device_event(dev, event); |
415 | goto out; | ||
416 | } | ||
417 | 427 | ||
418 | grp = __vlan_find_group(dev); | 428 | grp = __vlan_find_group(dev); |
419 | if (!grp) | 429 | if (!grp) |
@@ -450,6 +460,18 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
450 | } | 460 | } |
451 | break; | 461 | break; |
452 | 462 | ||
463 | case NETDEV_FEAT_CHANGE: | ||
464 | /* Propagate device features to underlying device */ | ||
465 | for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { | ||
466 | vlandev = vlan_group_get_device(grp, i); | ||
467 | if (!vlandev) | ||
468 | continue; | ||
469 | |||
470 | vlan_transfer_features(dev, vlandev); | ||
471 | } | ||
472 | |||
473 | break; | ||
474 | |||
453 | case NETDEV_DOWN: | 475 | case NETDEV_DOWN: |
454 | /* Put all VLANs for this dev in the down state too. */ | 476 | /* Put all VLANs for this dev in the down state too. */ |
455 | for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { | 477 | for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index c961f0826005..5d055c242ed8 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -663,6 +663,8 @@ static int vlan_dev_init(struct net_device *dev) | |||
663 | (1<<__LINK_STATE_DORMANT))) | | 663 | (1<<__LINK_STATE_DORMANT))) | |
664 | (1<<__LINK_STATE_PRESENT); | 664 | (1<<__LINK_STATE_PRESENT); |
665 | 665 | ||
666 | dev->features |= real_dev->features & real_dev->vlan_features; | ||
667 | |||
666 | /* ipv6 shared card related stuff */ | 668 | /* ipv6 shared card related stuff */ |
667 | dev->dev_id = real_dev->dev_id; | 669 | dev->dev_id = real_dev->dev_id; |
668 | 670 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index ce88c0d3e354..582963077877 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3141,7 +3141,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags) | |||
3141 | * Load in the correct multicast list now the flags have changed. | 3141 | * Load in the correct multicast list now the flags have changed. |
3142 | */ | 3142 | */ |
3143 | 3143 | ||
3144 | if (dev->change_rx_flags && (dev->flags ^ flags) & IFF_MULTICAST) | 3144 | if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST) |
3145 | dev->change_rx_flags(dev, IFF_MULTICAST); | 3145 | dev->change_rx_flags(dev, IFF_MULTICAST); |
3146 | 3146 | ||
3147 | dev_set_rx_mode(dev); | 3147 | dev_set_rx_mode(dev); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8dca21110493..fdf537707e51 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -390,6 +390,7 @@ struct pktgen_thread { | |||
390 | int cpu; | 390 | int cpu; |
391 | 391 | ||
392 | wait_queue_head_t queue; | 392 | wait_queue_head_t queue; |
393 | struct completion start_done; | ||
393 | }; | 394 | }; |
394 | 395 | ||
395 | #define REMOVE 1 | 396 | #define REMOVE 1 |
@@ -3414,6 +3415,7 @@ static int pktgen_thread_worker(void *arg) | |||
3414 | BUG_ON(smp_processor_id() != cpu); | 3415 | BUG_ON(smp_processor_id() != cpu); |
3415 | 3416 | ||
3416 | init_waitqueue_head(&t->queue); | 3417 | init_waitqueue_head(&t->queue); |
3418 | complete(&t->start_done); | ||
3417 | 3419 | ||
3418 | pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current)); | 3420 | pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current)); |
3419 | 3421 | ||
@@ -3615,6 +3617,7 @@ static int __init pktgen_create_thread(int cpu) | |||
3615 | INIT_LIST_HEAD(&t->if_list); | 3617 | INIT_LIST_HEAD(&t->if_list); |
3616 | 3618 | ||
3617 | list_add_tail(&t->th_list, &pktgen_threads); | 3619 | list_add_tail(&t->th_list, &pktgen_threads); |
3620 | init_completion(&t->start_done); | ||
3618 | 3621 | ||
3619 | p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); | 3622 | p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); |
3620 | if (IS_ERR(p)) { | 3623 | if (IS_ERR(p)) { |
@@ -3639,6 +3642,7 @@ static int __init pktgen_create_thread(int cpu) | |||
3639 | } | 3642 | } |
3640 | 3643 | ||
3641 | wake_up_process(p); | 3644 | wake_up_process(p); |
3645 | wait_for_completion(&t->start_done); | ||
3642 | 3646 | ||
3643 | return 0; | 3647 | return 0; |
3644 | } | 3648 | } |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 418862f1bf22..9b539fa9fe18 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq, | |||
1288 | struct neighbour *n) | 1288 | struct neighbour *n) |
1289 | { | 1289 | { |
1290 | char hbuffer[HBUFFERLEN]; | 1290 | char hbuffer[HBUFFERLEN]; |
1291 | const char hexbuf[] = "0123456789ABCDEF"; | ||
1292 | int k, j; | 1291 | int k, j; |
1293 | char tbuf[16]; | 1292 | char tbuf[16]; |
1294 | struct net_device *dev = n->dev; | 1293 | struct net_device *dev = n->dev; |
@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq, | |||
1302 | else { | 1301 | else { |
1303 | #endif | 1302 | #endif |
1304 | for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) { | 1303 | for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) { |
1305 | hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15]; | 1304 | hbuffer[k++] = hex_asc_hi(n->ha[j]); |
1306 | hbuffer[k++] = hexbuf[n->ha[j] & 15]; | 1305 | hbuffer[k++] = hex_asc_lo(n->ha[j]); |
1307 | hbuffer[k++] = ':'; | 1306 | hbuffer[k++] = ':'; |
1308 | } | 1307 | } |
1309 | hbuffer[--k] = 0; | 1308 | hbuffer[--k] = 0; |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index eede36e55702..2a61158ea722 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -313,9 +313,8 @@ static void ipgre_tunnel_uninit(struct net_device *dev) | |||
313 | 313 | ||
314 | static void ipgre_err(struct sk_buff *skb, u32 info) | 314 | static void ipgre_err(struct sk_buff *skb, u32 info) |
315 | { | 315 | { |
316 | #ifndef I_WISH_WORLD_WERE_PERFECT | ||
317 | 316 | ||
318 | /* It is not :-( All the routers (except for Linux) return only | 317 | /* All the routers (except for Linux) return only |
319 | 8 bytes of packet payload. It means, that precise relaying of | 318 | 8 bytes of packet payload. It means, that precise relaying of |
320 | ICMP in the real Internet is absolutely infeasible. | 319 | ICMP in the real Internet is absolutely infeasible. |
321 | 320 | ||
@@ -398,149 +397,6 @@ static void ipgre_err(struct sk_buff *skb, u32 info) | |||
398 | out: | 397 | out: |
399 | read_unlock(&ipgre_lock); | 398 | read_unlock(&ipgre_lock); |
400 | return; | 399 | return; |
401 | #else | ||
402 | struct iphdr *iph = (struct iphdr*)dp; | ||
403 | struct iphdr *eiph; | ||
404 | __be16 *p = (__be16*)(dp+(iph->ihl<<2)); | ||
405 | const int type = icmp_hdr(skb)->type; | ||
406 | const int code = icmp_hdr(skb)->code; | ||
407 | int rel_type = 0; | ||
408 | int rel_code = 0; | ||
409 | __be32 rel_info = 0; | ||
410 | __u32 n = 0; | ||
411 | __be16 flags; | ||
412 | int grehlen = (iph->ihl<<2) + 4; | ||
413 | struct sk_buff *skb2; | ||
414 | struct flowi fl; | ||
415 | struct rtable *rt; | ||
416 | |||
417 | if (p[1] != htons(ETH_P_IP)) | ||
418 | return; | ||
419 | |||
420 | flags = p[0]; | ||
421 | if (flags&(GRE_CSUM|GRE_KEY|GRE_SEQ|GRE_ROUTING|GRE_VERSION)) { | ||
422 | if (flags&(GRE_VERSION|GRE_ROUTING)) | ||
423 | return; | ||
424 | if (flags&GRE_CSUM) | ||
425 | grehlen += 4; | ||
426 | if (flags&GRE_KEY) | ||
427 | grehlen += 4; | ||
428 | if (flags&GRE_SEQ) | ||
429 | grehlen += 4; | ||
430 | } | ||
431 | if (len < grehlen + sizeof(struct iphdr)) | ||
432 | return; | ||
433 | eiph = (struct iphdr*)(dp + grehlen); | ||
434 | |||
435 | switch (type) { | ||
436 | default: | ||
437 | return; | ||
438 | case ICMP_PARAMETERPROB: | ||
439 | n = ntohl(icmp_hdr(skb)->un.gateway) >> 24; | ||
440 | if (n < (iph->ihl<<2)) | ||
441 | return; | ||
442 | |||
443 | /* So... This guy found something strange INSIDE encapsulated | ||
444 | packet. Well, he is fool, but what can we do ? | ||
445 | */ | ||
446 | rel_type = ICMP_PARAMETERPROB; | ||
447 | n -= grehlen; | ||
448 | rel_info = htonl(n << 24); | ||
449 | break; | ||
450 | |||
451 | case ICMP_DEST_UNREACH: | ||
452 | switch (code) { | ||
453 | case ICMP_SR_FAILED: | ||
454 | case ICMP_PORT_UNREACH: | ||
455 | /* Impossible event. */ | ||
456 | return; | ||
457 | case ICMP_FRAG_NEEDED: | ||
458 | /* And it is the only really necessary thing :-) */ | ||
459 | n = ntohs(icmp_hdr(skb)->un.frag.mtu); | ||
460 | if (n < grehlen+68) | ||
461 | return; | ||
462 | n -= grehlen; | ||
463 | /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */ | ||
464 | if (n > ntohs(eiph->tot_len)) | ||
465 | return; | ||
466 | rel_info = htonl(n); | ||
467 | break; | ||
468 | default: | ||
469 | /* All others are translated to HOST_UNREACH. | ||
470 | rfc2003 contains "deep thoughts" about NET_UNREACH, | ||
471 | I believe, it is just ether pollution. --ANK | ||
472 | */ | ||
473 | rel_type = ICMP_DEST_UNREACH; | ||
474 | rel_code = ICMP_HOST_UNREACH; | ||
475 | break; | ||
476 | } | ||
477 | break; | ||
478 | case ICMP_TIME_EXCEEDED: | ||
479 | if (code != ICMP_EXC_TTL) | ||
480 | return; | ||
481 | break; | ||
482 | } | ||
483 | |||
484 | /* Prepare fake skb to feed it to icmp_send */ | ||
485 | skb2 = skb_clone(skb, GFP_ATOMIC); | ||
486 | if (skb2 == NULL) | ||
487 | return; | ||
488 | dst_release(skb2->dst); | ||
489 | skb2->dst = NULL; | ||
490 | skb_pull(skb2, skb->data - (u8*)eiph); | ||
491 | skb_reset_network_header(skb2); | ||
492 | |||
493 | /* Try to guess incoming interface */ | ||
494 | memset(&fl, 0, sizeof(fl)); | ||
495 | fl.fl4_dst = eiph->saddr; | ||
496 | fl.fl4_tos = RT_TOS(eiph->tos); | ||
497 | fl.proto = IPPROTO_GRE; | ||
498 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl)) { | ||
499 | kfree_skb(skb2); | ||
500 | return; | ||
501 | } | ||
502 | skb2->dev = rt->u.dst.dev; | ||
503 | |||
504 | /* route "incoming" packet */ | ||
505 | if (rt->rt_flags&RTCF_LOCAL) { | ||
506 | ip_rt_put(rt); | ||
507 | rt = NULL; | ||
508 | fl.fl4_dst = eiph->daddr; | ||
509 | fl.fl4_src = eiph->saddr; | ||
510 | fl.fl4_tos = eiph->tos; | ||
511 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) || | ||
512 | rt->u.dst.dev->type != ARPHRD_IPGRE) { | ||
513 | ip_rt_put(rt); | ||
514 | kfree_skb(skb2); | ||
515 | return; | ||
516 | } | ||
517 | } else { | ||
518 | ip_rt_put(rt); | ||
519 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) || | ||
520 | skb2->dst->dev->type != ARPHRD_IPGRE) { | ||
521 | kfree_skb(skb2); | ||
522 | return; | ||
523 | } | ||
524 | } | ||
525 | |||
526 | /* change mtu on this route */ | ||
527 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { | ||
528 | if (n > dst_mtu(skb2->dst)) { | ||
529 | kfree_skb(skb2); | ||
530 | return; | ||
531 | } | ||
532 | skb2->dst->ops->update_pmtu(skb2->dst, n); | ||
533 | } else if (type == ICMP_TIME_EXCEEDED) { | ||
534 | struct ip_tunnel *t = netdev_priv(skb2->dev); | ||
535 | if (t->parms.iph.ttl) { | ||
536 | rel_type = ICMP_DEST_UNREACH; | ||
537 | rel_code = ICMP_HOST_UNREACH; | ||
538 | } | ||
539 | } | ||
540 | |||
541 | icmp_send(skb2, rel_type, rel_code, rel_info); | ||
542 | kfree_skb(skb2); | ||
543 | #endif | ||
544 | } | 400 | } |
545 | 401 | ||
546 | static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | 402 | static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 26c85c23ca4f..86d8836551b9 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -278,9 +278,8 @@ static void ipip_tunnel_uninit(struct net_device *dev) | |||
278 | 278 | ||
279 | static int ipip_err(struct sk_buff *skb, u32 info) | 279 | static int ipip_err(struct sk_buff *skb, u32 info) |
280 | { | 280 | { |
281 | #ifndef I_WISH_WORLD_WERE_PERFECT | ||
282 | 281 | ||
283 | /* It is not :-( All the routers (except for Linux) return only | 282 | /* All the routers (except for Linux) return only |
284 | 8 bytes of packet payload. It means, that precise relaying of | 283 | 8 bytes of packet payload. It means, that precise relaying of |
285 | ICMP in the real Internet is absolutely infeasible. | 284 | ICMP in the real Internet is absolutely infeasible. |
286 | */ | 285 | */ |
@@ -337,133 +336,6 @@ static int ipip_err(struct sk_buff *skb, u32 info) | |||
337 | out: | 336 | out: |
338 | read_unlock(&ipip_lock); | 337 | read_unlock(&ipip_lock); |
339 | return err; | 338 | return err; |
340 | #else | ||
341 | struct iphdr *iph = (struct iphdr*)dp; | ||
342 | int hlen = iph->ihl<<2; | ||
343 | struct iphdr *eiph; | ||
344 | const int type = icmp_hdr(skb)->type; | ||
345 | const int code = icmp_hdr(skb)->code; | ||
346 | int rel_type = 0; | ||
347 | int rel_code = 0; | ||
348 | __be32 rel_info = 0; | ||
349 | __u32 n = 0; | ||
350 | struct sk_buff *skb2; | ||
351 | struct flowi fl; | ||
352 | struct rtable *rt; | ||
353 | |||
354 | if (len < hlen + sizeof(struct iphdr)) | ||
355 | return 0; | ||
356 | eiph = (struct iphdr*)(dp + hlen); | ||
357 | |||
358 | switch (type) { | ||
359 | default: | ||
360 | return 0; | ||
361 | case ICMP_PARAMETERPROB: | ||
362 | n = ntohl(icmp_hdr(skb)->un.gateway) >> 24; | ||
363 | if (n < hlen) | ||
364 | return 0; | ||
365 | |||
366 | /* So... This guy found something strange INSIDE encapsulated | ||
367 | packet. Well, he is fool, but what can we do ? | ||
368 | */ | ||
369 | rel_type = ICMP_PARAMETERPROB; | ||
370 | rel_info = htonl((n - hlen) << 24); | ||
371 | break; | ||
372 | |||
373 | case ICMP_DEST_UNREACH: | ||
374 | switch (code) { | ||
375 | case ICMP_SR_FAILED: | ||
376 | case ICMP_PORT_UNREACH: | ||
377 | /* Impossible event. */ | ||
378 | return 0; | ||
379 | case ICMP_FRAG_NEEDED: | ||
380 | /* And it is the only really necessary thing :-) */ | ||
381 | n = ntohs(icmp_hdr(skb)->un.frag.mtu); | ||
382 | if (n < hlen+68) | ||
383 | return 0; | ||
384 | n -= hlen; | ||
385 | /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */ | ||
386 | if (n > ntohs(eiph->tot_len)) | ||
387 | return 0; | ||
388 | rel_info = htonl(n); | ||
389 | break; | ||
390 | default: | ||
391 | /* All others are translated to HOST_UNREACH. | ||
392 | rfc2003 contains "deep thoughts" about NET_UNREACH, | ||
393 | I believe, it is just ether pollution. --ANK | ||
394 | */ | ||
395 | rel_type = ICMP_DEST_UNREACH; | ||
396 | rel_code = ICMP_HOST_UNREACH; | ||
397 | break; | ||
398 | } | ||
399 | break; | ||
400 | case ICMP_TIME_EXCEEDED: | ||
401 | if (code != ICMP_EXC_TTL) | ||
402 | return 0; | ||
403 | break; | ||
404 | } | ||
405 | |||
406 | /* Prepare fake skb to feed it to icmp_send */ | ||
407 | skb2 = skb_clone(skb, GFP_ATOMIC); | ||
408 | if (skb2 == NULL) | ||
409 | return 0; | ||
410 | dst_release(skb2->dst); | ||
411 | skb2->dst = NULL; | ||
412 | skb_pull(skb2, skb->data - (u8*)eiph); | ||
413 | skb_reset_network_header(skb2); | ||
414 | |||
415 | /* Try to guess incoming interface */ | ||
416 | memset(&fl, 0, sizeof(fl)); | ||
417 | fl.fl4_daddr = eiph->saddr; | ||
418 | fl.fl4_tos = RT_TOS(eiph->tos); | ||
419 | fl.proto = IPPROTO_IPIP; | ||
420 | if (ip_route_output_key(dev_net(skb->dev), &rt, &key)) { | ||
421 | kfree_skb(skb2); | ||
422 | return 0; | ||
423 | } | ||
424 | skb2->dev = rt->u.dst.dev; | ||
425 | |||
426 | /* route "incoming" packet */ | ||
427 | if (rt->rt_flags&RTCF_LOCAL) { | ||
428 | ip_rt_put(rt); | ||
429 | rt = NULL; | ||
430 | fl.fl4_daddr = eiph->daddr; | ||
431 | fl.fl4_src = eiph->saddr; | ||
432 | fl.fl4_tos = eiph->tos; | ||
433 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) || | ||
434 | rt->u.dst.dev->type != ARPHRD_TUNNEL) { | ||
435 | ip_rt_put(rt); | ||
436 | kfree_skb(skb2); | ||
437 | return 0; | ||
438 | } | ||
439 | } else { | ||
440 | ip_rt_put(rt); | ||
441 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) || | ||
442 | skb2->dst->dev->type != ARPHRD_TUNNEL) { | ||
443 | kfree_skb(skb2); | ||
444 | return 0; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | /* change mtu on this route */ | ||
449 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { | ||
450 | if (n > dst_mtu(skb2->dst)) { | ||
451 | kfree_skb(skb2); | ||
452 | return 0; | ||
453 | } | ||
454 | skb2->dst->ops->update_pmtu(skb2->dst, n); | ||
455 | } else if (type == ICMP_TIME_EXCEEDED) { | ||
456 | struct ip_tunnel *t = netdev_priv(skb2->dev); | ||
457 | if (t->parms.iph.ttl) { | ||
458 | rel_type = ICMP_DEST_UNREACH; | ||
459 | rel_code = ICMP_HOST_UNREACH; | ||
460 | } | ||
461 | } | ||
462 | |||
463 | icmp_send(skb2, rel_type, rel_code, rel_info); | ||
464 | kfree_skb(skb2); | ||
465 | return 0; | ||
466 | #endif | ||
467 | } | 339 | } |
468 | 340 | ||
469 | static inline void ipip_ecn_decapsulate(const struct iphdr *outer_iph, | 341 | static inline void ipip_ecn_decapsulate(const struct iphdr *outer_iph, |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 92f90ae46f4a..df41026b60db 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -160,7 +160,7 @@ static struct dst_ops ipv4_dst_ops = { | |||
160 | .negative_advice = ipv4_negative_advice, | 160 | .negative_advice = ipv4_negative_advice, |
161 | .link_failure = ipv4_link_failure, | 161 | .link_failure = ipv4_link_failure, |
162 | .update_pmtu = ip_rt_update_pmtu, | 162 | .update_pmtu = ip_rt_update_pmtu, |
163 | .local_out = ip_local_out, | 163 | .local_out = __ip_local_out, |
164 | .entry_size = sizeof(struct rtable), | 164 | .entry_size = sizeof(struct rtable), |
165 | .entries = ATOMIC_INIT(0), | 165 | .entries = ATOMIC_INIT(0), |
166 | }; | 166 | }; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index debf23581606..e399bde7813a 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1836,7 +1836,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1836 | { | 1836 | { |
1837 | struct tcp_sock *tp = tcp_sk(sk); | 1837 | struct tcp_sock *tp = tcp_sk(sk); |
1838 | struct inet_connection_sock *icsk = inet_csk(sk); | 1838 | struct inet_connection_sock *icsk = inet_csk(sk); |
1839 | unsigned int cur_mss = tcp_current_mss(sk, 0); | 1839 | unsigned int cur_mss; |
1840 | int err; | 1840 | int err; |
1841 | 1841 | ||
1842 | /* Inconslusive MTU probe */ | 1842 | /* Inconslusive MTU probe */ |
@@ -1858,6 +1858,11 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1858 | return -ENOMEM; | 1858 | return -ENOMEM; |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk)) | ||
1862 | return -EHOSTUNREACH; /* Routing failure or similar. */ | ||
1863 | |||
1864 | cur_mss = tcp_current_mss(sk, 0); | ||
1865 | |||
1861 | /* If receiver has shrunk his window, and skb is out of | 1866 | /* If receiver has shrunk his window, and skb is out of |
1862 | * new window, do not retransmit it. The exception is the | 1867 | * new window, do not retransmit it. The exception is the |
1863 | * case, when window is shrunk to zero. In this case | 1868 | * case, when window is shrunk to zero. In this case |
@@ -1884,9 +1889,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1884 | (sysctl_tcp_retrans_collapse != 0)) | 1889 | (sysctl_tcp_retrans_collapse != 0)) |
1885 | tcp_retrans_try_collapse(sk, skb, cur_mss); | 1890 | tcp_retrans_try_collapse(sk, skb, cur_mss); |
1886 | 1891 | ||
1887 | if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk)) | ||
1888 | return -EHOSTUNREACH; /* Routing failure or similar. */ | ||
1889 | |||
1890 | /* Some Solaris stacks overoptimize and ignore the FIN on a | 1892 | /* Some Solaris stacks overoptimize and ignore the FIN on a |
1891 | * retransmit when old data is attached. So strip it off | 1893 | * retransmit when old data is attached. So strip it off |
1892 | * since it is cheap to do so and saves bytes on the network. | 1894 | * since it is cheap to do so and saves bytes on the network. |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e591e09e5e4e..3a835578fd1c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1764,14 +1764,16 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1764 | * 2) Configure prefixes with the auto flag set | 1764 | * 2) Configure prefixes with the auto flag set |
1765 | */ | 1765 | */ |
1766 | 1766 | ||
1767 | /* Avoid arithmetic overflow. Really, we could | 1767 | if (valid_lft == INFINITY_LIFE_TIME) |
1768 | save rt_expires in seconds, likely valid_lft, | 1768 | rt_expires = ~0UL; |
1769 | but it would require division in fib gc, that it | 1769 | else if (valid_lft >= 0x7FFFFFFF/HZ) { |
1770 | not good. | 1770 | /* Avoid arithmetic overflow. Really, we could |
1771 | */ | 1771 | * save rt_expires in seconds, likely valid_lft, |
1772 | if (valid_lft >= 0x7FFFFFFF/HZ) | 1772 | * but it would require division in fib gc, that it |
1773 | * not good. | ||
1774 | */ | ||
1773 | rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ); | 1775 | rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ); |
1774 | else | 1776 | } else |
1775 | rt_expires = valid_lft * HZ; | 1777 | rt_expires = valid_lft * HZ; |
1776 | 1778 | ||
1777 | /* | 1779 | /* |
@@ -1779,7 +1781,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1779 | * Avoid arithmetic overflow there as well. | 1781 | * Avoid arithmetic overflow there as well. |
1780 | * Overflow can happen only if HZ < USER_HZ. | 1782 | * Overflow can happen only if HZ < USER_HZ. |
1781 | */ | 1783 | */ |
1782 | if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ) | 1784 | if (HZ < USER_HZ && ~rt_expires && rt_expires > 0x7FFFFFFF / USER_HZ) |
1783 | rt_expires = 0x7FFFFFFF / USER_HZ; | 1785 | rt_expires = 0x7FFFFFFF / USER_HZ; |
1784 | 1786 | ||
1785 | if (pinfo->onlink) { | 1787 | if (pinfo->onlink) { |
@@ -1788,17 +1790,28 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1788 | dev->ifindex, 1); | 1790 | dev->ifindex, 1); |
1789 | 1791 | ||
1790 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { | 1792 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { |
1791 | if (rt->rt6i_flags&RTF_EXPIRES) { | 1793 | /* Autoconf prefix route */ |
1792 | if (valid_lft == 0) { | 1794 | if (valid_lft == 0) { |
1793 | ip6_del_rt(rt); | 1795 | ip6_del_rt(rt); |
1794 | rt = NULL; | 1796 | rt = NULL; |
1795 | } else { | 1797 | } else if (~rt_expires) { |
1796 | rt->rt6i_expires = jiffies + rt_expires; | 1798 | /* not infinity */ |
1797 | } | 1799 | rt->rt6i_expires = jiffies + rt_expires; |
1800 | rt->rt6i_flags |= RTF_EXPIRES; | ||
1801 | } else { | ||
1802 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
1803 | rt->rt6i_expires = 0; | ||
1798 | } | 1804 | } |
1799 | } else if (valid_lft) { | 1805 | } else if (valid_lft) { |
1806 | int flags = RTF_ADDRCONF | RTF_PREFIX_RT; | ||
1807 | clock_t expires = 0; | ||
1808 | if (~rt_expires) { | ||
1809 | /* not infinity */ | ||
1810 | flags |= RTF_EXPIRES; | ||
1811 | expires = jiffies_to_clock_t(rt_expires); | ||
1812 | } | ||
1800 | addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, | 1813 | addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, |
1801 | dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); | 1814 | dev, expires, flags); |
1802 | } | 1815 | } |
1803 | if (rt) | 1816 | if (rt) |
1804 | dst_release(&rt->u.dst); | 1817 | dst_release(&rt->u.dst); |
@@ -2021,7 +2034,8 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | |||
2021 | struct inet6_dev *idev; | 2034 | struct inet6_dev *idev; |
2022 | struct net_device *dev; | 2035 | struct net_device *dev; |
2023 | int scope; | 2036 | int scope; |
2024 | u32 flags = RTF_EXPIRES; | 2037 | u32 flags; |
2038 | clock_t expires; | ||
2025 | 2039 | ||
2026 | ASSERT_RTNL(); | 2040 | ASSERT_RTNL(); |
2027 | 2041 | ||
@@ -2041,8 +2055,13 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | |||
2041 | if (valid_lft == INFINITY_LIFE_TIME) { | 2055 | if (valid_lft == INFINITY_LIFE_TIME) { |
2042 | ifa_flags |= IFA_F_PERMANENT; | 2056 | ifa_flags |= IFA_F_PERMANENT; |
2043 | flags = 0; | 2057 | flags = 0; |
2044 | } else if (valid_lft >= 0x7FFFFFFF/HZ) | 2058 | expires = 0; |
2045 | valid_lft = 0x7FFFFFFF/HZ; | 2059 | } else { |
2060 | if (valid_lft >= 0x7FFFFFFF/HZ) | ||
2061 | valid_lft = 0x7FFFFFFF/HZ; | ||
2062 | flags = RTF_EXPIRES; | ||
2063 | expires = jiffies_to_clock_t(valid_lft * HZ); | ||
2064 | } | ||
2046 | 2065 | ||
2047 | if (prefered_lft == 0) | 2066 | if (prefered_lft == 0) |
2048 | ifa_flags |= IFA_F_DEPRECATED; | 2067 | ifa_flags |= IFA_F_DEPRECATED; |
@@ -2060,7 +2079,7 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | |||
2060 | spin_unlock_bh(&ifp->lock); | 2079 | spin_unlock_bh(&ifp->lock); |
2061 | 2080 | ||
2062 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, | 2081 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, |
2063 | jiffies_to_clock_t(valid_lft * HZ), flags); | 2082 | expires, flags); |
2064 | /* | 2083 | /* |
2065 | * Note that section 3.1 of RFC 4429 indicates | 2084 | * Note that section 3.1 of RFC 4429 indicates |
2066 | * that the Optimistic flag should not be set for | 2085 | * that the Optimistic flag should not be set for |
@@ -3148,7 +3167,8 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
3148 | static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | 3167 | static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, |
3149 | u32 prefered_lft, u32 valid_lft) | 3168 | u32 prefered_lft, u32 valid_lft) |
3150 | { | 3169 | { |
3151 | u32 flags = RTF_EXPIRES; | 3170 | u32 flags; |
3171 | clock_t expires; | ||
3152 | 3172 | ||
3153 | if (!valid_lft || (prefered_lft > valid_lft)) | 3173 | if (!valid_lft || (prefered_lft > valid_lft)) |
3154 | return -EINVAL; | 3174 | return -EINVAL; |
@@ -3156,8 +3176,13 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | |||
3156 | if (valid_lft == INFINITY_LIFE_TIME) { | 3176 | if (valid_lft == INFINITY_LIFE_TIME) { |
3157 | ifa_flags |= IFA_F_PERMANENT; | 3177 | ifa_flags |= IFA_F_PERMANENT; |
3158 | flags = 0; | 3178 | flags = 0; |
3159 | } else if (valid_lft >= 0x7FFFFFFF/HZ) | 3179 | expires = 0; |
3160 | valid_lft = 0x7FFFFFFF/HZ; | 3180 | } else { |
3181 | if (valid_lft >= 0x7FFFFFFF/HZ) | ||
3182 | valid_lft = 0x7FFFFFFF/HZ; | ||
3183 | flags = RTF_EXPIRES; | ||
3184 | expires = jiffies_to_clock_t(valid_lft * HZ); | ||
3185 | } | ||
3161 | 3186 | ||
3162 | if (prefered_lft == 0) | 3187 | if (prefered_lft == 0) |
3163 | ifa_flags |= IFA_F_DEPRECATED; | 3188 | ifa_flags |= IFA_F_DEPRECATED; |
@@ -3176,7 +3201,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | |||
3176 | ipv6_ifa_notify(0, ifp); | 3201 | ipv6_ifa_notify(0, ifp); |
3177 | 3202 | ||
3178 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, | 3203 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, |
3179 | jiffies_to_clock_t(valid_lft * HZ), flags); | 3204 | expires, flags); |
3180 | addrconf_verify(0); | 3205 | addrconf_verify(0); |
3181 | 3206 | ||
3182 | return 0; | 3207 | return 0; |
@@ -4242,7 +4267,7 @@ static void addrconf_sysctl_register(struct inet6_dev *idev) | |||
4242 | neigh_sysctl_register(idev->dev, idev->nd_parms, NET_IPV6, | 4267 | neigh_sysctl_register(idev->dev, idev->nd_parms, NET_IPV6, |
4243 | NET_IPV6_NEIGH, "ipv6", | 4268 | NET_IPV6_NEIGH, "ipv6", |
4244 | &ndisc_ifinfo_sysctl_change, | 4269 | &ndisc_ifinfo_sysctl_change, |
4245 | NULL); | 4270 | ndisc_ifinfo_sysctl_strategy); |
4246 | __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name, | 4271 | __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name, |
4247 | idev->dev->ifindex, idev, &idev->cnf); | 4272 | idev->dev->ifindex, idev, &idev->cnf); |
4248 | } | 4273 | } |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index a55fc05b8125..282fdb31f8ed 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1727,10 +1727,10 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f | |||
1727 | return ret; | 1727 | return ret; |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | static int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, | 1730 | int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, |
1731 | int nlen, void __user *oldval, | 1731 | int nlen, void __user *oldval, |
1732 | size_t __user *oldlenp, | 1732 | size_t __user *oldlenp, |
1733 | void __user *newval, size_t newlen) | 1733 | void __user *newval, size_t newlen) |
1734 | { | 1734 | { |
1735 | struct net_device *dev = ctl->extra1; | 1735 | struct net_device *dev = ctl->extra1; |
1736 | struct inet6_dev *idev; | 1736 | struct inet6_dev *idev; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 12bba0880345..48534c6c0735 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -109,7 +109,7 @@ static struct dst_ops ip6_dst_ops_template = { | |||
109 | .negative_advice = ip6_negative_advice, | 109 | .negative_advice = ip6_negative_advice, |
110 | .link_failure = ip6_link_failure, | 110 | .link_failure = ip6_link_failure, |
111 | .update_pmtu = ip6_rt_update_pmtu, | 111 | .update_pmtu = ip6_rt_update_pmtu, |
112 | .local_out = ip6_local_out, | 112 | .local_out = __ip6_local_out, |
113 | .entry_size = sizeof(struct rt6_info), | 113 | .entry_size = sizeof(struct rt6_info), |
114 | .entries = ATOMIC_INIT(0), | 114 | .entries = ATOMIC_INIT(0), |
115 | }; | 115 | }; |
@@ -475,7 +475,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
475 | lifetime = ntohl(rinfo->lifetime); | 475 | lifetime = ntohl(rinfo->lifetime); |
476 | if (lifetime == 0xffffffff) { | 476 | if (lifetime == 0xffffffff) { |
477 | /* infinity */ | 477 | /* infinity */ |
478 | } else if (lifetime > 0x7fffffff/HZ) { | 478 | } else if (lifetime > 0x7fffffff/HZ - 1) { |
479 | /* Avoid arithmetic overflow */ | 479 | /* Avoid arithmetic overflow */ |
480 | lifetime = 0x7fffffff/HZ - 1; | 480 | lifetime = 0x7fffffff/HZ - 1; |
481 | } | 481 | } |
@@ -1106,7 +1106,9 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | rt->u.dst.obsolete = -1; | 1108 | rt->u.dst.obsolete = -1; |
1109 | rt->rt6i_expires = jiffies + clock_t_to_jiffies(cfg->fc_expires); | 1109 | rt->rt6i_expires = (cfg->fc_flags & RTF_EXPIRES) ? |
1110 | jiffies + clock_t_to_jiffies(cfg->fc_expires) : | ||
1111 | 0; | ||
1110 | 1112 | ||
1111 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 1113 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
1112 | cfg->fc_protocol = RTPROT_BOOT; | 1114 | cfg->fc_protocol = RTPROT_BOOT; |
@@ -2200,7 +2202,9 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, | |||
2200 | 2202 | ||
2201 | NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); | 2203 | NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); |
2202 | 2204 | ||
2203 | expires = rt->rt6i_expires ? rt->rt6i_expires - jiffies : 0; | 2205 | expires = (rt->rt6i_flags & RTF_EXPIRES) ? |
2206 | rt->rt6i_expires - jiffies : 0; | ||
2207 | |||
2204 | if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, | 2208 | if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, |
2205 | expires, rt->u.dst.error) < 0) | 2209 | expires, rt->u.dst.error) < 0) |
2206 | goto nla_put_failure; | 2210 | goto nla_put_failure; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index b0ee96187633..6b8f0583b637 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -403,9 +403,8 @@ static void ipip6_tunnel_uninit(struct net_device *dev) | |||
403 | 403 | ||
404 | static int ipip6_err(struct sk_buff *skb, u32 info) | 404 | static int ipip6_err(struct sk_buff *skb, u32 info) |
405 | { | 405 | { |
406 | #ifndef I_WISH_WORLD_WERE_PERFECT | ||
407 | 406 | ||
408 | /* It is not :-( All the routers (except for Linux) return only | 407 | /* All the routers (except for Linux) return only |
409 | 8 bytes of packet payload. It means, that precise relaying of | 408 | 8 bytes of packet payload. It means, that precise relaying of |
410 | ICMP in the real Internet is absolutely infeasible. | 409 | ICMP in the real Internet is absolutely infeasible. |
411 | */ | 410 | */ |
@@ -462,92 +461,6 @@ static int ipip6_err(struct sk_buff *skb, u32 info) | |||
462 | out: | 461 | out: |
463 | read_unlock(&ipip6_lock); | 462 | read_unlock(&ipip6_lock); |
464 | return err; | 463 | return err; |
465 | #else | ||
466 | struct iphdr *iph = (struct iphdr*)dp; | ||
467 | int hlen = iph->ihl<<2; | ||
468 | struct ipv6hdr *iph6; | ||
469 | const int type = icmp_hdr(skb)->type; | ||
470 | const int code = icmp_hdr(skb)->code; | ||
471 | int rel_type = 0; | ||
472 | int rel_code = 0; | ||
473 | int rel_info = 0; | ||
474 | struct sk_buff *skb2; | ||
475 | struct rt6_info *rt6i; | ||
476 | |||
477 | if (len < hlen + sizeof(struct ipv6hdr)) | ||
478 | return; | ||
479 | iph6 = (struct ipv6hdr*)(dp + hlen); | ||
480 | |||
481 | switch (type) { | ||
482 | default: | ||
483 | return; | ||
484 | case ICMP_PARAMETERPROB: | ||
485 | if (icmp_hdr(skb)->un.gateway < hlen) | ||
486 | return; | ||
487 | |||
488 | /* So... This guy found something strange INSIDE encapsulated | ||
489 | packet. Well, he is fool, but what can we do ? | ||
490 | */ | ||
491 | rel_type = ICMPV6_PARAMPROB; | ||
492 | rel_info = icmp_hdr(skb)->un.gateway - hlen; | ||
493 | break; | ||
494 | |||
495 | case ICMP_DEST_UNREACH: | ||
496 | switch (code) { | ||
497 | case ICMP_SR_FAILED: | ||
498 | case ICMP_PORT_UNREACH: | ||
499 | /* Impossible event. */ | ||
500 | return; | ||
501 | case ICMP_FRAG_NEEDED: | ||
502 | /* Too complicated case ... */ | ||
503 | return; | ||
504 | default: | ||
505 | /* All others are translated to HOST_UNREACH. | ||
506 | rfc2003 contains "deep thoughts" about NET_UNREACH, | ||
507 | I believe, it is just ether pollution. --ANK | ||
508 | */ | ||
509 | rel_type = ICMPV6_DEST_UNREACH; | ||
510 | rel_code = ICMPV6_ADDR_UNREACH; | ||
511 | break; | ||
512 | } | ||
513 | break; | ||
514 | case ICMP_TIME_EXCEEDED: | ||
515 | if (code != ICMP_EXC_TTL) | ||
516 | return; | ||
517 | rel_type = ICMPV6_TIME_EXCEED; | ||
518 | rel_code = ICMPV6_EXC_HOPLIMIT; | ||
519 | break; | ||
520 | } | ||
521 | |||
522 | /* Prepare fake skb to feed it to icmpv6_send */ | ||
523 | skb2 = skb_clone(skb, GFP_ATOMIC); | ||
524 | if (skb2 == NULL) | ||
525 | return 0; | ||
526 | dst_release(skb2->dst); | ||
527 | skb2->dst = NULL; | ||
528 | skb_pull(skb2, skb->data - (u8*)iph6); | ||
529 | skb_reset_network_header(skb2); | ||
530 | |||
531 | /* Try to guess incoming interface */ | ||
532 | rt6i = rt6_lookup(dev_net(skb->dev), &iph6->saddr, NULL, NULL, 0); | ||
533 | if (rt6i && rt6i->rt6i_dev) { | ||
534 | skb2->dev = rt6i->rt6i_dev; | ||
535 | |||
536 | rt6i = rt6_lookup(dev_net(skb->dev), | ||
537 | &iph6->daddr, &iph6->saddr, NULL, 0); | ||
538 | |||
539 | if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) { | ||
540 | struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev); | ||
541 | if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) { | ||
542 | rel_type = ICMPV6_DEST_UNREACH; | ||
543 | rel_code = ICMPV6_ADDR_UNREACH; | ||
544 | } | ||
545 | icmpv6_send(skb2, rel_type, rel_code, rel_info, skb2->dev); | ||
546 | } | ||
547 | } | ||
548 | kfree_skb(skb2); | ||
549 | return 0; | ||
550 | #endif | ||
551 | } | 464 | } |
552 | 465 | ||
553 | static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | 466 | static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 9e7236ff6bcc..9bba7ac5fee0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -1251,7 +1251,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, | |||
1251 | x->sel.prefixlen_s = addr->sadb_address_prefixlen; | 1251 | x->sel.prefixlen_s = addr->sadb_address_prefixlen; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | if (x->props.mode == XFRM_MODE_TRANSPORT) | 1254 | if (!x->sel.family) |
1255 | x->sel.family = x->props.family; | 1255 | x->sel.family = x->props.family; |
1256 | 1256 | ||
1257 | if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { | 1257 | if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 7877d3b3f4cb..3f7f92a2f227 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -721,7 +721,17 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
721 | capab |= WLAN_CAPABILITY_PRIVACY; | 721 | capab |= WLAN_CAPABILITY_PRIVACY; |
722 | if (bss->wmm_ie) | 722 | if (bss->wmm_ie) |
723 | wmm = 1; | 723 | wmm = 1; |
724 | |||
725 | /* get all rates supported by the device and the AP as | ||
726 | * some APs don't like getting a superset of their rates | ||
727 | * in the association request (e.g. D-Link DAP 1353 in | ||
728 | * b-only mode) */ | ||
729 | rates_len = ieee80211_compatible_rates(bss, sband, &rates); | ||
730 | |||
724 | ieee80211_rx_bss_put(dev, bss); | 731 | ieee80211_rx_bss_put(dev, bss); |
732 | } else { | ||
733 | rates = ~0; | ||
734 | rates_len = sband->n_bitrates; | ||
725 | } | 735 | } |
726 | 736 | ||
727 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 737 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
@@ -752,10 +762,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
752 | *pos++ = ifsta->ssid_len; | 762 | *pos++ = ifsta->ssid_len; |
753 | memcpy(pos, ifsta->ssid, ifsta->ssid_len); | 763 | memcpy(pos, ifsta->ssid, ifsta->ssid_len); |
754 | 764 | ||
755 | /* all supported rates should be added here but some APs | 765 | /* add all rates which were marked to be used above */ |
756 | * (e.g. D-Link DAP 1353 in b-only mode) don't like that | ||
757 | * Therefore only add rates the AP supports */ | ||
758 | rates_len = ieee80211_compatible_rates(bss, sband, &rates); | ||
759 | supp_rates_len = rates_len; | 766 | supp_rates_len = rates_len; |
760 | if (supp_rates_len > 8) | 767 | if (supp_rates_len > 8) |
761 | supp_rates_len = 8; | 768 | supp_rates_len = 8; |
@@ -3434,21 +3441,17 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3434 | struct ieee80211_sta_bss *bss, *selected = NULL; | 3441 | struct ieee80211_sta_bss *bss, *selected = NULL; |
3435 | int top_rssi = 0, freq; | 3442 | int top_rssi = 0, freq; |
3436 | 3443 | ||
3437 | if (!(ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL | | ||
3438 | IEEE80211_STA_AUTO_BSSID_SEL | IEEE80211_STA_AUTO_CHANNEL_SEL))) { | ||
3439 | ifsta->state = IEEE80211_AUTHENTICATE; | ||
3440 | ieee80211_sta_reset_auth(dev, ifsta); | ||
3441 | return 0; | ||
3442 | } | ||
3443 | |||
3444 | spin_lock_bh(&local->sta_bss_lock); | 3444 | spin_lock_bh(&local->sta_bss_lock); |
3445 | freq = local->oper_channel->center_freq; | 3445 | freq = local->oper_channel->center_freq; |
3446 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 3446 | list_for_each_entry(bss, &local->sta_bss_list, list) { |
3447 | if (!(bss->capability & WLAN_CAPABILITY_ESS)) | 3447 | if (!(bss->capability & WLAN_CAPABILITY_ESS)) |
3448 | continue; | 3448 | continue; |
3449 | 3449 | ||
3450 | if (!!(bss->capability & WLAN_CAPABILITY_PRIVACY) ^ | 3450 | if ((ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL | |
3451 | !!sdata->default_key) | 3451 | IEEE80211_STA_AUTO_BSSID_SEL | |
3452 | IEEE80211_STA_AUTO_CHANNEL_SEL)) && | ||
3453 | (!!(bss->capability & WLAN_CAPABILITY_PRIVACY) ^ | ||
3454 | !!sdata->default_key)) | ||
3452 | continue; | 3455 | continue; |
3453 | 3456 | ||
3454 | if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) && | 3457 | if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) && |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 24a465c4df09..131e9e6c8a32 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -389,6 +389,41 @@ void ieee80211_iterate_active_interfaces( | |||
389 | struct ieee80211_local *local = hw_to_local(hw); | 389 | struct ieee80211_local *local = hw_to_local(hw); |
390 | struct ieee80211_sub_if_data *sdata; | 390 | struct ieee80211_sub_if_data *sdata; |
391 | 391 | ||
392 | rtnl_lock(); | ||
393 | |||
394 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
395 | switch (sdata->vif.type) { | ||
396 | case IEEE80211_IF_TYPE_INVALID: | ||
397 | case IEEE80211_IF_TYPE_MNTR: | ||
398 | case IEEE80211_IF_TYPE_VLAN: | ||
399 | continue; | ||
400 | case IEEE80211_IF_TYPE_AP: | ||
401 | case IEEE80211_IF_TYPE_STA: | ||
402 | case IEEE80211_IF_TYPE_IBSS: | ||
403 | case IEEE80211_IF_TYPE_WDS: | ||
404 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
405 | break; | ||
406 | } | ||
407 | if (sdata->dev == local->mdev) | ||
408 | continue; | ||
409 | if (netif_running(sdata->dev)) | ||
410 | iterator(data, sdata->dev->dev_addr, | ||
411 | &sdata->vif); | ||
412 | } | ||
413 | |||
414 | rtnl_unlock(); | ||
415 | } | ||
416 | EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); | ||
417 | |||
418 | void ieee80211_iterate_active_interfaces_atomic( | ||
419 | struct ieee80211_hw *hw, | ||
420 | void (*iterator)(void *data, u8 *mac, | ||
421 | struct ieee80211_vif *vif), | ||
422 | void *data) | ||
423 | { | ||
424 | struct ieee80211_local *local = hw_to_local(hw); | ||
425 | struct ieee80211_sub_if_data *sdata; | ||
426 | |||
392 | rcu_read_lock(); | 427 | rcu_read_lock(); |
393 | 428 | ||
394 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 429 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
@@ -413,4 +448,4 @@ void ieee80211_iterate_active_interfaces( | |||
413 | 448 | ||
414 | rcu_read_unlock(); | 449 | rcu_read_unlock(); |
415 | } | 450 | } |
416 | EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); | 451 | EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic); |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 6a342a9a40cd..c2e2378af082 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -221,7 +221,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, | |||
221 | range->num_frequency = c; | 221 | range->num_frequency = c; |
222 | 222 | ||
223 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); | 223 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); |
224 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); | ||
225 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); | 224 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); |
226 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); | 225 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); |
227 | 226 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 1086df7478bc..9360fc81e8c7 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -220,7 +220,7 @@ replay: | |||
220 | tp = kzalloc(sizeof(*tp), GFP_KERNEL); | 220 | tp = kzalloc(sizeof(*tp), GFP_KERNEL); |
221 | if (tp == NULL) | 221 | if (tp == NULL) |
222 | goto errout; | 222 | goto errout; |
223 | err = -EINVAL; | 223 | err = -ENOENT; |
224 | tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]); | 224 | tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]); |
225 | if (tp_ops == NULL) { | 225 | if (tp_ops == NULL) { |
226 | #ifdef CONFIG_KMOD | 226 | #ifdef CONFIG_KMOD |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index a1b0fbe3ea35..b976d9ed10e4 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -50,19 +50,8 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type) | |||
50 | 50 | ||
51 | switch (type) { | 51 | switch (type) { |
52 | case XFRMA_ALG_AUTH: | 52 | case XFRMA_ALG_AUTH: |
53 | if (!algp->alg_key_len && | ||
54 | strcmp(algp->alg_name, "digest_null") != 0) | ||
55 | return -EINVAL; | ||
56 | break; | ||
57 | |||
58 | case XFRMA_ALG_CRYPT: | 53 | case XFRMA_ALG_CRYPT: |
59 | if (!algp->alg_key_len && | ||
60 | strcmp(algp->alg_name, "cipher_null") != 0) | ||
61 | return -EINVAL; | ||
62 | break; | ||
63 | |||
64 | case XFRMA_ALG_COMP: | 54 | case XFRMA_ALG_COMP: |
65 | /* Zero length keys are legal. */ | ||
66 | break; | 55 | break; |
67 | 56 | ||
68 | default: | 57 | default: |