diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-12-12 23:26:12 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-12-12 23:26:12 +0000 |
commit | 5f42bde60275e9a0c3d317ee1e052e1aefdcdb19 (patch) | |
tree | 574c22c3bbc57e8998e0dbaf210495ab777f4379 /sys/src/9 | |
parent | acefccf01e5e21456d7ce4eba7257770c944a461 (diff) |
devip: Fix transfoward() iphash collision
We falsely confused locally listening connections
as existing translation entires. Fix it.
Diffstat (limited to 'sys/src/9')
-rw-r--r-- | sys/src/9/ip/ipaux.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/src/9/ip/ipaux.c b/sys/src/9/ip/ipaux.c index bd4be1349..a25b49371 100644 --- a/sys/src/9/ip/ipaux.c +++ b/sys/src/9/ip/ipaux.c @@ -426,10 +426,14 @@ transforward(Proto *p, Ipht *ht, uchar *sa, int sp, uchar *da, int dp, Route *r) /* Translation already exists? */ iph = iphtlook(ht, sa, sp, da, dp); - if(iph != nil) { - if(iph->trans != 1) + if(iph != nil){ + if(iph->trans == 1) + return transupdate(p, iphforward(iph)); + if(iph->match == IPmatchexact){ + netlog(p->f, Logtrans, "trans: backwards collision: %s!%I!%d -> %I!%d\n", + p->name, sa, sp, da, dp); return nil; - return transupdate(p, iphforward(iph)); + } } /* Bad source address? */ |