Page MenuHomeFreeBSD

Fix inheritance of IPv6 options
ClosedPublic

Authored by tuexen on Aug 18 2018, 4:42 PM.

Details

Summary

Fix the inheritance of IPv6 options from the listening socket. It should depend on whether the listener was created as an PF_INET6or not, not whether it used for an IPv6 connection or not. The difference is when using IPv4-mapped IPv6 addresses.

Test Plan

Get the following packetdrill script passing:

--ip_version=ipv4_mapped_ipv6

 0.00 `sysctl -w net.inet.tcp.hostcache.purgenow=1`
+0.00 `sysctl -w net.inet.tcp.syncookies_only=0`
+0.00 `sysctl -w net.inet.tcp.syncookies=1`
+0.00 `sysctl -w net.inet.tcp.rfc1323=1`
+0.00 `sysctl -w net.inet.tcp.sack.enable=1`
+0.00 `sysctl -w net.inet.tcp.ecn.enable=2`

+0.00 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0.00 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.00 setsockopt(3, IPPROTO_IPV6, IPV6_V6ONLY, [0], 4) = 0
+0.00 setsockopt(3, IPPROTO_IPV6, IPV6_USE_MIN_MTU, [1], 4) = 0
+0.00 bind(3, ..., ...) = 0
+0.00 listen(3, 1) = 0
+0.10 < S  0:0(0)       win 65535 <mss 1460,sackOK,eol,eol>
+0.00 > S. 0:0(0) ack 1 win 65535 <mss 1460,sackOK,eol,eol>
+0.10 < .  1:1(0) ack 1 win 65535
+0.00 accept(3, ..., ...) = 4
+0.00 close(3) = 0
+0.00 getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+0.00 getsockopt(4, IPPROTO_IPV6, IPV6_USE_MIN_MTU, [1], [4]) = 0
+0.00 getsockopt(4, IPPROTO_TCP, TCP_MAXSEG, [1460], [4]) = 0
+0.10 < F. 1:1(0) ack 1 win 65535
+0.00 >  . 1:1(0) ack 2 win 65535
+0.00 close(4) = 0
+0.00 > F. 1:1(0) ack 2 win 65535
+0.05 <  . 2:2(0) ack 2 win 65535

Without this patch it fails, since -1 is returned as optval in the IPV6_USE_MIN_MTU getsocktop() call.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

tuexen created this revision.Aug 18 2018, 4:42 PM
bz accepted this revision as: bz.Aug 20 2018, 8:25 PM

LGTM

rrs accepted this revision.Aug 21 2018, 1:22 PM
This revision is now accepted and ready to land.Aug 21 2018, 1:22 PM
This revision was automatically updated to reflect the committed changes.