aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-14 05:26:37 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-14 13:19:52 +0200
commitf45891cf2655ebda318833b1ca4d11a451d6f398 (patch)
tree88ed2dd04bd3913fac206279c78c987e8ad1b14d /tcp.c
parent3bb859c50522e92f01241403501049692f98d25d (diff)
downloadpasst-f45891cf2655ebda318833b1ca4d11a451d6f398.tar
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.tar.gz
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.tar.bz2
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.tar.lz
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.tar.xz
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.tar.zst
passt-f45891cf2655ebda318833b1ca4d11a451d6f398.zip
conf, tcp, udp: Add --no-map-gw to disable mapping gateway address to host
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tcp.c b/tcp.c
index 05382f7..011710e 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1845,9 +1845,10 @@ static void tcp_conn_from_tap(struct ctx *c, int af, void *addr,
tcp_sock_set_bufsize(c, s);
- if (af == AF_INET && addr4.sin_addr.s_addr == c->gw4)
+ if (af == AF_INET && addr4.sin_addr.s_addr == c->gw4 && !c->no_map_gw)
addr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- else if (af == AF_INET6 && !memcmp(addr, &c->gw6, sizeof(c->gw6)))
+ else if (af == AF_INET6 && !memcmp(addr, &c->gw6, sizeof(c->gw6)) &&
+ !c->no_map_gw)
addr6.sin6_addr = in6addr_loopback;
if (af == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&addr6.sin6_addr)) {