diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-13 13:19:23 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:21 -0400 |
commit | d9edf9e2be0f7661558984c32bd53867a7037fd3 (patch) | |
tree | 603271a9d0756e229ad9ff13c628a33306c96bdf /net/ipv4 | |
parent | cc70ab261c9f997589546100ddec5da6bfd89c4e (diff) |
[SK_BUFF]: Introduce igmp_hdr() & friends, remove skb->h.igmph
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/igmp.c | 22 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index f511d03e2439..292516bb1eca 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -333,8 +333,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
333 | ((u8*)&pip[1])[2] = 0; | 333 | ((u8*)&pip[1])[2] = 0; |
334 | ((u8*)&pip[1])[3] = 0; | 334 | ((u8*)&pip[1])[3] = 0; |
335 | 335 | ||
336 | pig =(struct igmpv3_report *)skb_put(skb, sizeof(*pig)); | 336 | skb->h.raw = skb_put(skb, sizeof(*pig)); |
337 | skb->h.igmph = (struct igmphdr *)pig; | 337 | pig = igmpv3_report_hdr(skb); |
338 | pig->type = IGMPV3_HOST_MEMBERSHIP_REPORT; | 338 | pig->type = IGMPV3_HOST_MEMBERSHIP_REPORT; |
339 | pig->resv1 = 0; | 339 | pig->resv1 = 0; |
340 | pig->csum = 0; | 340 | pig->csum = 0; |
@@ -346,13 +346,13 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
346 | static int igmpv3_sendpack(struct sk_buff *skb) | 346 | static int igmpv3_sendpack(struct sk_buff *skb) |
347 | { | 347 | { |
348 | struct iphdr *pip = ip_hdr(skb); | 348 | struct iphdr *pip = ip_hdr(skb); |
349 | struct igmphdr *pig = skb->h.igmph; | 349 | struct igmphdr *pig = igmp_hdr(skb); |
350 | const int iplen = skb->tail - skb->nh.raw; | 350 | const int iplen = skb->tail - skb->nh.raw; |
351 | const int igmplen = skb->tail - skb->h.raw; | 351 | const int igmplen = skb->tail - skb->h.raw; |
352 | 352 | ||
353 | pip->tot_len = htons(iplen); | 353 | pip->tot_len = htons(iplen); |
354 | ip_send_check(pip); | 354 | ip_send_check(pip); |
355 | pig->csum = ip_compute_csum(skb->h.igmph, igmplen); | 355 | pig->csum = ip_compute_csum(igmp_hdr(skb), igmplen); |
356 | 356 | ||
357 | 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, |
358 | dst_output); | 358 | dst_output); |
@@ -379,7 +379,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
379 | pgr->grec_auxwords = 0; | 379 | pgr->grec_auxwords = 0; |
380 | pgr->grec_nsrcs = 0; | 380 | pgr->grec_nsrcs = 0; |
381 | pgr->grec_mca = pmc->multiaddr; | 381 | pgr->grec_mca = pmc->multiaddr; |
382 | pih = (struct igmpv3_report *)skb->h.igmph; | 382 | pih = igmpv3_report_hdr(skb); |
383 | pih->ngrec = htons(ntohs(pih->ngrec)+1); | 383 | pih->ngrec = htons(ntohs(pih->ngrec)+1); |
384 | *ppgr = pgr; | 384 | *ppgr = pgr; |
385 | return skb; | 385 | return skb; |
@@ -412,7 +412,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
412 | if (!*psf_list) | 412 | if (!*psf_list) |
413 | goto empty_source; | 413 | goto empty_source; |
414 | 414 | ||
415 | pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL; | 415 | pih = skb ? igmpv3_report_hdr(skb) : NULL; |
416 | 416 | ||
417 | /* EX and TO_EX get a fresh packet, if needed */ | 417 | /* EX and TO_EX get a fresh packet, if needed */ |
418 | if (truncate) { | 418 | if (truncate) { |
@@ -829,8 +829,8 @@ static void igmp_heard_report(struct in_device *in_dev, __be32 group) | |||
829 | static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | 829 | static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, |
830 | int len) | 830 | int len) |
831 | { | 831 | { |
832 | struct igmphdr *ih = skb->h.igmph; | 832 | struct igmphdr *ih = igmp_hdr(skb); |
833 | struct igmpv3_query *ih3 = (struct igmpv3_query *)ih; | 833 | struct igmpv3_query *ih3 = igmpv3_query_hdr(skb); |
834 | struct ip_mc_list *im; | 834 | struct ip_mc_list *im; |
835 | __be32 group = ih->group; | 835 | __be32 group = ih->group; |
836 | int max_delay; | 836 | int max_delay; |
@@ -863,12 +863,12 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
863 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) | 863 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) |
864 | return; | 864 | return; |
865 | 865 | ||
866 | ih3 = (struct igmpv3_query *) skb->h.raw; | 866 | ih3 = igmpv3_query_hdr(skb); |
867 | if (ih3->nsrcs) { | 867 | if (ih3->nsrcs) { |
868 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) | 868 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) |
869 | + ntohs(ih3->nsrcs)*sizeof(__be32))) | 869 | + ntohs(ih3->nsrcs)*sizeof(__be32))) |
870 | return; | 870 | return; |
871 | ih3 = (struct igmpv3_query *) skb->h.raw; | 871 | ih3 = igmpv3_query_hdr(skb); |
872 | } | 872 | } |
873 | 873 | ||
874 | max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); | 874 | max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); |
@@ -945,7 +945,7 @@ int igmp_rcv(struct sk_buff *skb) | |||
945 | goto drop; | 945 | goto drop; |
946 | } | 946 | } |
947 | 947 | ||
948 | ih = skb->h.igmph; | 948 | ih = igmp_hdr(skb); |
949 | switch (ih->type) { | 949 | switch (ih->type) { |
950 | case IGMP_HOST_MEMBERSHIP_QUERY: | 950 | case IGMP_HOST_MEMBERSHIP_QUERY: |
951 | igmp_heard_query(in_dev, skb, len); | 951 | igmp_heard_query(in_dev, skb, len); |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 03869d91f6f0..05bc27002def 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1430,7 +1430,7 @@ int pim_rcv_v1(struct sk_buff * skb) | |||
1430 | if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) | 1430 | if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) |
1431 | goto drop; | 1431 | goto drop; |
1432 | 1432 | ||
1433 | pim = (struct igmphdr*)skb->h.raw; | 1433 | pim = igmp_hdr(skb); |
1434 | 1434 | ||
1435 | if (!mroute_do_pim || | 1435 | if (!mroute_do_pim || |
1436 | skb->len < sizeof(*pim) + sizeof(*encap) || | 1436 | skb->len < sizeof(*pim) + sizeof(*encap) || |