Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Oct 2020 12:13:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 250366] [tcp] The ioctl of socket fd should return -1 after listen to avoid misusing.
Message-ID:  <bug-250366-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D250366

            Bug ID: 250366
           Summary: [tcp] The ioctl of socket fd should return -1 after
                    listen to avoid misusing.
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: yonghaoz1994@gmail.com

The ioctl of socket fd should return -1 after listen to avoid misusing.

```
0   socket(..., SOCK_STREAM, IPPROTO_TCP) =3D 3
+0  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) =3D 0
+0.1 ioctl(3, SIOCINQ, [0]) =3D 0

+0  bind(3, ..., ...) =3D 0
+0.1 ioctl(3, SIOCINQ, [0]) =3D 0

+0  listen(3, 1) =3D 0
+0  < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 ~ +1  > S. 0:0(0) ack 1 <...>

+.1 < . 1:1(0) ack 1 win 32792
+0.1  accept(3, ..., ...) =3D 4

+0 < . 1:41(40) ack 1 win 28273=20

+0.1 ioctl(4, FIONREAD, [40]) =3D 0
+0.1 ioctl(3, FIONREAD, [0]) =3D -1 // f-stack/FreeBSD return 0 here
```

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-250366-227>