diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-09-20 14:12:42 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-09-25 19:03:15 +0200 |
commit | b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e (patch) | |
tree | c57094e2bcf7af6b04e05dd3e386c18fcf7b95ae /fwd.c | |
parent | 204e77cd11b2df720c9acd35d562e1ed868304b4 (diff) | |
download | passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar.gz passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar.bz2 passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar.lz passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar.xz passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.tar.zst passt-b8d4fac6a2e77a93d9b0d291cd1ca803a29f890e.zip |
util, pif: Replace sock_l4() with pif_sock_l4()
The sock_l4() function is very convenient for creating sockets bound to
a given address, but its interface has some problems.
Most importantly, the address and port alone aren't enough in some cases.
For link-local addresses (at least) we also need the pif in order to
properly construct a socket adddress. This case doesn't yet arise, but
it might cause us trouble in future.
Additionally, sock_l4() can take AF_UNSPEC with the special meaning that it
should attempt to create a "dual stack" socket which will respond to both
IPv4 and IPv6 traffic. This only makes sense if there is no specific
address given. We verify this at runtime, but it would be nicer if we
could enforce it structurally.
For sockets associated specifically with a single flow we already replaced
sock_l4() with flowside_sock_l4() which avoids those problems. Now,
replace all the remaining users with a new pif_sock_l4() which also takes
an explicit pif.
The new function takes the address as an inany *, with NULL indicating the
dual stack case. This does add some complexity in some of the callers,
however future planned cleanups should make this go away again.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'fwd.c')
0 files changed, 0 insertions, 0 deletions