diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-11 00:04:22 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:26 -0400 |
commit | aa8223c7bb0b05183e1737881ed21827aa5b9e73 (patch) | |
tree | 05c9832326edfeb878472f15cf8133ed9f014cdf | |
parent | ab6a5bb6b28a970104a34f0f6959b73cf61bdc72 (diff) |
[SK_BUFF]: Introduce tcp_hdr(), remove skb->h.th
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/atl1/atl1_main.c | 7 | ||||
-rw-r--r-- | drivers/net/bnx2.c | 8 | ||||
-rw-r--r-- | drivers/net/chelsio/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 11 | ||||
-rw-r--r-- | drivers/net/ioc3-eth.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 7 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 2 | ||||
-rw-r--r-- | drivers/net/tg3.c | 15 | ||||
-rw-r--r-- | drivers/s390/net/qeth_eddp.c | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_tso.h | 4 | ||||
-rw-r--r-- | include/linux/skbuff.h | 1 | ||||
-rw-r--r-- | include/linux/tcp.h | 9 | ||||
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | include/net/tcp_ecn.h | 6 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 4 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 36 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 22 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 28 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 32 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 13 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 32 |
23 files changed, 134 insertions, 122 deletions
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 8d5994751e2e..d60c2217332c 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1298,9 +1298,10 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1298 | 1298 | ||
1299 | iph->tot_len = 0; | 1299 | iph->tot_len = 0; |
1300 | iph->check = 0; | 1300 | iph->check = 0; |
1301 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, | 1301 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1302 | iph->daddr, 0, | 1302 | iph->daddr, 0, |
1303 | IPPROTO_TCP, 0); | 1303 | IPPROTO_TCP, |
1304 | 0); | ||
1304 | ipofst = skb_network_offset(skb); | 1305 | ipofst = skb_network_offset(skb); |
1305 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1306 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ |
1306 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1307 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 73512fb16452..7e7b5f344030 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -4524,7 +4524,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4524 | vlan_tag_flags |= TX_BD_FLAGS_SW_LSO; | 4524 | vlan_tag_flags |= TX_BD_FLAGS_SW_LSO; |
4525 | 4525 | ||
4526 | tcp_opt_len = 0; | 4526 | tcp_opt_len = 0; |
4527 | if (skb->h.th->doff > 5) | 4527 | if (tcp_hdr(skb)->doff > 5) |
4528 | tcp_opt_len = tcp_optlen(skb); | 4528 | tcp_opt_len = tcp_optlen(skb); |
4529 | 4529 | ||
4530 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); | 4530 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); |
@@ -4532,9 +4532,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4532 | iph = ip_hdr(skb); | 4532 | iph = ip_hdr(skb); |
4533 | iph->check = 0; | 4533 | iph->check = 0; |
4534 | iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); | 4534 | iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); |
4535 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | 4535 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
4536 | 0, IPPROTO_TCP, 0); | 4536 | iph->daddr, 0, |
4537 | 4537 | IPPROTO_TCP, 0); | |
4538 | if (tcp_opt_len || (iph->ihl > 5)) { | 4538 | if (tcp_opt_len || (iph->ihl > 5)) { |
4539 | vlan_tag_flags |= ((iph->ihl - 5) + | 4539 | vlan_tag_flags |= ((iph->ihl - 5) + |
4540 | (tcp_opt_len >> 2)) << 8; | 4540 | (tcp_opt_len >> 2)) << 8; |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index a4204dff3636..43e92f9f0bcd 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1872,7 +1872,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1872 | hdr->opcode = CPL_TX_PKT_LSO; | 1872 | hdr->opcode = CPL_TX_PKT_LSO; |
1873 | hdr->ip_csum_dis = hdr->l4_csum_dis = 0; | 1873 | hdr->ip_csum_dis = hdr->l4_csum_dis = 0; |
1874 | hdr->ip_hdr_words = ip_hdr(skb)->ihl; | 1874 | hdr->ip_hdr_words = ip_hdr(skb)->ihl; |
1875 | hdr->tcp_hdr_words = skb->h.th->doff; | 1875 | hdr->tcp_hdr_words = tcp_hdr(skb)->doff; |
1876 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, | 1876 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, |
1877 | skb_shinfo(skb)->gso_size)); | 1877 | skb_shinfo(skb)->gso_size)); |
1878 | hdr->len = htonl(skb->len - sizeof(*hdr)); | 1878 | hdr->len = htonl(skb->len - sizeof(*hdr)); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index d38b1bcd138e..a70fe9145a2e 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -901,7 +901,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
901 | CPL_ETH_II : CPL_ETH_II_VLAN; | 901 | CPL_ETH_II : CPL_ETH_II_VLAN; |
902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | | 902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | |
903 | V_LSO_IPHDR_WORDS(ip_hdr(skb)->ihl) | | 903 | V_LSO_IPHDR_WORDS(ip_hdr(skb)->ihl) | |
904 | V_LSO_TCPHDR_WORDS(skb->h.th->doff); | 904 | V_LSO_TCPHDR_WORDS(tcp_hdr(skb)->doff); |
905 | hdr->lso_info = htonl(tso_info); | 905 | hdr->lso_info = htonl(tso_info); |
906 | flits = 3; | 906 | flits = 3; |
907 | } else { | 907 | } else { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 4572fbba50f9..e86deb2ef823 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2893,14 +2893,15 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2893 | struct iphdr *iph = ip_hdr(skb); | 2893 | struct iphdr *iph = ip_hdr(skb); |
2894 | iph->tot_len = 0; | 2894 | iph->tot_len = 0; |
2895 | iph->check = 0; | 2895 | iph->check = 0; |
2896 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, | 2896 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
2897 | iph->daddr, 0, | 2897 | iph->daddr, 0, |
2898 | IPPROTO_TCP, 0); | 2898 | IPPROTO_TCP, |
2899 | 0); | ||
2899 | cmd_length = E1000_TXD_CMD_IP; | 2900 | cmd_length = E1000_TXD_CMD_IP; |
2900 | ipcse = skb_transport_offset(skb) - 1; | 2901 | ipcse = skb_transport_offset(skb) - 1; |
2901 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2902 | } else if (skb->protocol == htons(ETH_P_IPV6)) { |
2902 | ipv6_hdr(skb)->payload_len = 0; | 2903 | ipv6_hdr(skb)->payload_len = 0; |
2903 | skb->h.th->check = | 2904 | tcp_hdr(skb)->check = |
2904 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 2905 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
2905 | &ipv6_hdr(skb)->daddr, | 2906 | &ipv6_hdr(skb)->daddr, |
2906 | 0, IPPROTO_TCP, 0); | 2907 | 0, IPPROTO_TCP, 0); |
@@ -2909,7 +2910,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2909 | ipcss = skb_network_offset(skb); | 2910 | ipcss = skb_network_offset(skb); |
2910 | ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; | 2911 | ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; |
2911 | tucss = skb_transport_offset(skb); | 2912 | tucss = skb_transport_offset(skb); |
2912 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 2913 | tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; |
2913 | tucse = 0; | 2914 | tucse = 0; |
2914 | 2915 | ||
2915 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | | 2916 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index ba012e10d79a..bc62e770a256 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -1426,7 +1426,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1426 | } | 1426 | } |
1427 | if (proto == IPPROTO_TCP) { | 1427 | if (proto == IPPROTO_TCP) { |
1428 | csoff += offsetof(struct tcphdr, check); | 1428 | csoff += offsetof(struct tcphdr, check); |
1429 | skb->h.th->check = csum; | 1429 | tcp_hdr(skb)->check = csum; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT); | 1432 | w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT); |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 96550d681623..e729ced52dc3 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1195,13 +1195,14 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1195 | iph = ip_hdr(skb); | 1195 | iph = ip_hdr(skb); |
1196 | iph->tot_len = 0; | 1196 | iph->tot_len = 0; |
1197 | iph->check = 0; | 1197 | iph->check = 0; |
1198 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | 1198 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1199 | 0, IPPROTO_TCP, 0); | 1199 | iph->daddr, 0, |
1200 | IPPROTO_TCP, 0); | ||
1200 | ipcss = skb_network_offset(skb); | 1201 | ipcss = skb_network_offset(skb); |
1201 | ipcso = (void *)&(iph->check) - (void *)skb->data; | 1202 | ipcso = (void *)&(iph->check) - (void *)skb->data; |
1202 | ipcse = skb_transport_offset(skb) - 1; | 1203 | ipcse = skb_transport_offset(skb) - 1; |
1203 | tucss = skb_transport_offset(skb); | 1204 | tucss = skb_transport_offset(skb); |
1204 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 1205 | tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; |
1205 | tucse = 0; | 1206 | tucse = 0; |
1206 | 1207 | ||
1207 | i = adapter->tx_ring.next_to_use; | 1208 | i = adapter->tx_ring.next_to_use; |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 43723839e934..ab15ecd4b3d6 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1169,7 +1169,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp, | |||
1169 | desc->l4i_chk = udp_hdr(skb)->check; | 1169 | desc->l4i_chk = udp_hdr(skb)->check; |
1170 | break; | 1170 | break; |
1171 | case IPPROTO_TCP: | 1171 | case IPPROTO_TCP: |
1172 | desc->l4i_chk = skb->h.th->check; | 1172 | desc->l4i_chk = tcp_hdr(skb)->check; |
1173 | break; | 1173 | break; |
1174 | default: | 1174 | default: |
1175 | BUG(); | 1175 | BUG(); |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7ca30d76bf6f..414365c3198d 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -3922,7 +3922,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3922 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | | 3922 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | |
3923 | TXD_FLAG_CPU_POST_DMA); | 3923 | TXD_FLAG_CPU_POST_DMA); |
3924 | 3924 | ||
3925 | skb->h.th->check = 0; | 3925 | tcp_hdr(skb)->check = 0; |
3926 | 3926 | ||
3927 | } | 3927 | } |
3928 | else if (skb->ip_summed == CHECKSUM_PARTIAL) | 3928 | else if (skb->ip_summed == CHECKSUM_PARTIAL) |
@@ -4080,14 +4080,13 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4080 | iph->check = 0; | 4080 | iph->check = 0; |
4081 | iph->tot_len = htons(mss + hdr_len); | 4081 | iph->tot_len = htons(mss + hdr_len); |
4082 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { | 4082 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { |
4083 | skb->h.th->check = 0; | 4083 | tcp_hdr(skb)->check = 0; |
4084 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; | 4084 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; |
4085 | } | 4085 | } else |
4086 | else { | 4086 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
4087 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, | 4087 | iph->daddr, 0, |
4088 | iph->daddr, 0, | 4088 | IPPROTO_TCP, |
4089 | IPPROTO_TCP, 0); | 4089 | 0); |
4090 | } | ||
4091 | 4090 | ||
4092 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || | 4091 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || |
4093 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { | 4092 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 273f1745a009..b8e84674e170 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -416,7 +416,7 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
416 | eddp->skb_offset += VLAN_HLEN; | 416 | eddp->skb_offset += VLAN_HLEN; |
417 | #endif /* CONFIG_QETH_VLAN */ | 417 | #endif /* CONFIG_QETH_VLAN */ |
418 | } | 418 | } |
419 | tcph = eddp->skb->h.th; | 419 | tcph = tcp_hdr(eddp->skb); |
420 | while (eddp->skb_offset < eddp->skb->len) { | 420 | while (eddp->skb_offset < eddp->skb->len) { |
421 | data_len = min((int)skb_shinfo(eddp->skb)->gso_size, | 421 | data_len = min((int)skb_shinfo(eddp->skb)->gso_size, |
422 | (int)(eddp->skb->len - eddp->skb_offset)); | 422 | (int)(eddp->skb->len - eddp->skb_offset)); |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index 4040bdd8c327..c20e923cf9ad 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -41,7 +41,7 @@ qeth_tso_fill_header(struct qeth_card *card, struct sk_buff *skb) | |||
41 | 41 | ||
42 | hdr = (struct qeth_hdr_tso *) skb->data; | 42 | hdr = (struct qeth_hdr_tso *) skb->data; |
43 | iph = ip_hdr(skb); | 43 | iph = ip_hdr(skb); |
44 | tcph = skb->h.th; | 44 | tcph = tcp_hdr(skb); |
45 | /*fix header to TSO values ...*/ | 45 | /*fix header to TSO values ...*/ |
46 | hdr->hdr.hdr.l3.id = QETH_HEADER_TYPE_TSO; | 46 | hdr->hdr.hdr.l3.id = QETH_HEADER_TYPE_TSO; |
47 | /*set values which are fix for the first approach ...*/ | 47 | /*set values which are fix for the first approach ...*/ |
@@ -65,7 +65,7 @@ qeth_tso_set_tcpip_header(struct qeth_card *card, struct sk_buff *skb) | |||
65 | { | 65 | { |
66 | struct iphdr *iph = ip_hdr(skb); | 66 | struct iphdr *iph = ip_hdr(skb); |
67 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 67 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
68 | struct tcphdr *tcph = skb->h.th; | 68 | struct tcphdr *tcph = tcp_hdr(skb); |
69 | 69 | ||
70 | tcph->check = 0; | 70 | tcph->check = 0; |
71 | if (skb->protocol == ETH_P_IPV6) { | 71 | if (skb->protocol == ETH_P_IPV6) { |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e580416de78a..8f158d66d2a8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -237,7 +237,6 @@ struct sk_buff { | |||
237 | /* 4 byte hole on 64 bit*/ | 237 | /* 4 byte hole on 64 bit*/ |
238 | 238 | ||
239 | union { | 239 | union { |
240 | struct tcphdr *th; | ||
241 | struct iphdr *ipiph; | 240 | struct iphdr *ipiph; |
242 | struct ipv6hdr *ipv6h; | 241 | struct ipv6hdr *ipv6h; |
243 | unsigned char *raw; | 242 | unsigned char *raw; |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 244ae0dacf4a..911d937fb4c1 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -178,14 +178,19 @@ struct tcp_md5sig { | |||
178 | #include <net/inet_connection_sock.h> | 178 | #include <net/inet_connection_sock.h> |
179 | #include <net/inet_timewait_sock.h> | 179 | #include <net/inet_timewait_sock.h> |
180 | 180 | ||
181 | static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) | ||
182 | { | ||
183 | return (struct tcphdr *)skb->h.raw; | ||
184 | } | ||
185 | |||
181 | static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) | 186 | static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) |
182 | { | 187 | { |
183 | return skb->h.th->doff * 4; | 188 | return tcp_hdr(skb)->doff * 4; |
184 | } | 189 | } |
185 | 190 | ||
186 | static inline unsigned int tcp_optlen(const struct sk_buff *skb) | 191 | static inline unsigned int tcp_optlen(const struct sk_buff *skb) |
187 | { | 192 | { |
188 | return (skb->h.th->doff - 5) * 4; | 193 | return (tcp_hdr(skb)->doff - 5) * 4; |
189 | } | 194 | } |
190 | 195 | ||
191 | /* This defines a selective acknowledgement block. */ | 196 | /* This defines a selective acknowledgement block. */ |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 6dacc352dcf1..af9273204cfd 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -984,7 +984,7 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
984 | ireq->wscale_ok = rx_opt->wscale_ok; | 984 | ireq->wscale_ok = rx_opt->wscale_ok; |
985 | ireq->acked = 0; | 985 | ireq->acked = 0; |
986 | ireq->ecn_ok = 0; | 986 | ireq->ecn_ok = 0; |
987 | ireq->rmt_port = skb->h.th->source; | 987 | ireq->rmt_port = tcp_hdr(skb)->source; |
988 | } | 988 | } |
989 | 989 | ||
990 | extern void tcp_enter_memory_pressure(void); | 990 | extern void tcp_enter_memory_pressure(void); |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index 4629d77173f2..b5f7c6ac0880 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
@@ -54,7 +54,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
54 | INET_ECN_xmit(sk); | 54 | INET_ECN_xmit(sk); |
55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | 55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { |
56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | 56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; |
57 | skb->h.th->cwr = 1; | 57 | tcp_hdr(skb)->cwr = 1; |
58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | 58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; |
59 | } | 59 | } |
60 | } else { | 60 | } else { |
@@ -62,7 +62,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
62 | INET_ECN_dontxmit(sk); | 62 | INET_ECN_dontxmit(sk); |
63 | } | 63 | } |
64 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) | 64 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) |
65 | skb->h.th->ece = 1; | 65 | tcp_hdr(skb)->ece = 1; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
@@ -70,7 +70,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
70 | 70 | ||
71 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) | 71 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) |
72 | { | 72 | { |
73 | if (skb->h.th->cwr) | 73 | if (tcp_hdr(skb)->cwr) |
74 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | 74 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
75 | } | 75 | } |
76 | 76 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 6d92358fc513..602268661eb3 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1352,8 +1352,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1352 | .tos = RT_TOS(ip_hdr(skb)->tos) } }, | 1352 | .tos = RT_TOS(ip_hdr(skb)->tos) } }, |
1353 | /* Not quite clean, but right. */ | 1353 | /* Not quite clean, but right. */ |
1354 | .uli_u = { .ports = | 1354 | .uli_u = { .ports = |
1355 | { .sport = skb->h.th->dest, | 1355 | { .sport = tcp_hdr(skb)->dest, |
1356 | .dport = skb->h.th->source } }, | 1356 | .dport = tcp_hdr(skb)->source } }, |
1357 | .proto = sk->sk_protocol }; | 1357 | .proto = sk->sk_protocol }; |
1358 | security_skb_classify_flow(skb, &fl); | 1358 | security_skb_classify_flow(skb, &fl); |
1359 | if (ip_route_output_key(&rt, &fl)) | 1359 | if (ip_route_output_key(&rt, &fl)) |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 261607178491..2da1be0589a9 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -125,10 +125,11 @@ static __u16 const msstab[] = { | |||
125 | __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | 125 | __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) |
126 | { | 126 | { |
127 | struct tcp_sock *tp = tcp_sk(sk); | 127 | struct tcp_sock *tp = tcp_sk(sk); |
128 | const struct iphdr *iph = ip_hdr(skb); | ||
129 | const struct tcphdr *th = tcp_hdr(skb); | ||
128 | int mssind; | 130 | int mssind; |
129 | const __u16 mss = *mssp; | 131 | const __u16 mss = *mssp; |
130 | 132 | ||
131 | |||
132 | tp->last_synq_overflow = jiffies; | 133 | tp->last_synq_overflow = jiffies; |
133 | 134 | ||
134 | /* XXX sort msstab[] by probability? Binary search? */ | 135 | /* XXX sort msstab[] by probability? Binary search? */ |
@@ -138,9 +139,8 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
138 | 139 | ||
139 | NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESSENT); | 140 | NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESSENT); |
140 | 141 | ||
141 | return secure_tcp_syn_cookie(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 142 | return secure_tcp_syn_cookie(iph->saddr, iph->daddr, |
142 | skb->h.th->source, skb->h.th->dest, | 143 | th->source, th->dest, ntohl(th->seq), |
143 | ntohl(skb->h.th->seq), | ||
144 | jiffies / (HZ * 60), mssind); | 144 | jiffies / (HZ * 60), mssind); |
145 | } | 145 | } |
146 | 146 | ||
@@ -157,14 +157,13 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
157 | */ | 157 | */ |
158 | static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | 158 | static inline int cookie_check(struct sk_buff *skb, __u32 cookie) |
159 | { | 159 | { |
160 | __u32 seq; | 160 | const struct iphdr *iph = ip_hdr(skb); |
161 | __u32 mssind; | 161 | const struct tcphdr *th = tcp_hdr(skb); |
162 | 162 | __u32 seq = ntohl(th->seq) - 1; | |
163 | seq = ntohl(skb->h.th->seq)-1; | 163 | __u32 mssind = check_tcp_syn_cookie(cookie, iph->saddr, iph->daddr, |
164 | mssind = check_tcp_syn_cookie(cookie, | 164 | th->source, th->dest, seq, |
165 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 165 | jiffies / (HZ * 60), |
166 | skb->h.th->source, skb->h.th->dest, | 166 | COUNTER_TRIES); |
167 | seq, jiffies / (HZ * 60), COUNTER_TRIES); | ||
168 | 167 | ||
169 | return mssind < NUM_MSS ? msstab[mssind] + 1 : 0; | 168 | return mssind < NUM_MSS ? msstab[mssind] + 1 : 0; |
170 | } | 169 | } |
@@ -191,14 +190,15 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
191 | struct inet_request_sock *ireq; | 190 | struct inet_request_sock *ireq; |
192 | struct tcp_request_sock *treq; | 191 | struct tcp_request_sock *treq; |
193 | struct tcp_sock *tp = tcp_sk(sk); | 192 | struct tcp_sock *tp = tcp_sk(sk); |
194 | __u32 cookie = ntohl(skb->h.th->ack_seq) - 1; | 193 | const struct tcphdr *th = tcp_hdr(skb); |
194 | __u32 cookie = ntohl(th->ack_seq) - 1; | ||
195 | struct sock *ret = sk; | 195 | struct sock *ret = sk; |
196 | struct request_sock *req; | 196 | struct request_sock *req; |
197 | int mss; | 197 | int mss; |
198 | struct rtable *rt; | 198 | struct rtable *rt; |
199 | __u8 rcv_wscale; | 199 | __u8 rcv_wscale; |
200 | 200 | ||
201 | if (!sysctl_tcp_syncookies || !skb->h.th->ack) | 201 | if (!sysctl_tcp_syncookies || !th->ack) |
202 | goto out; | 202 | goto out; |
203 | 203 | ||
204 | if (time_after(jiffies, tp->last_synq_overflow + TCP_TIMEOUT_INIT) || | 204 | if (time_after(jiffies, tp->last_synq_overflow + TCP_TIMEOUT_INIT) || |
@@ -220,10 +220,10 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
220 | } | 220 | } |
221 | ireq = inet_rsk(req); | 221 | ireq = inet_rsk(req); |
222 | treq = tcp_rsk(req); | 222 | treq = tcp_rsk(req); |
223 | treq->rcv_isn = ntohl(skb->h.th->seq) - 1; | 223 | treq->rcv_isn = ntohl(th->seq) - 1; |
224 | treq->snt_isn = cookie; | 224 | treq->snt_isn = cookie; |
225 | req->mss = mss; | 225 | req->mss = mss; |
226 | ireq->rmt_port = skb->h.th->source; | 226 | ireq->rmt_port = th->source; |
227 | ireq->loc_addr = ip_hdr(skb)->daddr; | 227 | ireq->loc_addr = ip_hdr(skb)->daddr; |
228 | ireq->rmt_addr = ip_hdr(skb)->saddr; | 228 | ireq->rmt_addr = ip_hdr(skb)->saddr; |
229 | ireq->opt = NULL; | 229 | ireq->opt = NULL; |
@@ -261,8 +261,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
261 | .tos = RT_CONN_FLAGS(sk) } }, | 261 | .tos = RT_CONN_FLAGS(sk) } }, |
262 | .proto = IPPROTO_TCP, | 262 | .proto = IPPROTO_TCP, |
263 | .uli_u = { .ports = | 263 | .uli_u = { .ports = |
264 | { .sport = skb->h.th->dest, | 264 | { .sport = th->dest, |
265 | .dport = skb->h.th->source } } }; | 265 | .dport = th->source } } }; |
266 | security_req_classify_flow(req, &fl); | 266 | security_req_classify_flow(req, &fl); |
267 | if (ip_route_output_key(&rt, &fl)) { | 267 | if (ip_route_output_key(&rt, &fl)) { |
268 | reqsk_free(req); | 268 | reqsk_free(req); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 689f9330f1b9..f832f3c33ab1 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -425,7 +425,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
425 | /* Subtract 1, if FIN is in queue. */ | 425 | /* Subtract 1, if FIN is in queue. */ |
426 | if (answ && !skb_queue_empty(&sk->sk_receive_queue)) | 426 | if (answ && !skb_queue_empty(&sk->sk_receive_queue)) |
427 | answ -= | 427 | answ -= |
428 | ((struct sk_buff *)sk->sk_receive_queue.prev)->h.th->fin; | 428 | tcp_hdr((struct sk_buff *)sk->sk_receive_queue.prev)->fin; |
429 | } else | 429 | } else |
430 | answ = tp->urg_seq - tp->copied_seq; | 430 | answ = tp->urg_seq - tp->copied_seq; |
431 | release_sock(sk); | 431 | release_sock(sk); |
@@ -1016,9 +1016,9 @@ static inline struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) | |||
1016 | 1016 | ||
1017 | skb_queue_walk(&sk->sk_receive_queue, skb) { | 1017 | skb_queue_walk(&sk->sk_receive_queue, skb) { |
1018 | offset = seq - TCP_SKB_CB(skb)->seq; | 1018 | offset = seq - TCP_SKB_CB(skb)->seq; |
1019 | if (skb->h.th->syn) | 1019 | if (tcp_hdr(skb)->syn) |
1020 | offset--; | 1020 | offset--; |
1021 | if (offset < skb->len || skb->h.th->fin) { | 1021 | if (offset < skb->len || tcp_hdr(skb)->fin) { |
1022 | *off = offset; | 1022 | *off = offset; |
1023 | return skb; | 1023 | return skb; |
1024 | } | 1024 | } |
@@ -1070,7 +1070,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | |||
1070 | if (offset != skb->len) | 1070 | if (offset != skb->len) |
1071 | break; | 1071 | break; |
1072 | } | 1072 | } |
1073 | if (skb->h.th->fin) { | 1073 | if (tcp_hdr(skb)->fin) { |
1074 | sk_eat_skb(sk, skb, 0); | 1074 | sk_eat_skb(sk, skb, 0); |
1075 | ++seq; | 1075 | ++seq; |
1076 | break; | 1076 | break; |
@@ -1174,11 +1174,11 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1174 | break; | 1174 | break; |
1175 | } | 1175 | } |
1176 | offset = *seq - TCP_SKB_CB(skb)->seq; | 1176 | offset = *seq - TCP_SKB_CB(skb)->seq; |
1177 | if (skb->h.th->syn) | 1177 | if (tcp_hdr(skb)->syn) |
1178 | offset--; | 1178 | offset--; |
1179 | if (offset < skb->len) | 1179 | if (offset < skb->len) |
1180 | goto found_ok_skb; | 1180 | goto found_ok_skb; |
1181 | if (skb->h.th->fin) | 1181 | if (tcp_hdr(skb)->fin) |
1182 | goto found_fin_ok; | 1182 | goto found_fin_ok; |
1183 | BUG_TRAP(flags & MSG_PEEK); | 1183 | BUG_TRAP(flags & MSG_PEEK); |
1184 | skb = skb->next; | 1184 | skb = skb->next; |
@@ -1394,7 +1394,7 @@ skip_copy: | |||
1394 | if (used + offset < skb->len) | 1394 | if (used + offset < skb->len) |
1395 | continue; | 1395 | continue; |
1396 | 1396 | ||
1397 | if (skb->h.th->fin) | 1397 | if (tcp_hdr(skb)->fin) |
1398 | goto found_fin_ok; | 1398 | goto found_fin_ok; |
1399 | if (!(flags & MSG_PEEK)) { | 1399 | if (!(flags & MSG_PEEK)) { |
1400 | sk_eat_skb(sk, skb, copied_early); | 1400 | sk_eat_skb(sk, skb, copied_early); |
@@ -1563,7 +1563,7 @@ void tcp_close(struct sock *sk, long timeout) | |||
1563 | */ | 1563 | */ |
1564 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 1564 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
1565 | u32 len = TCP_SKB_CB(skb)->end_seq - TCP_SKB_CB(skb)->seq - | 1565 | u32 len = TCP_SKB_CB(skb)->end_seq - TCP_SKB_CB(skb)->seq - |
1566 | skb->h.th->fin; | 1566 | tcp_hdr(skb)->fin; |
1567 | data_was_unread += len; | 1567 | data_was_unread += len; |
1568 | __kfree_skb(skb); | 1568 | __kfree_skb(skb); |
1569 | } | 1569 | } |
@@ -2170,7 +2170,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2170 | if (!pskb_may_pull(skb, sizeof(*th))) | 2170 | if (!pskb_may_pull(skb, sizeof(*th))) |
2171 | goto out; | 2171 | goto out; |
2172 | 2172 | ||
2173 | th = skb->h.th; | 2173 | th = tcp_hdr(skb); |
2174 | thlen = th->doff * 4; | 2174 | thlen = th->doff * 4; |
2175 | if (thlen < sizeof(*th)) | 2175 | if (thlen < sizeof(*th)) |
2176 | goto out; | 2176 | goto out; |
@@ -2210,7 +2210,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2210 | delta = htonl(oldlen + (thlen + len)); | 2210 | delta = htonl(oldlen + (thlen + len)); |
2211 | 2211 | ||
2212 | skb = segs; | 2212 | skb = segs; |
2213 | th = skb->h.th; | 2213 | th = tcp_hdr(skb); |
2214 | seq = ntohl(th->seq); | 2214 | seq = ntohl(th->seq); |
2215 | 2215 | ||
2216 | do { | 2216 | do { |
@@ -2224,7 +2224,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2224 | 2224 | ||
2225 | seq += len; | 2225 | seq += len; |
2226 | skb = skb->next; | 2226 | skb = skb->next; |
2227 | th = skb->h.th; | 2227 | th = tcp_hdr(skb); |
2228 | 2228 | ||
2229 | th->seq = htonl(seq); | 2229 | th->seq = htonl(seq); |
2230 | th->cwr = 0; | 2230 | th->cwr = 0; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2776a8b01339..c1ce36237380 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -148,7 +148,7 @@ static void tcp_measure_rcv_mss(struct sock *sk, | |||
148 | * to handle super-low mtu links fairly. | 148 | * to handle super-low mtu links fairly. |
149 | */ | 149 | */ |
150 | (len >= TCP_MIN_MSS + sizeof(struct tcphdr) && | 150 | (len >= TCP_MIN_MSS + sizeof(struct tcphdr) && |
151 | !(tcp_flag_word(skb->h.th)&TCP_REMNANT))) { | 151 | !(tcp_flag_word(tcp_hdr(skb)) & TCP_REMNANT))) { |
152 | /* Subtract also invariant (if peer is RFC compliant), | 152 | /* Subtract also invariant (if peer is RFC compliant), |
153 | * tcp header plus fixed timestamp option length. | 153 | * tcp header plus fixed timestamp option length. |
154 | * Resulting "len" is MSS free of SACK jitter. | 154 | * Resulting "len" is MSS free of SACK jitter. |
@@ -2559,9 +2559,9 @@ static int tcp_ack_update_window(struct sock *sk, struct tcp_sock *tp, | |||
2559 | struct sk_buff *skb, u32 ack, u32 ack_seq) | 2559 | struct sk_buff *skb, u32 ack, u32 ack_seq) |
2560 | { | 2560 | { |
2561 | int flag = 0; | 2561 | int flag = 0; |
2562 | u32 nwin = ntohs(skb->h.th->window); | 2562 | u32 nwin = ntohs(tcp_hdr(skb)->window); |
2563 | 2563 | ||
2564 | if (likely(!skb->h.th->syn)) | 2564 | if (likely(!tcp_hdr(skb)->syn)) |
2565 | nwin <<= tp->rx_opt.snd_wscale; | 2565 | nwin <<= tp->rx_opt.snd_wscale; |
2566 | 2566 | ||
2567 | if (tcp_may_update_window(tp, ack, ack_seq, nwin)) { | 2567 | if (tcp_may_update_window(tp, ack, ack_seq, nwin)) { |
@@ -2766,7 +2766,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
2766 | if (TCP_SKB_CB(skb)->sacked) | 2766 | if (TCP_SKB_CB(skb)->sacked) |
2767 | flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una); | 2767 | flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una); |
2768 | 2768 | ||
2769 | if (TCP_ECN_rcv_ecn_echo(tp, skb->h.th)) | 2769 | if (TCP_ECN_rcv_ecn_echo(tp, tcp_hdr(skb))) |
2770 | flag |= FLAG_ECE; | 2770 | flag |= FLAG_ECE; |
2771 | 2771 | ||
2772 | tcp_ca_event(sk, CA_EVENT_SLOW_ACK); | 2772 | tcp_ca_event(sk, CA_EVENT_SLOW_ACK); |
@@ -2833,7 +2833,7 @@ uninteresting_ack: | |||
2833 | void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, int estab) | 2833 | void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, int estab) |
2834 | { | 2834 | { |
2835 | unsigned char *ptr; | 2835 | unsigned char *ptr; |
2836 | struct tcphdr *th = skb->h.th; | 2836 | struct tcphdr *th = tcp_hdr(skb); |
2837 | int length=(th->doff*4)-sizeof(struct tcphdr); | 2837 | int length=(th->doff*4)-sizeof(struct tcphdr); |
2838 | 2838 | ||
2839 | ptr = (unsigned char *)(th + 1); | 2839 | ptr = (unsigned char *)(th + 1); |
@@ -2995,7 +2995,7 @@ static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) | |||
2995 | static int tcp_disordered_ack(const struct sock *sk, const struct sk_buff *skb) | 2995 | static int tcp_disordered_ack(const struct sock *sk, const struct sk_buff *skb) |
2996 | { | 2996 | { |
2997 | struct tcp_sock *tp = tcp_sk(sk); | 2997 | struct tcp_sock *tp = tcp_sk(sk); |
2998 | struct tcphdr *th = skb->h.th; | 2998 | struct tcphdr *th = tcp_hdr(skb); |
2999 | u32 seq = TCP_SKB_CB(skb)->seq; | 2999 | u32 seq = TCP_SKB_CB(skb)->seq; |
3000 | u32 ack = TCP_SKB_CB(skb)->ack_seq; | 3000 | u32 ack = TCP_SKB_CB(skb)->ack_seq; |
3001 | 3001 | ||
@@ -3357,8 +3357,8 @@ static void tcp_ofo_queue(struct sock *sk) | |||
3357 | __skb_unlink(skb, &tp->out_of_order_queue); | 3357 | __skb_unlink(skb, &tp->out_of_order_queue); |
3358 | __skb_queue_tail(&sk->sk_receive_queue, skb); | 3358 | __skb_queue_tail(&sk->sk_receive_queue, skb); |
3359 | tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; | 3359 | tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; |
3360 | if (skb->h.th->fin) | 3360 | if (tcp_hdr(skb)->fin) |
3361 | tcp_fin(skb, sk, skb->h.th); | 3361 | tcp_fin(skb, sk, tcp_hdr(skb)); |
3362 | } | 3362 | } |
3363 | } | 3363 | } |
3364 | 3364 | ||
@@ -3366,7 +3366,7 @@ static int tcp_prune_queue(struct sock *sk); | |||
3366 | 3366 | ||
3367 | static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) | 3367 | static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) |
3368 | { | 3368 | { |
3369 | struct tcphdr *th = skb->h.th; | 3369 | struct tcphdr *th = tcp_hdr(skb); |
3370 | struct tcp_sock *tp = tcp_sk(sk); | 3370 | struct tcp_sock *tp = tcp_sk(sk); |
3371 | int eaten = -1; | 3371 | int eaten = -1; |
3372 | 3372 | ||
@@ -3605,7 +3605,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3605 | * - bloated or contains data before "start" or | 3605 | * - bloated or contains data before "start" or |
3606 | * overlaps to the next one. | 3606 | * overlaps to the next one. |
3607 | */ | 3607 | */ |
3608 | if (!skb->h.th->syn && !skb->h.th->fin && | 3608 | if (!tcp_hdr(skb)->syn && !tcp_hdr(skb)->fin && |
3609 | (tcp_win_from_space(skb->truesize) > skb->len || | 3609 | (tcp_win_from_space(skb->truesize) > skb->len || |
3610 | before(TCP_SKB_CB(skb)->seq, start) || | 3610 | before(TCP_SKB_CB(skb)->seq, start) || |
3611 | (skb->next != tail && | 3611 | (skb->next != tail && |
@@ -3616,7 +3616,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3616 | start = TCP_SKB_CB(skb)->end_seq; | 3616 | start = TCP_SKB_CB(skb)->end_seq; |
3617 | skb = skb->next; | 3617 | skb = skb->next; |
3618 | } | 3618 | } |
3619 | if (skb == tail || skb->h.th->syn || skb->h.th->fin) | 3619 | if (skb == tail || tcp_hdr(skb)->syn || tcp_hdr(skb)->fin) |
3620 | return; | 3620 | return; |
3621 | 3621 | ||
3622 | while (before(start, end)) { | 3622 | while (before(start, end)) { |
@@ -3665,7 +3665,9 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3665 | __kfree_skb(skb); | 3665 | __kfree_skb(skb); |
3666 | NET_INC_STATS_BH(LINUX_MIB_TCPRCVCOLLAPSED); | 3666 | NET_INC_STATS_BH(LINUX_MIB_TCPRCVCOLLAPSED); |
3667 | skb = next; | 3667 | skb = next; |
3668 | if (skb == tail || skb->h.th->syn || skb->h.th->fin) | 3668 | if (skb == tail || |
3669 | tcp_hdr(skb)->syn || | ||
3670 | tcp_hdr(skb)->fin) | ||
3669 | return; | 3671 | return; |
3670 | } | 3672 | } |
3671 | } | 3673 | } |
@@ -4072,7 +4074,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, int hlen | |||
4072 | tcp_rcv_space_adjust(sk); | 4074 | tcp_rcv_space_adjust(sk); |
4073 | 4075 | ||
4074 | if ((tp->ucopy.len == 0) || | 4076 | if ((tp->ucopy.len == 0) || |
4075 | (tcp_flag_word(skb->h.th) & TCP_FLAG_PSH) || | 4077 | (tcp_flag_word(tcp_hdr(skb)) & TCP_FLAG_PSH) || |
4076 | (atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1))) { | 4078 | (atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1))) { |
4077 | tp->ucopy.wakeup = 1; | 4079 | tp->ucopy.wakeup = 1; |
4078 | sk->sk_data_ready(sk, 0); | 4080 | sk->sk_data_ready(sk, 0); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index c146a02f8495..617a5e4ca010 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -127,8 +127,8 @@ static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) | |||
127 | { | 127 | { |
128 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, | 128 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, |
129 | ip_hdr(skb)->saddr, | 129 | ip_hdr(skb)->saddr, |
130 | skb->h.th->dest, | 130 | tcp_hdr(skb)->dest, |
131 | skb->h.th->source); | 131 | tcp_hdr(skb)->source); |
132 | } | 132 | } |
133 | 133 | ||
134 | int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) | 134 | int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) |
@@ -499,7 +499,7 @@ out: | |||
499 | void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) | 499 | void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) |
500 | { | 500 | { |
501 | struct inet_sock *inet = inet_sk(sk); | 501 | struct inet_sock *inet = inet_sk(sk); |
502 | struct tcphdr *th = skb->h.th; | 502 | struct tcphdr *th = tcp_hdr(skb); |
503 | 503 | ||
504 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 504 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
505 | th->check = ~tcp_v4_check(len, inet->saddr, | 505 | th->check = ~tcp_v4_check(len, inet->saddr, |
@@ -522,7 +522,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb) | |||
522 | return -EINVAL; | 522 | return -EINVAL; |
523 | 523 | ||
524 | iph = ip_hdr(skb); | 524 | iph = ip_hdr(skb); |
525 | th = skb->h.th; | 525 | th = tcp_hdr(skb); |
526 | 526 | ||
527 | th->check = 0; | 527 | th->check = 0; |
528 | th->check = ~tcp_v4_check(skb->len, iph->saddr, iph->daddr, 0); | 528 | th->check = ~tcp_v4_check(skb->len, iph->saddr, iph->daddr, 0); |
@@ -546,7 +546,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb) | |||
546 | 546 | ||
547 | static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | 547 | static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) |
548 | { | 548 | { |
549 | struct tcphdr *th = skb->h.th; | 549 | struct tcphdr *th = tcp_hdr(skb); |
550 | struct { | 550 | struct { |
551 | struct tcphdr th; | 551 | struct tcphdr th; |
552 | #ifdef CONFIG_TCP_MD5SIG | 552 | #ifdef CONFIG_TCP_MD5SIG |
@@ -622,7 +622,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, | |||
622 | struct sk_buff *skb, u32 seq, u32 ack, | 622 | struct sk_buff *skb, u32 seq, u32 ack, |
623 | u32 win, u32 ts) | 623 | u32 win, u32 ts) |
624 | { | 624 | { |
625 | struct tcphdr *th = skb->h.th; | 625 | struct tcphdr *th = tcp_hdr(skb); |
626 | struct { | 626 | struct { |
627 | struct tcphdr th; | 627 | struct tcphdr th; |
628 | __be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2) | 628 | __be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2) |
@@ -745,7 +745,7 @@ static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | |||
745 | skb = tcp_make_synack(sk, dst, req); | 745 | skb = tcp_make_synack(sk, dst, req); |
746 | 746 | ||
747 | if (skb) { | 747 | if (skb) { |
748 | struct tcphdr *th = skb->h.th; | 748 | struct tcphdr *th = tcp_hdr(skb); |
749 | 749 | ||
750 | th->check = tcp_v4_check(skb->len, | 750 | th->check = tcp_v4_check(skb->len, |
751 | ireq->loc_addr, | 751 | ireq->loc_addr, |
@@ -781,7 +781,7 @@ static void syn_flood_warning(struct sk_buff *skb) | |||
781 | warntime = jiffies; | 781 | warntime = jiffies; |
782 | printk(KERN_INFO | 782 | printk(KERN_INFO |
783 | "possible SYN flooding on port %d. Sending cookies.\n", | 783 | "possible SYN flooding on port %d. Sending cookies.\n", |
784 | ntohs(skb->h.th->dest)); | 784 | ntohs(tcp_hdr(skb)->dest)); |
785 | } | 785 | } |
786 | } | 786 | } |
787 | #endif | 787 | #endif |
@@ -1134,7 +1134,7 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | |||
1134 | __u8 *hash_location = NULL; | 1134 | __u8 *hash_location = NULL; |
1135 | struct tcp_md5sig_key *hash_expected; | 1135 | struct tcp_md5sig_key *hash_expected; |
1136 | const struct iphdr *iph = ip_hdr(skb); | 1136 | const struct iphdr *iph = ip_hdr(skb); |
1137 | struct tcphdr *th = skb->h.th; | 1137 | struct tcphdr *th = tcp_hdr(skb); |
1138 | int length = (th->doff << 2) - sizeof(struct tcphdr); | 1138 | int length = (th->doff << 2) - sizeof(struct tcphdr); |
1139 | int genhash; | 1139 | int genhash; |
1140 | unsigned char *ptr; | 1140 | unsigned char *ptr; |
@@ -1327,7 +1327,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1327 | ireq->rmt_addr = saddr; | 1327 | ireq->rmt_addr = saddr; |
1328 | ireq->opt = tcp_v4_save_options(sk, skb); | 1328 | ireq->opt = tcp_v4_save_options(sk, skb); |
1329 | if (!want_cookie) | 1329 | if (!want_cookie) |
1330 | TCP_ECN_create_request(req, skb->h.th); | 1330 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
1331 | 1331 | ||
1332 | if (want_cookie) { | 1332 | if (want_cookie) { |
1333 | #ifdef CONFIG_SYN_COOKIES | 1333 | #ifdef CONFIG_SYN_COOKIES |
@@ -1375,7 +1375,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1375 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open " | 1375 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open " |
1376 | "request from %u.%u.%u.%u/%u\n", | 1376 | "request from %u.%u.%u.%u/%u\n", |
1377 | NIPQUAD(saddr), | 1377 | NIPQUAD(saddr), |
1378 | ntohs(skb->h.th->source)); | 1378 | ntohs(tcp_hdr(skb)->source)); |
1379 | dst_release(dst); | 1379 | dst_release(dst); |
1380 | goto drop_and_free; | 1380 | goto drop_and_free; |
1381 | } | 1381 | } |
@@ -1481,7 +1481,7 @@ exit: | |||
1481 | 1481 | ||
1482 | static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | 1482 | static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) |
1483 | { | 1483 | { |
1484 | struct tcphdr *th = skb->h.th; | 1484 | struct tcphdr *th = tcp_hdr(skb); |
1485 | const struct iphdr *iph = ip_hdr(skb); | 1485 | const struct iphdr *iph = ip_hdr(skb); |
1486 | struct sock *nsk; | 1486 | struct sock *nsk; |
1487 | struct request_sock **prev; | 1487 | struct request_sock **prev; |
@@ -1556,7 +1556,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1556 | 1556 | ||
1557 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1557 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1558 | TCP_CHECK_TIMER(sk); | 1558 | TCP_CHECK_TIMER(sk); |
1559 | if (tcp_rcv_established(sk, skb, skb->h.th, skb->len)) { | 1559 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { |
1560 | rsk = sk; | 1560 | rsk = sk; |
1561 | goto reset; | 1561 | goto reset; |
1562 | } | 1562 | } |
@@ -1582,7 +1582,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1582 | } | 1582 | } |
1583 | 1583 | ||
1584 | TCP_CHECK_TIMER(sk); | 1584 | TCP_CHECK_TIMER(sk); |
1585 | if (tcp_rcv_state_process(sk, skb, skb->h.th, skb->len)) { | 1585 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) { |
1586 | rsk = sk; | 1586 | rsk = sk; |
1587 | goto reset; | 1587 | goto reset; |
1588 | } | 1588 | } |
@@ -1625,7 +1625,7 @@ int tcp_v4_rcv(struct sk_buff *skb) | |||
1625 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) | 1625 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) |
1626 | goto discard_it; | 1626 | goto discard_it; |
1627 | 1627 | ||
1628 | th = skb->h.th; | 1628 | th = tcp_hdr(skb); |
1629 | 1629 | ||
1630 | if (th->doff < sizeof(struct tcphdr) / 4) | 1630 | if (th->doff < sizeof(struct tcphdr) / 4) |
1631 | goto bad_packet; | 1631 | goto bad_packet; |
@@ -1640,7 +1640,7 @@ int tcp_v4_rcv(struct sk_buff *skb) | |||
1640 | tcp_v4_checksum_init(skb))) | 1640 | tcp_v4_checksum_init(skb))) |
1641 | goto bad_packet; | 1641 | goto bad_packet; |
1642 | 1642 | ||
1643 | th = skb->h.th; | 1643 | th = tcp_hdr(skb); |
1644 | iph = ip_hdr(skb); | 1644 | iph = ip_hdr(skb); |
1645 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); | 1645 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); |
1646 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + | 1646 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 463d2b24d2db..a12b08fca5ad 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -453,7 +453,8 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
453 | newtp->rx_opt.snd_wscale = newtp->rx_opt.rcv_wscale = 0; | 453 | newtp->rx_opt.snd_wscale = newtp->rx_opt.rcv_wscale = 0; |
454 | newtp->window_clamp = min(newtp->window_clamp, 65535U); | 454 | newtp->window_clamp = min(newtp->window_clamp, 65535U); |
455 | } | 455 | } |
456 | newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->rx_opt.snd_wscale; | 456 | newtp->snd_wnd = (ntohs(tcp_hdr(skb)->window) << |
457 | newtp->rx_opt.snd_wscale); | ||
457 | newtp->max_window = newtp->snd_wnd; | 458 | newtp->max_window = newtp->snd_wnd; |
458 | 459 | ||
459 | if (newtp->rx_opt.tstamp_ok) { | 460 | if (newtp->rx_opt.tstamp_ok) { |
@@ -488,7 +489,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
488 | struct request_sock *req, | 489 | struct request_sock *req, |
489 | struct request_sock **prev) | 490 | struct request_sock **prev) |
490 | { | 491 | { |
491 | struct tcphdr *th = skb->h.th; | 492 | const struct tcphdr *th = tcp_hdr(skb); |
492 | __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); | 493 | __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); |
493 | int paws_reject = 0; | 494 | int paws_reject = 0; |
494 | struct tcp_options_received tmp_opt; | 495 | struct tcp_options_received tmp_opt; |
@@ -710,8 +711,8 @@ int tcp_child_process(struct sock *parent, struct sock *child, | |||
710 | int state = child->sk_state; | 711 | int state = child->sk_state; |
711 | 712 | ||
712 | if (!sock_owned_by_user(child)) { | 713 | if (!sock_owned_by_user(child)) { |
713 | ret = tcp_rcv_state_process(child, skb, skb->h.th, skb->len); | 714 | ret = tcp_rcv_state_process(child, skb, tcp_hdr(skb), |
714 | 715 | skb->len); | |
715 | /* Wakeup parent, send SIGIO */ | 716 | /* Wakeup parent, send SIGIO */ |
716 | if (state == TCP_SYN_RECV && child->sk_state != state) | 717 | if (state == TCP_SYN_RECV && child->sk_state != state) |
717 | parent->sk_data_ready(parent, 0); | 718 | parent->sk_data_ready(parent, 0); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f19f5fb361b5..29c53fbb2204 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -465,11 +465,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
465 | tcp_header_size += TCPOLEN_MD5SIG_ALIGNED; | 465 | tcp_header_size += TCPOLEN_MD5SIG_ALIGNED; |
466 | #endif | 466 | #endif |
467 | 467 | ||
468 | th = (struct tcphdr *) skb_push(skb, tcp_header_size); | 468 | skb_push(skb, tcp_header_size); |
469 | skb->h.th = th; | 469 | skb_reset_transport_header(skb); |
470 | skb_set_owner_w(skb, sk); | 470 | skb_set_owner_w(skb, sk); |
471 | 471 | ||
472 | /* Build TCP header and checksum it. */ | 472 | /* Build TCP header and checksum it. */ |
473 | th = tcp_hdr(skb); | ||
473 | th->source = inet->sport; | 474 | th->source = inet->sport; |
474 | th->dest = inet->dport; | 475 | th->dest = inet->dport; |
475 | th->seq = htonl(tcb->seq); | 476 | th->seq = htonl(tcb->seq); |
@@ -524,7 +525,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
524 | tp->af_specific->calc_md5_hash(md5_hash_location, | 525 | tp->af_specific->calc_md5_hash(md5_hash_location, |
525 | md5, | 526 | md5, |
526 | sk, NULL, NULL, | 527 | sk, NULL, NULL, |
527 | skb->h.th, | 528 | tcp_hdr(skb), |
528 | sk->sk_protocol, | 529 | sk->sk_protocol, |
529 | skb->len); | 530 | skb->len); |
530 | } | 531 | } |
@@ -2128,8 +2129,10 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2128 | if (md5) | 2129 | if (md5) |
2129 | tcp_header_size += TCPOLEN_MD5SIG_ALIGNED; | 2130 | tcp_header_size += TCPOLEN_MD5SIG_ALIGNED; |
2130 | #endif | 2131 | #endif |
2131 | skb->h.th = th = (struct tcphdr *) skb_push(skb, tcp_header_size); | 2132 | skb_push(skb, tcp_header_size); |
2133 | skb_reset_transport_header(skb); | ||
2132 | 2134 | ||
2135 | th = tcp_hdr(skb); | ||
2133 | memset(th, 0, sizeof(struct tcphdr)); | 2136 | memset(th, 0, sizeof(struct tcphdr)); |
2134 | th->syn = 1; | 2137 | th->syn = 1; |
2135 | th->ack = 1; | 2138 | th->ack = 1; |
@@ -2183,7 +2186,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2183 | tp->af_specific->calc_md5_hash(md5_hash_location, | 2186 | tp->af_specific->calc_md5_hash(md5_hash_location, |
2184 | md5, | 2187 | md5, |
2185 | NULL, dst, req, | 2188 | NULL, dst, req, |
2186 | skb->h.th, sk->sk_protocol, | 2189 | tcp_hdr(skb), sk->sk_protocol, |
2187 | skb->len); | 2190 | skb->len); |
2188 | } | 2191 | } |
2189 | #endif | 2192 | #endif |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index c573353f21cd..4a55da079f5f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -117,8 +117,8 @@ static __u32 tcp_v6_init_sequence(struct sk_buff *skb) | |||
117 | { | 117 | { |
118 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, | 118 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, |
119 | ipv6_hdr(skb)->saddr.s6_addr32, | 119 | ipv6_hdr(skb)->saddr.s6_addr32, |
120 | skb->h.th->dest, | 120 | tcp_hdr(skb)->dest, |
121 | skb->h.th->source); | 121 | tcp_hdr(skb)->source); |
122 | } | 122 | } |
123 | 123 | ||
124 | static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | 124 | static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, |
@@ -509,7 +509,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
509 | 509 | ||
510 | skb = tcp_make_synack(sk, dst, req); | 510 | skb = tcp_make_synack(sk, dst, req); |
511 | if (skb) { | 511 | if (skb) { |
512 | struct tcphdr *th = skb->h.th; | 512 | struct tcphdr *th = tcp_hdr(skb); |
513 | 513 | ||
514 | th->check = tcp_v6_check(th, skb->len, | 514 | th->check = tcp_v6_check(th, skb->len, |
515 | &treq->loc_addr, &treq->rmt_addr, | 515 | &treq->loc_addr, &treq->rmt_addr, |
@@ -838,7 +838,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | |||
838 | __u8 *hash_location = NULL; | 838 | __u8 *hash_location = NULL; |
839 | struct tcp_md5sig_key *hash_expected; | 839 | struct tcp_md5sig_key *hash_expected; |
840 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 840 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
841 | struct tcphdr *th = skb->h.th; | 841 | struct tcphdr *th = tcp_hdr(skb); |
842 | int length = (th->doff << 2) - sizeof (*th); | 842 | int length = (th->doff << 2) - sizeof (*th); |
843 | int genhash; | 843 | int genhash; |
844 | u8 *ptr; | 844 | u8 *ptr; |
@@ -946,7 +946,7 @@ static struct timewait_sock_ops tcp6_timewait_sock_ops = { | |||
946 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) | 946 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) |
947 | { | 947 | { |
948 | struct ipv6_pinfo *np = inet6_sk(sk); | 948 | struct ipv6_pinfo *np = inet6_sk(sk); |
949 | struct tcphdr *th = skb->h.th; | 949 | struct tcphdr *th = tcp_hdr(skb); |
950 | 950 | ||
951 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 951 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
952 | th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); | 952 | th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); |
@@ -967,7 +967,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
967 | return -EINVAL; | 967 | return -EINVAL; |
968 | 968 | ||
969 | ipv6h = ipv6_hdr(skb); | 969 | ipv6h = ipv6_hdr(skb); |
970 | th = skb->h.th; | 970 | th = tcp_hdr(skb); |
971 | 971 | ||
972 | th->check = 0; | 972 | th->check = 0; |
973 | th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, | 973 | th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, |
@@ -979,7 +979,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
979 | 979 | ||
980 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | 980 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) |
981 | { | 981 | { |
982 | struct tcphdr *th = skb->h.th, *t1; | 982 | struct tcphdr *th = tcp_hdr(skb), *t1; |
983 | struct sk_buff *buff; | 983 | struct sk_buff *buff; |
984 | struct flowi fl; | 984 | struct flowi fl; |
985 | int tot_len = sizeof(*th); | 985 | int tot_len = sizeof(*th); |
@@ -1079,7 +1079,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1079 | static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | 1079 | static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, |
1080 | struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts) | 1080 | struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts) |
1081 | { | 1081 | { |
1082 | struct tcphdr *th = skb->h.th, *t1; | 1082 | struct tcphdr *th = tcp_hdr(skb), *t1; |
1083 | struct sk_buff *buff; | 1083 | struct sk_buff *buff; |
1084 | struct flowi fl; | 1084 | struct flowi fl; |
1085 | int tot_len = sizeof(struct tcphdr); | 1085 | int tot_len = sizeof(struct tcphdr); |
@@ -1195,7 +1195,7 @@ static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) | |||
1195 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | 1195 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) |
1196 | { | 1196 | { |
1197 | struct request_sock *req, **prev; | 1197 | struct request_sock *req, **prev; |
1198 | const struct tcphdr *th = skb->h.th; | 1198 | const struct tcphdr *th = tcp_hdr(skb); |
1199 | struct sock *nsk; | 1199 | struct sock *nsk; |
1200 | 1200 | ||
1201 | /* Find possible connection requests. */ | 1201 | /* Find possible connection requests. */ |
@@ -1275,7 +1275,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1275 | treq = inet6_rsk(req); | 1275 | treq = inet6_rsk(req); |
1276 | ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); | 1276 | ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); |
1277 | ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); | 1277 | ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); |
1278 | TCP_ECN_create_request(req, skb->h.th); | 1278 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
1279 | treq->pktopts = NULL; | 1279 | treq->pktopts = NULL; |
1280 | if (ipv6_opt_accepted(sk, skb) || | 1280 | if (ipv6_opt_accepted(sk, skb) || |
1281 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || | 1281 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || |
@@ -1528,14 +1528,14 @@ out: | |||
1528 | static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) | 1528 | static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) |
1529 | { | 1529 | { |
1530 | if (skb->ip_summed == CHECKSUM_COMPLETE) { | 1530 | if (skb->ip_summed == CHECKSUM_COMPLETE) { |
1531 | if (!tcp_v6_check(skb->h.th, skb->len, &ipv6_hdr(skb)->saddr, | 1531 | if (!tcp_v6_check(tcp_hdr(skb), skb->len, &ipv6_hdr(skb)->saddr, |
1532 | &ipv6_hdr(skb)->daddr, skb->csum)) { | 1532 | &ipv6_hdr(skb)->daddr, skb->csum)) { |
1533 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1533 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1534 | return 0; | 1534 | return 0; |
1535 | } | 1535 | } |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th, skb->len, | 1538 | skb->csum = ~csum_unfold(tcp_v6_check(tcp_hdr(skb), skb->len, |
1539 | &ipv6_hdr(skb)->saddr, | 1539 | &ipv6_hdr(skb)->saddr, |
1540 | &ipv6_hdr(skb)->daddr, 0)); | 1540 | &ipv6_hdr(skb)->daddr, 0)); |
1541 | 1541 | ||
@@ -1601,7 +1601,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1601 | 1601 | ||
1602 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1602 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1603 | TCP_CHECK_TIMER(sk); | 1603 | TCP_CHECK_TIMER(sk); |
1604 | if (tcp_rcv_established(sk, skb, skb->h.th, skb->len)) | 1604 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) |
1605 | goto reset; | 1605 | goto reset; |
1606 | TCP_CHECK_TIMER(sk); | 1606 | TCP_CHECK_TIMER(sk); |
1607 | if (opt_skb) | 1607 | if (opt_skb) |
@@ -1632,7 +1632,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1632 | } | 1632 | } |
1633 | 1633 | ||
1634 | TCP_CHECK_TIMER(sk); | 1634 | TCP_CHECK_TIMER(sk); |
1635 | if (tcp_rcv_state_process(sk, skb, skb->h.th, skb->len)) | 1635 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) |
1636 | goto reset; | 1636 | goto reset; |
1637 | TCP_CHECK_TIMER(sk); | 1637 | TCP_CHECK_TIMER(sk); |
1638 | if (opt_skb) | 1638 | if (opt_skb) |
@@ -1698,7 +1698,7 @@ static int tcp_v6_rcv(struct sk_buff **pskb) | |||
1698 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) | 1698 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) |
1699 | goto discard_it; | 1699 | goto discard_it; |
1700 | 1700 | ||
1701 | th = skb->h.th; | 1701 | th = tcp_hdr(skb); |
1702 | 1702 | ||
1703 | if (th->doff < sizeof(struct tcphdr)/4) | 1703 | if (th->doff < sizeof(struct tcphdr)/4) |
1704 | goto bad_packet; | 1704 | goto bad_packet; |
@@ -1709,7 +1709,7 @@ static int tcp_v6_rcv(struct sk_buff **pskb) | |||
1709 | tcp_v6_checksum_init(skb))) | 1709 | tcp_v6_checksum_init(skb))) |
1710 | goto bad_packet; | 1710 | goto bad_packet; |
1711 | 1711 | ||
1712 | th = skb->h.th; | 1712 | th = tcp_hdr(skb); |
1713 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); | 1713 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); |
1714 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + | 1714 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + |
1715 | skb->len - th->doff*4); | 1715 | skb->len - th->doff*4); |