Reject IPv4 SO_REUSEPORT_LB groups when looking up an IPv6 listening socket

Similar to how the IPv4 code will reject an IPv6 LB group,
we must ignore IPv4 LB groups when looking up an IPv6
listening socket.   If this is not done, a port only match
may return an IPv4 socket, which causes problems (like
sending IPv6 packets with a hopcount of 0, making them unrouteable).

Thanks to rrs for all the work to diagnose this.

Approved by:	re (rgrimes)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D16899
This commit is contained in:
Andrew Gallatin 2018-08-27 18:13:20 +00:00
parent d81347652c
commit 4b82a7b62f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338341

View File

@ -901,6 +901,10 @@ in6_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo,
* - Load balanced does not contain IPv4 mapped INET6 wild sockets.
*/
LIST_FOREACH(grp, hdr, il_list) {
#ifdef INET
if (!(grp->il_vflag & INP_IPV6))
continue;
#endif
if (grp->il_lport == lport) {
idx = 0;
int pkt_hash = INP_PCBLBGROUP_PKTHASH(