From: Alexander Bluhm Subject: Re: raw IPv6 in parallel To: Vitaliy Makkoveev Cc: tech@openbsd.org Date: Tue, 16 Apr 2024 00:19:42 +0200 On Tue, Apr 16, 2024 at 01:03:37AM +0300, Vitaliy Makkoveev wrote: > > On 16 Apr 2024, at 00:25, Alexander Bluhm wrote: > > > > Hi, > > > > This diff brings rip6_input() in line with shared net lock rip6_input(). > > > > The fields inp_icmp6filt and inp_cksum6 are protected by exclusive > > net lock. I have a follow up diff to tune them and document this. > > > > IPv4 function rip_disconnect() calls soisdisconnected() and I think > > IPv6 should do this, too. > > > > Other BSDs are confusing. NetBSD rip_disconnect() calls > > soisdisconnected(), but rip6_disconnect() only clears SS_ISCONNECTED. > > FreeBSD rip_disconnect() clears SS_ISCONNECTED, but rip6_disconnect() > > calls soisdisconnected(), so it is the other way around. > > > > Consistent would be to always call soisdisconnected(). The reuslt > > is that SS_CANTRCVMORE and SS_CANTSENDMORE are set and subsequent > > read and write result in EOF or EPIPE. > > > > 4.4BSD allows reconnect for UDP, but not for raw IP. I think we > > should use the same behavior for IPv6. > > > > ok? > > > > ok mvs > > soisdisconnected() awakes sleeping threads polling threads. This is > better, because otherwise userland program continues to sleep and > SS_ flag modification has no sense. > > unix(4) sockets have the same problem in unp_detach(). We clean > SS_ISCONNECTED and set so_error on disconnected peer, but don???t awake > it???s sleeping threads. soconnect() has this comment: /* * If protocol is connection-based, can only connect once. * Otherwise, if connected, try to disconnect first. * This allows user to disconnect by connecting to, e.g., * a null address. */ if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) && ((so->so_proto->pr_flags & PR_CONNREQUIRED) || (error = sodisconnect(so)))) error = EISCONN; else error = pru_connect(so, nam); It looks like the intension is to connect -> disconnect -> connect again. If userland is doing this, of course it must not sleep. The disconnect call is synchronous from userland. I am not aware of any program doing this. For UDP it might work, but I have not tested it. Anyway, we do not need it for raw IP. bluhm