aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-18 20:43:48 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:24 -0400
commitab6a5bb6b28a970104a34f0f6959b73cf61bdc72 (patch)
tree54cfa7d4fe00d0c28a60022b075afc0856d6fc2b /net
parent88c7664f13bd1a36acb8566b93892a4c58759ac6 (diff)
[TCP]: Introduce tcp_hdrlen() and tcp_optlen()
The ip_hdrlen() buddy, created to reduce the number of skb->h.th-> uses and to avoid the longer, open coded equivalent. Ditched a no-op in bnx2 in the process. I wonder if we should have a BUG_ON(skb->h.th->doff < 5) in tcp_optlen()... Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv6/tcp_ipv6.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 51424df9078..c146a02f849 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1564,7 +1564,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
1564 return 0; 1564 return 0;
1565 } 1565 }
1566 1566
1567 if (skb->len < (skb->h.th->doff << 2) || tcp_checksum_complete(skb)) 1567 if (skb->len < tcp_hdrlen(skb) || tcp_checksum_complete(skb))
1568 goto csum_err; 1568 goto csum_err;
1569 1569
1570 if (sk->sk_state == TCP_LISTEN) { 1570 if (sk->sk_state == TCP_LISTEN) {
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 85b3e89110f..c573353f21c 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1609,7 +1609,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1609 return 0; 1609 return 0;
1610 } 1610 }
1611 1611
1612 if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb)) 1612 if (skb->len < tcp_hdrlen(skb) || tcp_checksum_complete(skb))
1613 goto csum_err; 1613 goto csum_err;
1614 1614
1615 if (sk->sk_state == TCP_LISTEN) { 1615 if (sk->sk_state == TCP_LISTEN) {