Commit 7b3d9b06 authored by YOSHIFUJI Hideaki / 吉藤英明's avatar YOSHIFUJI Hideaki / 吉藤英明 Committed by David S. Miller

ndisc: Fill in ICMPv6 checksum and IPv6 header in ndisc_send_skb().

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4de84c6
...@@ -420,8 +420,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev, ...@@ -420,8 +420,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev,
const struct in6_addr *target, const struct in6_addr *target,
int llinfo) int llinfo)
{ {
struct net *net = dev_net(dev);
struct sock *sk = net->ipv6.ndisc_sk;
struct sk_buff *skb; struct sk_buff *skb;
struct icmp6hdr *hdr; struct icmp6hdr *hdr;
int len; int len;
...@@ -453,13 +451,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev, ...@@ -453,13 +451,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev,
if (llinfo) if (llinfo)
ndisc_fill_addr_option(skb, llinfo, dev->dev_addr); ndisc_fill_addr_option(skb, llinfo, dev->dev_addr);
hdr->icmp6_cksum = csum_ipv6_magic(saddr, daddr, skb->len,
IPPROTO_ICMPV6,
csum_partial(hdr,
skb->len, 0));
ip6_nd_hdr(skb, saddr, daddr, inet6_sk(sk)->hop_limit, skb->len);
return skb; return skb;
} }
...@@ -469,6 +460,7 @@ static void ndisc_send_skb(struct sk_buff *skb, ...@@ -469,6 +460,7 @@ static void ndisc_send_skb(struct sk_buff *skb,
{ {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
struct sock *sk = net->ipv6.ndisc_sk;
struct inet6_dev *idev; struct inet6_dev *idev;
int err; int err;
struct icmp6hdr *icmp6h = icmp6_hdr(skb); struct icmp6hdr *icmp6h = icmp6_hdr(skb);
...@@ -490,6 +482,13 @@ static void ndisc_send_skb(struct sk_buff *skb, ...@@ -490,6 +482,13 @@ static void ndisc_send_skb(struct sk_buff *skb,
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
} }
icmp6h->icmp6_cksum = csum_ipv6_magic(saddr, daddr, skb->len,
IPPROTO_ICMPV6,
csum_partial(icmp6h,
skb->len, 0));
ip6_nd_hdr(skb, saddr, daddr, inet6_sk(sk)->hop_limit, skb->len);
rcu_read_lock(); rcu_read_lock();
idev = __in6_dev_get(dst->dev); idev = __in6_dev_get(dst->dev);
IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
...@@ -1508,13 +1507,6 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) ...@@ -1508,13 +1507,6 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
if (rd_len) if (rd_len)
ndisc_fill_redirect_hdr_option(buff, skb, rd_len); ndisc_fill_redirect_hdr_option(buff, skb, rd_len);
msg->icmph.icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
buff->len, IPPROTO_ICMPV6,
csum_partial(msg, buff->len, 0));
ip6_nd_hdr(buff, &saddr_buf, &ipv6_hdr(skb)->saddr,
inet6_sk(sk)->hop_limit, buff->len);
skb_dst_set(buff, dst); skb_dst_set(buff, dst);
ndisc_send_skb(buff, &ipv6_hdr(skb)->saddr, &saddr_buf); ndisc_send_skb(buff, &ipv6_hdr(skb)->saddr, &saddr_buf);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment