improve new code selecting connection target by bindaddr family
commit2702f853e144430743aa9919aedd6c20bdf7ea5a
authorrofl0r <rofl0r@users.noreply.github.com>
Mon, 13 Dec 2021 12:35:05 +0000 (13 12:35 +0000)
committerrofl0r <rofl0r@users.noreply.github.com>
Mon, 13 Dec 2021 12:48:19 +0000 (13 12:48 +0000)
treea9bc01e5e62bbcc8b6a57eff2f593f52df1eb205
parent6ecc398072abf792088af2c90fc7252c05d7c94a
improve new code selecting connection target by bindaddr family

the code added in 6ecc398072abf792088af2c90fc7252c05d7c94a was modified to

- better match the rest of codestyle
- don't print gratuitous warning if no matching addrinfo record was found
- always select outgoing socket type according to first addrinfo result,
  like in the past, rather than enforcing the af of bindaddr even if no
  matching record exists.
- only call bind() if the selected addrinfo record matches the bind addr

as a sideeffect of the latter, bind() will no longer be called when there's
no DNS record matching the address family of the bindaddr, which means the
connection will use the system default route for the target.
whether this aligns with user's expectations remain to be seen, but imo
it's preferable to make the connection work rather than enforcing that no
packet goes out on another interface than the one specified via bind addr.
sockssrv.c