aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-10 17:57:15 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:54 -0400
commit1ced98e81d1c2f1ce965ecf8d0032e02ffa07bf0 (patch)
tree135955ffd557808f97aeb126efde39f8eeaeefbf
parent8856dfa3e9b71ac2177016f66ace3a8978afecc1 (diff)
[SK_BUFF] ipv6: More skb_reset_network_header conversions related to skb_pull
Now related to this form: skb->nh.ipv6h = (struct ipv6hdr *)skb_put(skb, length); That, as the others, is done when skb->tail is still equal to skb->data, making the conversion to skb_reset_network_header possible. Also one more case equivalent to skb->nh.raw = skb->data, of this form: iph = (struct ipv6hdr *)skb->data; <SNIP> skb->nh.ipv6h = iph; Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/datagram.c5
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c5
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/sctp/ipv6.c3
4 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 3b4e8dcf4c86..31a20f17c854 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -251,8 +251,9 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
251 if (!skb) 251 if (!skb)
252 return; 252 return;
253 253
254 iph = (struct ipv6hdr*)skb_put(skb, sizeof(struct ipv6hdr)); 254 skb_put(skb, sizeof(struct ipv6hdr));
255 skb->nh.ipv6h = iph; 255 skb_reset_network_header(skb);
256 iph = skb->nh.ipv6h;
256 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); 257 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
257 258
258 serr = SKB_EXT_ERR(skb); 259 serr = SKB_EXT_ERR(skb);
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 6abee94c929f..4441bed430f8 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -120,8 +120,9 @@ static void send_reset(struct sk_buff *oldskb)
120 120
121 skb_reserve(nskb, hh_len + dst->header_len); 121 skb_reserve(nskb, hh_len + dst->header_len);
122 122
123 ip6h = nskb->nh.ipv6h = (struct ipv6hdr *) 123 skb_put(nskb, sizeof(struct ipv6hdr));
124 skb_put(nskb, sizeof(struct ipv6hdr)); 124 skb_reset_network_header(nskb);
125 ip6h = nskb->nh.ipv6h;
125 ip6h->version = 6; 126 ip6h->version = 6;
126 ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT); 127 ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT);
127 ip6h->nexthdr = IPPROTO_TCP; 128 ip6h->nexthdr = IPPROTO_TCP;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 203e069e7fe9..5f26645195dc 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -575,7 +575,9 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
575 skb->priority = sk->sk_priority; 575 skb->priority = sk->sk_priority;
576 skb->dst = dst_clone(&rt->u.dst); 576 skb->dst = dst_clone(&rt->u.dst);
577 577
578 skb->nh.ipv6h = iph = (struct ipv6hdr *)skb_put(skb, length); 578 skb_put(skb, length);
579 skb_reset_network_header(skb);
580 iph = skb->nh.ipv6h;
579 581
580 skb->ip_summed = CHECKSUM_NONE; 582 skb->ip_summed = CHECKSUM_NONE;
581 583
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 0b9c49b3a100..5f9b145b0b90 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -122,7 +122,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
122 int type, int code, int offset, __be32 info) 122 int type, int code, int offset, __be32 info)
123{ 123{
124 struct inet6_dev *idev; 124 struct inet6_dev *idev;
125 struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
126 struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); 125 struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
127 struct sock *sk; 126 struct sock *sk;
128 struct sctp_association *asoc; 127 struct sctp_association *asoc;
@@ -136,7 +135,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
136 /* Fix up skb to look at the embedded net header. */ 135 /* Fix up skb to look at the embedded net header. */
137 saveip = skb->nh.raw; 136 saveip = skb->nh.raw;
138 savesctp = skb->h.raw; 137 savesctp = skb->h.raw;
139 skb->nh.ipv6h = iph; 138 skb_reset_network_header(skb);
140 skb->h.raw = (char *)sh; 139 skb->h.raw = (char *)sh;
141 sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport); 140 sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport);
142 /* Put back, the original pointers. */ 141 /* Put back, the original pointers. */