diff options
-rw-r--r-- | net/core/pktgen.c | 30 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 3 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_beet.c | 3 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_ro.c | 3 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_transport.c | 3 |
6 files changed, 27 insertions, 17 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 160d4f01c46e..ae8cf9a285fd 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2357,8 +2357,12 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2357 | *vlan_encapsulated_proto = htons(ETH_P_IP); | 2357 | *vlan_encapsulated_proto = htons(ETH_P_IP); |
2358 | } | 2358 | } |
2359 | 2359 | ||
2360 | iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)); | 2360 | skb_set_network_header(skb, skb->tail - skb->data); |
2361 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2361 | skb->h.raw = skb->nh.raw + sizeof(struct iphdr); |
2362 | skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); | ||
2363 | |||
2364 | iph = ip_hdr(skb); | ||
2365 | udph = udp_hdr(skb); | ||
2362 | 2366 | ||
2363 | memcpy(eth, pkt_dev->hh, 12); | 2367 | memcpy(eth, pkt_dev->hh, 12); |
2364 | *(__be16 *) & eth[12] = protocol; | 2368 | *(__be16 *) & eth[12] = protocol; |
@@ -2387,12 +2391,11 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2387 | iph->check = 0; | 2391 | iph->check = 0; |
2388 | iph->check = ip_fast_csum((void *)iph, iph->ihl); | 2392 | iph->check = ip_fast_csum((void *)iph, iph->ihl); |
2389 | skb->protocol = protocol; | 2393 | skb->protocol = protocol; |
2390 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) - | 2394 | skb->mac.raw = (skb->nh.raw - ETH_HLEN - |
2391 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); | 2395 | pkt_dev->nr_labels * sizeof(u32) - |
2396 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev)); | ||
2392 | skb->dev = odev; | 2397 | skb->dev = odev; |
2393 | skb->pkt_type = PACKET_HOST; | 2398 | skb->pkt_type = PACKET_HOST; |
2394 | skb->nh.raw = (unsigned char *)iph; | ||
2395 | skb->h.raw = (unsigned char *)udph; | ||
2396 | 2399 | ||
2397 | if (pkt_dev->nfrags <= 0) | 2400 | if (pkt_dev->nfrags <= 0) |
2398 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2401 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
@@ -2693,8 +2696,12 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2693 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); | 2696 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); |
2694 | } | 2697 | } |
2695 | 2698 | ||
2696 | iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr)); | 2699 | skb_set_network_header(skb, skb->tail - skb->data); |
2697 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2700 | skb->h.raw = skb->nh.raw + sizeof(struct ipv6hdr); |
2701 | skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); | ||
2702 | |||
2703 | iph = ipv6_hdr(skb); | ||
2704 | udph = udp_hdr(skb); | ||
2698 | 2705 | ||
2699 | memcpy(eth, pkt_dev->hh, 12); | 2706 | memcpy(eth, pkt_dev->hh, 12); |
2700 | *(__be16 *) & eth[12] = protocol; | 2707 | *(__be16 *) & eth[12] = protocol; |
@@ -2731,13 +2738,12 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2731 | ipv6_addr_copy(&iph->daddr, &pkt_dev->cur_in6_daddr); | 2738 | ipv6_addr_copy(&iph->daddr, &pkt_dev->cur_in6_daddr); |
2732 | ipv6_addr_copy(&iph->saddr, &pkt_dev->cur_in6_saddr); | 2739 | ipv6_addr_copy(&iph->saddr, &pkt_dev->cur_in6_saddr); |
2733 | 2740 | ||
2734 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) - | 2741 | skb->mac.raw = (skb->nh.raw - ETH_HLEN - |
2735 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); | 2742 | pkt_dev->nr_labels * sizeof(u32) - |
2743 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev)); | ||
2736 | skb->protocol = protocol; | 2744 | skb->protocol = protocol; |
2737 | skb->dev = odev; | 2745 | skb->dev = odev; |
2738 | skb->pkt_type = PACKET_HOST; | 2746 | skb->pkt_type = PACKET_HOST; |
2739 | skb->nh.raw = (unsigned char *)iph; | ||
2740 | skb->h.raw = (unsigned char *)udph; | ||
2741 | 2747 | ||
2742 | if (pkt_dev->nfrags <= 0) | 2748 | if (pkt_dev->nfrags <= 0) |
2743 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2749 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 408cc99af6b3..87e000633f41 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1905,7 +1905,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) | |||
1905 | 1905 | ||
1906 | skb_reserve(nskb, headroom); | 1906 | skb_reserve(nskb, headroom); |
1907 | skb_reset_mac_header(nskb); | 1907 | skb_reset_mac_header(nskb); |
1908 | nskb->nh.raw = nskb->data + skb->mac_len; | 1908 | skb_set_network_header(nskb, skb->mac_len); |
1909 | nskb->h.raw = nskb->nh.raw + (skb->h.raw - skb->nh.raw); | 1909 | nskb->h.raw = nskb->nh.raw + (skb->h.raw - skb->nh.raw); |
1910 | memcpy(skb_put(nskb, doffset), skb->data, doffset); | 1910 | memcpy(skb_put(nskb, doffset), skb->data, doffset); |
1911 | 1911 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 8f45c95db451..357894259f8f 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -580,7 +580,8 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) | |||
580 | * Copy the IP header | 580 | * Copy the IP header |
581 | */ | 581 | */ |
582 | 582 | ||
583 | skb->nh.raw = skb_put(skb, ihl); | 583 | skb_set_network_header(skb, skb->tail - skb->data); |
584 | skb_put(skb, ihl); | ||
584 | memcpy(skb->data,pkt->data,ihl); | 585 | memcpy(skb->data,pkt->data,ihl); |
585 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ | 586 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ |
586 | msg = (struct igmpmsg *)skb_network_header(skb); | 587 | msg = (struct igmpmsg *)skb_network_header(skb); |
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index 0cc96ece003d..8a01b0da2ddd 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -41,7 +41,8 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
41 | iph = ipv6_hdr(skb); | 41 | iph = ipv6_hdr(skb); |
42 | 42 | ||
43 | hdr_len = ip6_find_1stfragopt(skb, &prevhdr); | 43 | hdr_len = ip6_find_1stfragopt(skb, &prevhdr); |
44 | skb->nh.raw = prevhdr - x->props.header_len; | 44 | skb_set_network_header(skb, |
45 | (prevhdr - x->props.header_len) - skb->data); | ||
45 | skb_set_transport_header(skb, hdr_len); | 46 | skb_set_transport_header(skb, hdr_len); |
46 | memmove(skb->data, iph, hdr_len); | 47 | memmove(skb->data, iph, hdr_len); |
47 | 48 | ||
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c index da48ecf3fe96..6ad6d7ac6bd7 100644 --- a/net/ipv6/xfrm6_mode_ro.c +++ b/net/ipv6/xfrm6_mode_ro.c | |||
@@ -53,7 +53,8 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) | |||
53 | iph = ipv6_hdr(skb); | 53 | iph = ipv6_hdr(skb); |
54 | 54 | ||
55 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); | 55 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); |
56 | skb->nh.raw = prevhdr - x->props.header_len; | 56 | skb_set_network_header(skb, |
57 | (prevhdr - x->props.header_len) - skb->data); | ||
57 | skb_set_transport_header(skb, hdr_len); | 58 | skb_set_transport_header(skb, hdr_len); |
58 | memmove(skb->data, iph, hdr_len); | 59 | memmove(skb->data, iph, hdr_len); |
59 | return 0; | 60 | return 0; |
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c index d526f4e9c65e..eb1864b5aae7 100644 --- a/net/ipv6/xfrm6_mode_transport.c +++ b/net/ipv6/xfrm6_mode_transport.c | |||
@@ -35,7 +35,8 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) | |||
35 | iph = ipv6_hdr(skb); | 35 | iph = ipv6_hdr(skb); |
36 | 36 | ||
37 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); | 37 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); |
38 | skb->nh.raw = prevhdr - x->props.header_len; | 38 | skb_set_network_header(skb, |
39 | (prevhdr - x->props.header_len) - skb->data); | ||
39 | skb_set_transport_header(skb, hdr_len); | 40 | skb_set_transport_header(skb, hdr_len); |
40 | memmove(skb->data, iph, hdr_len); | 41 | memmove(skb->data, iph, hdr_len); |
41 | return 0; | 42 | return 0; |