From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: yoshfuji@linux-ipv6.org
Subject: [PATCH net-next 16/19] ndisc: Fill in ICMPv6 checksum and IPv6 header in ndisc_send_skb().
Date: Tue, 22 Jan 2013 01:49:08 +0900 [thread overview]
Message-ID: <50FD7184.2020107@linux-ipv6.org> (raw)
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv6/ndisc.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 437781c..dda4add 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -420,8 +420,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev,
const struct in6_addr *target,
int llinfo)
{
- struct net *net = dev_net(dev);
- struct sock *sk = net->ipv6.ndisc_sk;
struct sk_buff *skb;
struct icmp6hdr *hdr;
int len;
@@ -453,13 +451,6 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev,
if (llinfo)
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;
}
@@ -469,6 +460,7 @@ static void ndisc_send_skb(struct sk_buff *skb,
{
struct dst_entry *dst = skb_dst(skb);
struct net *net = dev_net(skb->dev);
+ struct sock *sk = net->ipv6.ndisc_sk;
struct inet6_dev *idev;
int err;
struct icmp6hdr *icmp6h = icmp6_hdr(skb);
@@ -490,6 +482,13 @@ static void ndisc_send_skb(struct sk_buff *skb,
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();
idev = __in6_dev_get(dst->dev);
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)
if (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);
ndisc_send_skb(buff, &ipv6_hdr(skb)->saddr, &saddr_buf);
return;
--
1.7.9.5
reply other threads:[~2013-01-21 16:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50FD7184.2020107@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.