aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_options.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:50:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:59 -0400
commitd56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch)
tree3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /net/ipv4/ip_options.c
parentbbe735e4247dba32568a305553b010081c8dea99 (diff)
[SK_BUFF]: Introduce skb_network_header()
For the places where we need a pointer to the network header, it is still legal to touch skb->nh.raw directly if just adding to, subtracting from or setting it to another layer header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_options.c')
-rw-r--r--net/ipv4/ip_options.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index f906a80d5a87..f7e9db612565 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -40,7 +40,7 @@
40void ip_options_build(struct sk_buff * skb, struct ip_options * opt, 40void ip_options_build(struct sk_buff * skb, struct ip_options * opt,
41 __be32 daddr, struct rtable *rt, int is_frag) 41 __be32 daddr, struct rtable *rt, int is_frag)
42{ 42{
43 unsigned char * iph = skb->nh.raw; 43 unsigned char *iph = skb_network_header(skb);
44 44
45 memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options)); 45 memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options));
46 memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen); 46 memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen);
@@ -104,7 +104,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
104 return 0; 104 return 0;
105 } 105 }
106 106
107 sptr = skb->nh.raw; 107 sptr = skb_network_header(skb);
108 dptr = dopt->__data; 108 dptr = dopt->__data;
109 109
110 if (skb->dst) 110 if (skb->dst)
@@ -217,7 +217,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
217 217
218void ip_options_fragment(struct sk_buff * skb) 218void ip_options_fragment(struct sk_buff * skb)
219{ 219{
220 unsigned char * optptr = skb->nh.raw + sizeof(struct iphdr); 220 unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr);
221 struct ip_options * opt = &(IPCB(skb)->opt); 221 struct ip_options * opt = &(IPCB(skb)->opt);
222 int l = opt->optlen; 222 int l = opt->optlen;
223 int optlen; 223 int optlen;
@@ -264,7 +264,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
264 264
265 if (!opt) { 265 if (!opt) {
266 opt = &(IPCB(skb)->opt); 266 opt = &(IPCB(skb)->opt);
267 iph = skb->nh.raw; 267 iph = skb_network_header(skb);
268 opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr); 268 opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr);
269 optptr = iph + sizeof(struct iphdr); 269 optptr = iph + sizeof(struct iphdr);
270 opt->is_data = 0; 270 opt->is_data = 0;
@@ -563,7 +563,7 @@ void ip_forward_options(struct sk_buff *skb)
563 struct ip_options * opt = &(IPCB(skb)->opt); 563 struct ip_options * opt = &(IPCB(skb)->opt);
564 unsigned char * optptr; 564 unsigned char * optptr;
565 struct rtable *rt = (struct rtable*)skb->dst; 565 struct rtable *rt = (struct rtable*)skb->dst;
566 unsigned char *raw = skb->nh.raw; 566 unsigned char *raw = skb_network_header(skb);
567 567
568 if (opt->rr_needaddr) { 568 if (opt->rr_needaddr) {
569 optptr = (unsigned char *)raw + opt->rr; 569 optptr = (unsigned char *)raw + opt->rr;
@@ -609,7 +609,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
609 int srrspace, srrptr; 609 int srrspace, srrptr;
610 __be32 nexthop; 610 __be32 nexthop;
611 struct iphdr *iph = skb->nh.iph; 611 struct iphdr *iph = skb->nh.iph;
612 unsigned char * optptr = skb->nh.raw + opt->srr; 612 unsigned char *optptr = skb_network_header(skb) + opt->srr;
613 struct rtable *rt = (struct rtable*)skb->dst; 613 struct rtable *rt = (struct rtable*)skb->dst;
614 struct rtable *rt2; 614 struct rtable *rt2;
615 int err; 615 int err;