diff options
author | davem <davem> | 2001-12-05 08:54:10 +0000 |
---|---|---|
committer | davem <davem> | 2001-12-05 08:54:10 +0000 |
commit | 18c039151705858e5a384ff0c3997573caf6b62b (patch) | |
tree | 12ff1028becf5246f299afa711d42d55c8e6d7ff | |
parent | bb4151ea0cc36c72571dcd3cb796750023f62080 (diff) | |
download | netdev-vger-cvs-18c039151705858e5a384ff0c3997573caf6b62b.tar.gz |
Fix tcp_v4_search_req for the ICMP case,
we were using reversed src/dest.
Discovered by Julian Anastasov.
Note: IPv6 has the same bug but I need to
ask Alexey about something before I change it.
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 008aa0865..83bd0e99b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_ipv4.c,v 1.236 2001-11-06 22:21:08 davem Exp $ + * Version: $Id: tcp_ipv4.c,v 1.237 2001-12-05 08:54:10 davem Exp $ * * IPv4 specific functions * @@ -754,21 +754,19 @@ static __inline__ unsigned tcp_v4_synq_hash(u32 raddr, u16 rport) } static struct open_request *tcp_v4_search_req(struct tcp_opt *tp, - struct iphdr *iph, - struct tcphdr *th, - struct open_request ***prevp) + struct open_request ***prevp, + __u16 rport, + __u32 raddr, __u32 laddr) { struct tcp_listen_opt *lopt = tp->listen_opt; struct open_request *req, **prev; - __u16 rport = th->source; - __u32 raddr = iph->saddr; for (prev = &lopt->syn_table[tcp_v4_synq_hash(raddr, rport)]; (req = *prev) != NULL; prev = &req->dl_next) { if (req->rmt_port == rport && req->af.v4_req.rmt_addr == raddr && - req->af.v4_req.loc_addr == iph->daddr && + req->af.v4_req.loc_addr == laddr && TCP_INET_FAMILY(req->class->family)) { BUG_TRAP(req->sk == NULL); *prevp = prev; @@ -939,7 +937,9 @@ void tcp_v4_err(struct sk_buff *skb, u32 info) if (sk->lock.users != 0) goto out; - req = tcp_v4_search_req(tp, iph, th, &prev); + req = tcp_v4_search_req(tp, &prev, + th->dest, + iph->daddr, iph->saddr); if (!req) goto out; @@ -1473,11 +1473,14 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk,struct sk_buff *skb) { struct open_request *req, **prev; struct tcphdr *th = skb->h.th; + struct iphdr *iph = skb->nh.iph; struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); struct sock *nsk; /* Find possible connection requests. */ - req = tcp_v4_search_req(tp, skb->nh.iph, th, &prev); + req = tcp_v4_search_req(tp, &prev, + th->source, + iph->saddr, iph->daddr); if (req) return tcp_check_req(sk, skb, req, prev); |