diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 3b4e8dcf4c86f7992ab69ee64909f79ce30e813b..31a20f17c854c46f67c3e585e63115ec52816545 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) if (!skb) return; - iph = (struct ipv6hdr*)skb_put(skb, sizeof(struct ipv6hdr)); - skb->nh.ipv6h = iph; + skb_put(skb, sizeof(struct ipv6hdr)); + skb_reset_network_header(skb); + iph = skb->nh.ipv6h; ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); serr = SKB_EXT_ERR(skb); diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index 6abee94c929fc70b020702ad70659b4566900969..4441bed430f87bd2c39503dd64e786e9b8f656ed 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) skb_reserve(nskb, hh_len + dst->header_len); - ip6h = nskb->nh.ipv6h = (struct ipv6hdr *) - skb_put(nskb, sizeof(struct ipv6hdr)); + skb_put(nskb, sizeof(struct ipv6hdr)); + skb_reset_network_header(nskb); + ip6h = nskb->nh.ipv6h; ip6h->version = 6; ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT); ip6h->nexthdr = IPPROTO_TCP; diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 203e069e7fe98f88240650e8f0dde892e29fa156..5f26645195dc88ae046130da4e95b78d7d249bec 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, skb->priority = sk->sk_priority; skb->dst = dst_clone(&rt->u.dst); - skb->nh.ipv6h = iph = (struct ipv6hdr *)skb_put(skb, length); + skb_put(skb, length); + skb_reset_network_header(skb); + iph = skb->nh.ipv6h; skb->ip_summed = CHECKSUM_NONE; diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 0b9c49b3a10000a07b391e164715cae8e322565f..5f9b145b0b90ca21c0d9dafca93697e5aacfbc0b 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, int type, int code, int offset, __be32 info) { struct inet6_dev *idev; - struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); struct sock *sk; struct sctp_association *asoc; @@ -136,7 +135,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, /* Fix up skb to look at the embedded net header. */ saveip = skb->nh.raw; savesctp = skb->h.raw; - skb->nh.ipv6h = iph; + skb_reset_network_header(skb); skb->h.raw = (char *)sh; sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport); /* Put back, the original pointers. */