aboutgitcodebugslistschat
path: root/fwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fwd.c')
-rw-r--r--fwd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fwd.c b/fwd.c
index d6f8a23..664b8ac 100644
--- a/fwd.c
+++ b/fwd.c
@@ -387,10 +387,14 @@ uint8_t fwd_nat_from_host(const struct ctx *c, uint8_t proto,
}
if (!fwd_guest_accessible(c, &ini->eaddr)) {
- if (inany_v4(&ini->eaddr))
- tgt->oaddr = inany_from_v4(c->ip4.gw);
- else
+ if (inany_v4(&ini->eaddr)) {
+ if (IN4_IS_ADDR_UNSPECIFIED(&c->ip4.our_tap_addr))
+ /* No source address we can use */
+ return PIF_NONE;
+ tgt->oaddr = inany_from_v4(c->ip4.our_tap_addr);
+ } else {
tgt->oaddr.a6 = c->ip6.our_tap_ll;
+ }
} else {
tgt->oaddr = ini->eaddr;
}