Re: git: d195b3783fa4 - main - sctp: fix socket type created by sctp_peeloff()
- In reply to: Gleb Smirnoff : "Re: git: d195b3783fa4 - main - sctp: fix socket type created by sctp_peeloff()"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Feb 2026 10:26:52 UTC
> On 4. Feb 2026, at 23:37, Gleb Smirnoff <glebius@FreeBSD.org> wrote:
>
> On Tue, Feb 03, 2026 at 08:24:10PM +0100, Michael Tuexen wrote:
> M> > M> VNET_ASSERT(head->so_vnet != NULL, ("%s:%d so_vnet is NULL, head=%p",
> M> > M> __func__, __LINE__, head));
> M> > M> + KASSERT(head->so_type == SOCK_SEQPACKET,
> M> > M> + ("%s: unexpecte so_type: %d", __func__, head->so_type));
> M> > M> so = soalloc(head->so_vnet);
> M> > M> if (so == NULL) {
> M> > M> log(LOG_DEBUG, "%s: pcb %p: New socket allocation failure: "
> M> > M> @@ -1311,7 +1313,7 @@ sopeeloff(struct socket *head)
> M> > M> __func__, head->so_pcb);
> M> > M> return (NULL);
> M> > M> }
> M> > M> - so->so_type = head->so_type;
> M> > M> + so->so_type = SOCK_STREAM;
> M> > M> so->so_options = head->so_options;
> M> > M> so->so_linger = head->so_linger;
> M> > M> so->so_state = (head->so_state & SS_NBIO) | SS_ISCONNECTED;
> M> >
> M> > This creates a socket where:
> M> >
> M> > so->so_type != so->so_proto->pr_type.
> M> >
> M> > I'm not sure this is a good idea. I was actually looking into removing so_type
> M> > at all. What does SCTP idea is about this peel-off thing? If the resulting
> M> > socket is a stream one, shouldn't its so_proto point at sctp_stream_protosw?
> M> Yes, that makes sense.
> M> But this is now a generic routine (I think it was an SCTP specific one in the past),
> M> how can I refer to it without using sctp_stream_protosw?
>
> It was never generic, albeit put into generic file. It lives under #ifdef
> SCTP. I'm all for moving it entirely into SCTP related file.
OK. Let me see how to fix it.
Best regards
Michael
>
> --
> Gleb Smirnoff