diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-08-21 14:20:19 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-08-21 12:00:40 +0200 |
commit | 57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53 (patch) | |
tree | a15f5320b134c31902a597f7f0348ee2b5b468b4 /passt.h | |
parent | 8436c0d61b3a0443df12fa7b2c928932ba202ba6 (diff) | |
download | passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar.gz passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar.bz2 passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar.lz passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar.xz passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.tar.zst passt-57b7bd2a48a1dc5c87f4db51f7bf439cc84fcd53.zip |
fwd, conf: Allow NAT of the guest's assigned address
The guest is usually assigned one of the host's IP addresses. That means
it can't access the host itself via its usual address. The
--map-host-loopback option (enabled by default with the gateway address)
allows the guest to contact the host. However, connections forwarded this
way appear on the host to have originated from the loopback interface,
which isn't always desirable.
Add a new --map-guest-addr option, which acts similarly but forwarded
connections will go to the host's external address, instead of loopback.
If '-a' is used, so the guest's address is not the same as the host's, this
will instead forward to whatever host-visible site is shadowed by the
guest's assigned address.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.h')
-rw-r--r-- | passt.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -104,6 +104,8 @@ enum passt_modes { * @guest_gw: IPv4 gateway as seen by the guest * @map_host_loopback: Outbound connections to this address are NATted to the * host's 127.0.0.1 + * @map_guest_addr: Outbound connections to this address are NATted to the + * guest's assigned address * @dns: DNS addresses for DHCP, zero-terminated * @dns_match: Forward DNS query if sent to this address * @our_tap_addr: IPv4 address for passt's use on tap @@ -120,6 +122,7 @@ struct ip4_ctx { int prefix_len; struct in_addr guest_gw; struct in_addr map_host_loopback; + struct in_addr map_guest_addr; struct in_addr dns[MAXNS + 1]; struct in_addr dns_match; struct in_addr our_tap_addr; @@ -142,6 +145,8 @@ struct ip4_ctx { * @guest_gw: IPv6 gateway as seen by the guest * @map_host_loopback: Outbound connections to this address are NATted to the * host's [::1] + * @map_guest_addr: Outbound connections to this address are NATted to the + * guest's assigned address * @dns: DNS addresses for DHCPv6 and NDP, zero-terminated * @dns_match: Forward DNS query if sent to this address * @our_tap_ll: Link-local IPv6 address for passt's use on tap @@ -158,6 +163,7 @@ struct ip6_ctx { struct in6_addr addr_ll_seen; struct in6_addr guest_gw; struct in6_addr map_host_loopback; + struct in6_addr map_guest_addr; struct in6_addr dns[MAXNS + 1]; struct in6_addr dns_match; struct in6_addr our_tap_ll; |