diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-13 12:51:52 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:17 -0400 |
commit | 967b05f64e27d04a4c8879addd0e1c52137e2c9e (patch) | |
tree | c2c7ab3f0284903222d6d0864deaedbd4766b9b8 /net/ipv4 | |
parent | ea2ae17d6443abddc79480dc9f7af8feacabddc4 (diff) |
[SK_BUFF]: Introduce skb_set_transport_header
For the cases where the transport header is being set to a offset from
skb->data.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/esp4.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 19 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 957674562801..82543eebfa52 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -261,7 +261,8 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) | |||
261 | 261 | ||
262 | iph->protocol = nexthdr[1]; | 262 | iph->protocol = nexthdr[1]; |
263 | pskb_trim(skb, skb->len - alen - padlen - 2); | 263 | pskb_trim(skb, skb->len - alen - padlen - 2); |
264 | skb->h.raw = __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen) - ihl; | 264 | __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen); |
265 | skb_set_transport_header(skb, -ihl); | ||
265 | 266 | ||
266 | return 0; | 267 | return 0; |
267 | 268 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 63c05be0764d..6d92358fc513 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -593,7 +593,7 @@ slow_path: | |||
593 | skb_reserve(skb2, ll_rs); | 593 | skb_reserve(skb2, ll_rs); |
594 | skb_put(skb2, len + hlen); | 594 | skb_put(skb2, len + hlen); |
595 | skb_reset_network_header(skb2); | 595 | skb_reset_network_header(skb2); |
596 | skb2->h.raw = skb2->data + hlen; | 596 | skb2->h.raw = skb2->nh.raw + hlen; |
597 | 597 | ||
598 | /* | 598 | /* |
599 | * Charge the memory for the fragment to any owner | 599 | * Charge the memory for the fragment to any owner |
@@ -724,7 +724,7 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
724 | skb_reset_network_header(skb); | 724 | skb_reset_network_header(skb); |
725 | 725 | ||
726 | /* initialize protocol header pointer */ | 726 | /* initialize protocol header pointer */ |
727 | skb->h.raw = skb->data + fragheaderlen; | 727 | skb->h.raw = skb->nh.raw + fragheaderlen; |
728 | 728 | ||
729 | skb->ip_summed = CHECKSUM_PARTIAL; | 729 | skb->ip_summed = CHECKSUM_PARTIAL; |
730 | skb->csum = 0; | 730 | skb->csum = 0; |
@@ -1099,8 +1099,6 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1099 | } | 1099 | } |
1100 | if (len <= 0) { | 1100 | if (len <= 0) { |
1101 | struct sk_buff *skb_prev; | 1101 | struct sk_buff *skb_prev; |
1102 | char *data; | ||
1103 | struct iphdr *iph; | ||
1104 | int alloclen; | 1102 | int alloclen; |
1105 | 1103 | ||
1106 | skb_prev = skb; | 1104 | skb_prev = skb; |
@@ -1123,16 +1121,15 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1123 | /* | 1121 | /* |
1124 | * Find where to start putting bytes. | 1122 | * Find where to start putting bytes. |
1125 | */ | 1123 | */ |
1126 | data = skb_put(skb, fragheaderlen + fraggap); | 1124 | skb_put(skb, fragheaderlen + fraggap); |
1127 | skb_reset_network_header(skb); | 1125 | skb_reset_network_header(skb); |
1128 | iph = ip_hdr(skb); | 1126 | skb->h.raw = skb->nh.raw + fragheaderlen; |
1129 | data += fragheaderlen; | ||
1130 | skb->h.raw = data; | ||
1131 | 1127 | ||
1132 | if (fraggap) { | 1128 | if (fraggap) { |
1133 | skb->csum = skb_copy_and_csum_bits( | 1129 | skb->csum = skb_copy_and_csum_bits(skb_prev, |
1134 | skb_prev, maxfraglen, | 1130 | maxfraglen, |
1135 | data, fraggap, 0); | 1131 | skb->h.raw, |
1132 | fraggap, 0); | ||
1136 | skb_prev->csum = csum_sub(skb_prev->csum, | 1133 | skb_prev->csum = csum_sub(skb_prev->csum, |
1137 | skb->csum); | 1134 | skb->csum); |
1138 | pskb_trim_unique(skb_prev, maxfraglen); | 1135 | pskb_trim_unique(skb_prev, maxfraglen); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 5da823a32250..2776a8b01339 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3636,7 +3636,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3636 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); | 3636 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); |
3637 | skb_set_network_header(nskb, | 3637 | skb_set_network_header(nskb, |
3638 | skb_network_header(skb) - skb->head); | 3638 | skb_network_header(skb) - skb->head); |
3639 | nskb->h.raw = nskb->data + (skb->h.raw - skb->head); | 3639 | skb_set_transport_header(nskb, skb->h.raw - skb->head); |
3640 | 3640 | ||
3641 | skb_reserve(nskb, header); | 3641 | skb_reserve(nskb, header); |
3642 | memcpy(nskb->head, skb->head, header); | 3642 | memcpy(nskb->head, skb->head, header); |