lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ubz52rfdl2i76sotvd3s4thv6jvbfao6zct3sywqus2owlvkx@wpbeqqdvipo4>
Date: Tue, 5 Mar 2024 14:31:48 -0500
From: Oliver Crumrine <ozlinuxc@...il.com>
To: Alejandro Colomar <alx@...nel.org>
Cc: linux-man@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ip.7: Add not supported by SOCK_STREAM to socket options

On Mon, Mar 04, 2024 at 05:15:52PM +0100, Alejandro Colomar wrote:
> Hi Oliver,
> 
> On Sat, Mar 02, 2024 at 01:19:42PM -0500, Oliver Crumrine wrote:
> > It was not made clear in several socket options that they were not
> > supported by SOCK_STREAM; this patch fixes that.
> > 
> > Socket options not supported by SOCK_STREAM are handled in the
> > ip_cmsg_recv_offset function in net/ipv4/ip_sockglue.c. The function is
> > called for udp sockets, and indirectly by ping and raw sockets, but not
> > for TCP sockets, as they don't support these options.
> > 
> > Signed-off-by: Oliver Crumrine <ozlinuxc@...il.com>
> 
> Could you write some small example programs demonstrating that these are
> not supported?  I'd like to check it with a small program, if possible.
> 
> Have a lovely say!
> Alex
> 
Hi Alex,
I have attached two programs in the form of C source code below. No
special compilation options required. To change between the three
different socket options outlined in my patch, there are two options on
line 16 and 18 with a comment above them explaining how to use the
fields.

Here's how to use the programs:
0. Make sure you have netcat installed.
1. Compile the dgram one.
2. Run it.
3. Run nc localhost 8888 -u (in a seperate terminal window or tab)
4. Type whatever into netcat and press enter
5. Observe that there is a control message recieved, and there is a byte
printed, which is the first byte of the data in the control message.
6. You may repeat this for the three different socket options.
7. Repeat for the stream one, but use nc localhost 8888 (without the -u)
for #5.
8. Observe that there are no control messages recieved with the stream one,
and byte is 00, which is the initial value of the variable, before it has
a value assigned when the control messages (of which there are none) are read.

Thanks,
Oliver
> > ---
> >  man7/ip.7 | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/man7/ip.7 b/man7/ip.7
> > index 2b4b06324..104e65feb 100644
> > --- a/man7/ip.7
> > +++ b/man7/ip.7
> > @@ -828,6 +828,9 @@ is not zero, the primary local address of the interface specified by the
> >  index overwrites
> >  .I ipi_spec_dst
> >  for the routing table lookup.
> > +Not supported for
> > +.B SOCK_STREAM
> > +sockets.
> >  .TP
> >  .BR IP_RECVERR " (since Linux 2.2)"
> >  .\" Precisely: since Linux 2.1.15
> > @@ -989,6 +992,9 @@ in which the kernel returns the original destination address
> >  of the datagram being received.
> >  The ancillary message contains a
> >  .IR "struct sockaddr_in" .
> > +Not supported for
> > +.B SOCK_STREAM
> > +sockets.
> >  .TP
> >  .BR IP_RECVTOS " (since Linux 2.2)"
> >  .\" Precisely: since Linux 2.1.68
> > @@ -998,6 +1004,9 @@ ancillary message is passed with incoming packets.
> >  It contains a byte which specifies the Type of Service/Precedence
> >  field of the packet header.
> >  Expects a boolean integer flag.
> > +Not supported for
> > +.B SOCK_STREAM
> > +sockets.
> >  .TP
> >  .BR IP_RECVTTL " (since Linux 2.2)"
> >  .\" Precisely: since Linux 2.1.68
> > -- 
> > 2.44.0
> > 
> 
> -- 
> <https://www.alejandro-colomar.es/>
> Looking for a remote C programming job at the moment.



View attachment "testDgramSocketServer.c" of type "text/plain" (2451 bytes)

View attachment "testStreamSocketServer.c" of type "text/plain" (2625 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ