aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 73eb8c33e9f0..56ea92837307 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -472,7 +472,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
472 inc_opt = 0; 472 inc_opt = 0;
473 } 473 }
474 474
475 skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), 475 skb = sock_alloc_send_skb(sk,
476 (MAX_HEADER + sizeof(struct ipv6hdr) +
477 len + LL_RESERVED_SPACE(dev)),
476 1, &err); 478 1, &err);
477 479
478 if (skb == NULL) { 480 if (skb == NULL) {
@@ -513,7 +515,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
513 515
514 skb->dst = dst; 516 skb->dst = dst;
515 idev = in6_dev_get(dst->dev); 517 idev = in6_dev_get(dst->dev);
516 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 518 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
517 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); 519 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
518 if (!err) { 520 if (!err) {
519 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS); 521 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS);
@@ -561,7 +563,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
561 if (send_llinfo) 563 if (send_llinfo)
562 len += ndisc_opt_addr_space(dev); 564 len += ndisc_opt_addr_space(dev);
563 565
564 skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), 566 skb = sock_alloc_send_skb(sk,
567 (MAX_HEADER + sizeof(struct ipv6hdr) +
568 len + LL_RESERVED_SPACE(dev)),
565 1, &err); 569 1, &err);
566 if (skb == NULL) { 570 if (skb == NULL) {
567 ND_PRINTK0(KERN_ERR 571 ND_PRINTK0(KERN_ERR
@@ -597,7 +601,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
597 /* send it! */ 601 /* send it! */
598 skb->dst = dst; 602 skb->dst = dst;
599 idev = in6_dev_get(dst->dev); 603 idev = in6_dev_get(dst->dev);
600 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 604 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
601 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); 605 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
602 if (!err) { 606 if (!err) {
603 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORSOLICITS); 607 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORSOLICITS);
@@ -636,7 +640,9 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
636 if (dev->addr_len) 640 if (dev->addr_len)
637 len += ndisc_opt_addr_space(dev); 641 len += ndisc_opt_addr_space(dev);
638 642
639 skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), 643 skb = sock_alloc_send_skb(sk,
644 (MAX_HEADER + sizeof(struct ipv6hdr) +
645 len + LL_RESERVED_SPACE(dev)),
640 1, &err); 646 1, &err);
641 if (skb == NULL) { 647 if (skb == NULL) {
642 ND_PRINTK0(KERN_ERR 648 ND_PRINTK0(KERN_ERR
@@ -670,7 +676,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
670 /* send it! */ 676 /* send it! */
671 skb->dst = dst; 677 skb->dst = dst;
672 idev = in6_dev_get(dst->dev); 678 idev = in6_dev_get(dst->dev);
673 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 679 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
674 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); 680 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
675 if (!err) { 681 if (!err) {
676 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTROUTERSOLICITS); 682 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTROUTERSOLICITS);
@@ -1261,10 +1267,11 @@ skip_defrtr:
1261 } 1267 }
1262 1268
1263 if (ndopts.nd_opts_mtu) { 1269 if (ndopts.nd_opts_mtu) {
1270 __be32 n;
1264 u32 mtu; 1271 u32 mtu;
1265 1272
1266 memcpy(&mtu, ((u8*)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu)); 1273 memcpy(&n, ((u8*)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
1267 mtu = ntohl(mtu); 1274 mtu = ntohl(n);
1268 1275
1269 if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) { 1276 if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
1270 ND_PRINTK2(KERN_WARNING 1277 ND_PRINTK2(KERN_WARNING
@@ -1446,7 +1453,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1446 rd_len &= ~0x7; 1453 rd_len &= ~0x7;
1447 len += rd_len; 1454 len += rd_len;
1448 1455
1449 buff = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), 1456 buff = sock_alloc_send_skb(sk,
1457 (MAX_HEADER + sizeof(struct ipv6hdr) +
1458 len + LL_RESERVED_SPACE(dev)),
1450 1, &err); 1459 1, &err);
1451 if (buff == NULL) { 1460 if (buff == NULL) {
1452 ND_PRINTK0(KERN_ERR 1461 ND_PRINTK0(KERN_ERR
@@ -1504,7 +1513,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1504 1513
1505 buff->dst = dst; 1514 buff->dst = dst;
1506 idev = in6_dev_get(dst->dev); 1515 idev = in6_dev_get(dst->dev);
1507 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 1516 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
1508 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output); 1517 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
1509 if (!err) { 1518 if (!err) {
1510 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTREDIRECTS); 1519 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTREDIRECTS);