aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/igmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r--net/ipv4/igmp.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 0687a7235a6c..f511d03e2439 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -315,7 +315,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
315 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 315 skb_reserve(skb, LL_RESERVED_SPACE(dev));
316 316
317 skb_reset_network_header(skb); 317 skb_reset_network_header(skb);
318 pip = skb->nh.iph; 318 pip = ip_hdr(skb);
319 skb_put(skb, sizeof(struct iphdr) + 4); 319 skb_put(skb, sizeof(struct iphdr) + 4);
320 320
321 pip->version = 4; 321 pip->version = 4;
@@ -345,16 +345,14 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
345 345
346static int igmpv3_sendpack(struct sk_buff *skb) 346static int igmpv3_sendpack(struct sk_buff *skb)
347{ 347{
348 struct iphdr *pip = skb->nh.iph; 348 struct iphdr *pip = ip_hdr(skb);
349 struct igmphdr *pig = skb->h.igmph; 349 struct igmphdr *pig = skb->h.igmph;
350 int iplen, igmplen; 350 const int iplen = skb->tail - skb->nh.raw;
351 const int igmplen = skb->tail - skb->h.raw;
351 352
352 iplen = skb->tail - (unsigned char *)skb->nh.iph;
353 pip->tot_len = htons(iplen); 353 pip->tot_len = htons(iplen);
354 ip_send_check(pip); 354 ip_send_check(pip);
355 355 pig->csum = ip_compute_csum(skb->h.igmph, igmplen);
356 igmplen = skb->tail - (unsigned char *)skb->h.igmph;
357 pig->csum = ip_compute_csum((void *)skb->h.igmph, igmplen);
358 356
359 return NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, skb->dev, 357 return NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, skb->dev,
360 dst_output); 358 dst_output);
@@ -667,7 +665,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
667 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 665 skb_reserve(skb, LL_RESERVED_SPACE(dev));
668 666
669 skb_reset_network_header(skb); 667 skb_reset_network_header(skb);
670 iph = skb->nh.iph; 668 iph = ip_hdr(skb);
671 skb_put(skb, sizeof(struct iphdr) + 4); 669 skb_put(skb, sizeof(struct iphdr) + 4);
672 670
673 iph->version = 4; 671 iph->version = 4;