[SK_BUFF]: Use skb_reset_network_header after skb_push
Some more cases where skb->nh.iph was being set that were converted to using skb_reset_network_header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
04b964dbad
commit
8856dfa3e9
|
@ -125,11 +125,9 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
|
||||||
struct iphdr *iph;
|
struct iphdr *iph;
|
||||||
|
|
||||||
/* Build the IP header. */
|
/* Build the IP header. */
|
||||||
if (opt)
|
skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
|
||||||
iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr) + opt->optlen);
|
skb_reset_network_header(skb);
|
||||||
else
|
iph = skb->nh.iph;
|
||||||
iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr));
|
|
||||||
|
|
||||||
iph->version = 4;
|
iph->version = 4;
|
||||||
iph->ihl = 5;
|
iph->ihl = 5;
|
||||||
iph->tos = inet->tos;
|
iph->tos = inet->tos;
|
||||||
|
@ -143,7 +141,6 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
|
||||||
iph->protocol = sk->sk_protocol;
|
iph->protocol = sk->sk_protocol;
|
||||||
iph->tot_len = htons(skb->len);
|
iph->tot_len = htons(skb->len);
|
||||||
ip_select_ident(iph, &rt->u.dst, sk);
|
ip_select_ident(iph, &rt->u.dst, sk);
|
||||||
skb->nh.iph = iph;
|
|
||||||
|
|
||||||
if (opt && opt->optlen) {
|
if (opt && opt->optlen) {
|
||||||
iph->ihl += opt->optlen>>2;
|
iph->ihl += opt->optlen>>2;
|
||||||
|
@ -333,7 +330,9 @@ packet_routed:
|
||||||
goto no_route;
|
goto no_route;
|
||||||
|
|
||||||
/* OK, we know where to send it, allocate and build IP header. */
|
/* OK, we know where to send it, allocate and build IP header. */
|
||||||
iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
|
skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
|
||||||
|
skb_reset_network_header(skb);
|
||||||
|
iph = skb->nh.iph;
|
||||||
*((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
|
*((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
|
||||||
iph->tot_len = htons(skb->len);
|
iph->tot_len = htons(skb->len);
|
||||||
if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok)
|
if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok)
|
||||||
|
@ -344,7 +343,6 @@ packet_routed:
|
||||||
iph->protocol = sk->sk_protocol;
|
iph->protocol = sk->sk_protocol;
|
||||||
iph->saddr = rt->rt_src;
|
iph->saddr = rt->rt_src;
|
||||||
iph->daddr = rt->rt_dst;
|
iph->daddr = rt->rt_dst;
|
||||||
skb->nh.iph = iph;
|
|
||||||
/* Transport layer set skb->h.foo itself. */
|
/* Transport layer set skb->h.foo itself. */
|
||||||
|
|
||||||
if (opt && opt->optlen) {
|
if (opt && opt->optlen) {
|
||||||
|
|
|
@ -1093,7 +1093,12 @@ static struct notifier_block ip_mr_notifier={
|
||||||
|
|
||||||
static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
|
static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
|
||||||
{
|
{
|
||||||
struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
|
struct iphdr *iph;
|
||||||
|
|
||||||
|
skb_push(skb, sizeof(struct iphdr));
|
||||||
|
skb->h.ipiph = skb->nh.iph;
|
||||||
|
skb_reset_network_header(skb);
|
||||||
|
iph = skb->nh.iph;
|
||||||
|
|
||||||
iph->version = 4;
|
iph->version = 4;
|
||||||
iph->tos = skb->nh.iph->tos;
|
iph->tos = skb->nh.iph->tos;
|
||||||
|
@ -1107,8 +1112,6 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
|
||||||
ip_select_ident(iph, skb->dst, NULL);
|
ip_select_ident(iph, skb->dst, NULL);
|
||||||
ip_send_check(iph);
|
ip_send_check(iph);
|
||||||
|
|
||||||
skb->h.ipiph = skb->nh.iph;
|
|
||||||
skb->nh.iph = iph;
|
|
||||||
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
||||||
nf_reset(skb);
|
nf_reset(skb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue