diff options
Diffstat (limited to 'fwd.c')
| -rw-r--r-- | fwd.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -660,13 +660,15 @@ uint8_t fwd_nat_from_splice(const struct ctx *c, uint8_t proto, return PIF_NONE; } + /* Preserve the src & dest (loopback) addresses */ + tgt->oaddr = ini->eaddr; tgt->eaddr = ini->oaddr; - /* Preserve the specific loopback address used, but let the kernel pick - * a source port on the target side - */ - tgt->oaddr = ini->eaddr; + /* Let the kernel pick a host side source port */ tgt->oport = 0; + if (proto == IPPROTO_UDP) + /* But for UDP preserve the source port */ + tgt->oport = ini->eport; tgt->eport = ini->oport; if (proto == IPPROTO_TCP) @@ -674,12 +676,6 @@ uint8_t fwd_nat_from_splice(const struct ctx *c, uint8_t proto, else if (proto == IPPROTO_UDP) tgt->eport += c->udp.fwd_out.delta[tgt->eport]; - /* Let the kernel pick a host side source port */ - tgt->oport = 0; - if (proto == IPPROTO_UDP) - /* But for UDP preserve the source port */ - tgt->oport = ini->eport; - return PIF_HOST; } |
