diff options
author | Doug Evans <dje@google.com> | 2021-02-16 12:27:37 -0800 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2021-02-16 12:27:37 -0800 |
commit | b55df476b438c2c55108f8e3f86e9490545e403d (patch) | |
tree | fc693c08f8cd25be360a37d34ecf89d845aa67fc /src | |
parent | 5aa333e79b9892af9bf9621435d52cd058544d18 (diff) | |
download | slirp-b55df476b438c2c55108f8e3f86e9490545e403d.zip slirp-b55df476b438c2c55108f8e3f86e9490545e403d.tar.gz slirp-b55df476b438c2c55108f8e3f86e9490545e403d.tar.bz2 |
Reject host forwarding to ipv6 "addr-any"
Libslirp currently only provides a stateless DHCPv6 server,
and thus can't do the "addr-any -> guest IP address" translation
that is done for ipv4. Until a stateful DHCPv6 server is available,
reject addr-any.
Signed-off-by: Doug Evans <dje@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/slirp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/slirp.c b/src/slirp.c index e920b43..c04d645 100644 --- a/src/slirp.c +++ b/src/slirp.c @@ -1165,6 +1165,14 @@ int slirp_add_ipv6_hostfwd(Slirp *slirp, int is_udp, struct in6_addr host_addr, int host_port, struct in6_addr guest_addr, int guest_port) { + /* + * Libslirp currently only provides a stateless DHCPv6 server, thus we + * can't translate "addr-any" to the guest. Instead, for now, reject it. + */ + if (in6_zero(&guest_addr)) { + return -1; + } + if (is_udp) { if (!udp6_listen(slirp, host_addr, htons(host_port), guest_addr, htons(guest_port), SS_HOSTFWD)) |