diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-10-12 16:48:52 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-10-15 02:10:36 +0200 |
commit | 6f3e38cac5c23dcd2dd6649132f0c55bac331f2e (patch) | |
tree | 0fdb140627201155084a306775a885321284bef7 /netlink.c | |
parent | d0dd0242a69f4ae5be4f46030bf321eb6867b2f8 (diff) | |
download | passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar.gz passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar.bz2 passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar.lz passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar.xz passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.tar.zst passt-6f3e38cac5c23dcd2dd6649132f0c55bac331f2e.zip |
Don't create 'tap' socket for ports that are bound to loopback only
If the user specifies an explicit loopback address for a port
binding, we're going to use that address for the 'tap' socket, and
the same exact address for the 'spliced' socket (because those are,
by definition, only bound to loopback addresses).
This means that the second binding will fail, and, unexpectedly, the
port is forwarded, but via tap device, which means the source address
in the namespace won't be a loopback address.
Make it explicit under which conditions we're creating which kind of
socket, by refactoring tcp_sock_init() into two separate functions
for IPv4 and IPv6 and gathering those conditions at the beginning.
Also, don't create spliced sockets if the user specifies explicitly
a non-loopback address, those are harmless but not desired either.
Fixes: 3c6ae625101a ("conf, tcp, udp: Allow address specification for forwarded ports")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'netlink.c')
0 files changed, 0 insertions, 0 deletions