aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipvs
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-21 01:47:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:10 -0400
commiteddc9ec53be2ecdbf4efe0efd4a83052594f0ac0 (patch)
tree4a38ab4dbd9d61fdf5a5ea6ed61463e0b9e33ba7 /net/ipv4/ipvs
parente023dd643798c4f06c16466af90b4d250e4b8bd7 (diff)
[SK_BUFF]: Introduce ip_hdr(), remove skb->nh.iph
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipvs')
-rw-r--r--net/ipv4/ipvs/ip_vs_app.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c38
-rw-r--r--net/ipv4/ipvs/ip_vs_dh.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_ftp.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c12
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_udp.c14
-rw-r--r--net/ipv4/ipvs/ip_vs_sh.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c24
10 files changed, 51 insertions, 53 deletions
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
index e5beab28cd..c8a822c0aa 100644
--- a/net/ipv4/ipvs/ip_vs_app.c
+++ b/net/ipv4/ipvs/ip_vs_app.c
@@ -577,7 +577,6 @@ static const struct file_operations ip_vs_app_fops = {
577int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, 577int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
578 char *o_buf, int o_len, char *n_buf, int n_len) 578 char *o_buf, int o_len, char *n_buf, int n_len)
579{ 579{
580 struct iphdr *iph;
581 int diff; 580 int diff;
582 int o_offset; 581 int o_offset;
583 int o_left; 582 int o_left;
@@ -607,8 +606,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
607 } 606 }
608 607
609 /* must update the iph total length here */ 608 /* must update the iph total length here */
610 iph = skb->nh.iph; 609 ip_hdr(skb)->tot_len = htons(skb->len);
611 iph->tot_len = htons(skb->len);
612 610
613 LeaveFunction(9); 611 LeaveFunction(9);
614 return 0; 612 return 0;
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index 7893c00a91..62cfbed317 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -212,7 +212,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
212 __be16 ports[2]) 212 __be16 ports[2])
213{ 213{
214 struct ip_vs_conn *cp = NULL; 214 struct ip_vs_conn *cp = NULL;
215 struct iphdr *iph = skb->nh.iph; 215 struct iphdr *iph = ip_hdr(skb);
216 struct ip_vs_dest *dest; 216 struct ip_vs_dest *dest;
217 struct ip_vs_conn *ct; 217 struct ip_vs_conn *ct;
218 __be16 dport; /* destination port to forward */ 218 __be16 dport; /* destination port to forward */
@@ -381,7 +381,7 @@ struct ip_vs_conn *
381ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) 381ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
382{ 382{
383 struct ip_vs_conn *cp = NULL; 383 struct ip_vs_conn *cp = NULL;
384 struct iphdr *iph = skb->nh.iph; 384 struct iphdr *iph = ip_hdr(skb);
385 struct ip_vs_dest *dest; 385 struct ip_vs_dest *dest;
386 __be16 _ports[2], *pptr; 386 __be16 _ports[2], *pptr;
387 387
@@ -447,7 +447,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
447 struct ip_vs_protocol *pp) 447 struct ip_vs_protocol *pp)
448{ 448{
449 __be16 _ports[2], *pptr; 449 __be16 _ports[2], *pptr;
450 struct iphdr *iph = skb->nh.iph; 450 struct iphdr *iph = ip_hdr(skb);
451 451
452 pptr = skb_header_pointer(skb, iph->ihl*4, 452 pptr = skb_header_pointer(skb, iph->ihl*4,
453 sizeof(_ports), _ports); 453 sizeof(_ports), _ports);
@@ -546,7 +546,7 @@ ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
546{ 546{
547 skb = ip_defrag(skb, user); 547 skb = ip_defrag(skb, user);
548 if (skb) 548 if (skb)
549 ip_send_check(skb->nh.iph); 549 ip_send_check(ip_hdr(skb));
550 return skb; 550 return skb;
551} 551}
552 552
@@ -557,7 +557,7 @@ ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
557void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 557void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
558 struct ip_vs_conn *cp, int inout) 558 struct ip_vs_conn *cp, int inout)
559{ 559{
560 struct iphdr *iph = skb->nh.iph; 560 struct iphdr *iph = ip_hdr(skb);
561 unsigned int icmp_offset = iph->ihl*4; 561 unsigned int icmp_offset = iph->ihl*4;
562 struct icmphdr *icmph = (struct icmphdr *)(skb_network_header(skb) + 562 struct icmphdr *icmph = (struct icmphdr *)(skb_network_header(skb) +
563 icmp_offset); 563 icmp_offset);
@@ -618,14 +618,14 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related)
618 *related = 1; 618 *related = 1;
619 619
620 /* reassemble IP fragments */ 620 /* reassemble IP fragments */
621 if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { 621 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
622 skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); 622 skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
623 if (!skb) 623 if (!skb)
624 return NF_STOLEN; 624 return NF_STOLEN;
625 *pskb = skb; 625 *pskb = skb;
626 } 626 }
627 627
628 iph = skb->nh.iph; 628 iph = ip_hdr(skb);
629 offset = ihl = iph->ihl * 4; 629 offset = ihl = iph->ihl * 4;
630 ic = skb_header_pointer(skb, offset, sizeof(_icmph), &_icmph); 630 ic = skb_header_pointer(skb, offset, sizeof(_icmph), &_icmph);
631 if (ic == NULL) 631 if (ic == NULL)
@@ -740,14 +740,14 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
740 if (skb->ipvs_property) 740 if (skb->ipvs_property)
741 return NF_ACCEPT; 741 return NF_ACCEPT;
742 742
743 iph = skb->nh.iph; 743 iph = ip_hdr(skb);
744 if (unlikely(iph->protocol == IPPROTO_ICMP)) { 744 if (unlikely(iph->protocol == IPPROTO_ICMP)) {
745 int related, verdict = ip_vs_out_icmp(pskb, &related); 745 int related, verdict = ip_vs_out_icmp(pskb, &related);
746 746
747 if (related) 747 if (related)
748 return verdict; 748 return verdict;
749 skb = *pskb; 749 skb = *pskb;
750 iph = skb->nh.iph; 750 iph = ip_hdr(skb);
751 } 751 }
752 752
753 pp = ip_vs_proto_get(iph->protocol); 753 pp = ip_vs_proto_get(iph->protocol);
@@ -760,7 +760,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
760 skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); 760 skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
761 if (!skb) 761 if (!skb)
762 return NF_STOLEN; 762 return NF_STOLEN;
763 iph = skb->nh.iph; 763 iph = ip_hdr(skb);
764 *pskb = skb; 764 *pskb = skb;
765 } 765 }
766 766
@@ -810,8 +810,8 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
810 if (pp->snat_handler && !pp->snat_handler(pskb, pp, cp)) 810 if (pp->snat_handler && !pp->snat_handler(pskb, pp, cp))
811 goto drop; 811 goto drop;
812 skb = *pskb; 812 skb = *pskb;
813 skb->nh.iph->saddr = cp->vaddr; 813 ip_hdr(skb)->saddr = cp->vaddr;
814 ip_send_check(skb->nh.iph); 814 ip_send_check(ip_hdr(skb));
815 815
816 /* For policy routing, packets originating from this 816 /* For policy routing, packets originating from this
817 * machine itself may be routed differently to packets 817 * machine itself may be routed differently to packets
@@ -861,7 +861,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
861 *related = 1; 861 *related = 1;
862 862
863 /* reassemble IP fragments */ 863 /* reassemble IP fragments */
864 if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { 864 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
865 skb = ip_vs_gather_frags(skb, 865 skb = ip_vs_gather_frags(skb,
866 hooknum == NF_IP_LOCAL_IN ? 866 hooknum == NF_IP_LOCAL_IN ?
867 IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD); 867 IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD);
@@ -870,7 +870,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
870 *pskb = skb; 870 *pskb = skb;
871 } 871 }
872 872
873 iph = skb->nh.iph; 873 iph = ip_hdr(skb);
874 offset = ihl = iph->ihl * 4; 874 offset = ihl = iph->ihl * 4;
875 ic = skb_header_pointer(skb, offset, sizeof(_icmph), &_icmph); 875 ic = skb_header_pointer(skb, offset, sizeof(_icmph), &_icmph);
876 if (ic == NULL) 876 if (ic == NULL)
@@ -966,19 +966,19 @@ ip_vs_in(unsigned int hooknum, struct sk_buff **pskb,
966 || skb->dev == &loopback_dev || skb->sk)) { 966 || skb->dev == &loopback_dev || skb->sk)) {
967 IP_VS_DBG(12, "packet type=%d proto=%d daddr=%d.%d.%d.%d ignored\n", 967 IP_VS_DBG(12, "packet type=%d proto=%d daddr=%d.%d.%d.%d ignored\n",
968 skb->pkt_type, 968 skb->pkt_type,
969 skb->nh.iph->protocol, 969 ip_hdr(skb)->protocol,
970 NIPQUAD(skb->nh.iph->daddr)); 970 NIPQUAD(ip_hdr(skb)->daddr));
971 return NF_ACCEPT; 971 return NF_ACCEPT;
972 } 972 }
973 973
974 iph = skb->nh.iph; 974 iph = ip_hdr(skb);
975 if (unlikely(iph->protocol == IPPROTO_ICMP)) { 975 if (unlikely(iph->protocol == IPPROTO_ICMP)) {
976 int related, verdict = ip_vs_in_icmp(pskb, &related, hooknum); 976 int related, verdict = ip_vs_in_icmp(pskb, &related, hooknum);
977