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-next>] [day] [month] [year] [list]
Message-ID: <4E42B886.4030607@netapp.com>
Date:	Wed, 10 Aug 2011 22:27:42 +0530
From:	Sreeram B S <sreeramb@...app.com>
To:	linux-kernel@...r.kernel.org
Subject: UDP requires 2 reads to obtain vital information - Kindly comment

Respected people,
    I am Sreeram. I work on TCP/IP network applications.
    This mail is regarding UDP.
    Whenever a UDP datagram arrives, the receiver may wish to know the
sender's IP address and also the destination address of that datagram.
The recvfrom() function will return the sender's IP address. If the
destination address of the datagram is required, then the user has to
set the IP_PKTINFO socket option for the UDP socket and get the
address as ancillary data in recvmsg(). So, the point here is that the
user has to issue 2 reads on the same datagram (with the flag MSG_PEEK
in first read call enabled) in order to obtain the sender's IP and the
destination IP of the datagram. I personally feel that there should be
a way provided to the user to obtain these values in a single read
call. By doing this I am sure that lot of time would be saved in
collecting the required information.
    I have written a simple UDP client program to show that we need 2
reads to obtain the above information. I have made it signal-driven
just to make it interesting and not for any other reason. I have
attached the client program along with this mail.
    Fortunately, as mentioned above, Linux provides the IP_PKTINFO
socket option, enabling which, will send in a structure 'struct
in_pktinfo' as ancillary data in recvmsg(). The structure is as
follows:

                  struct in_pktinfo {
                      unsigned int   ipi_ifindex;  /* Interface index */
                      struct in_addr ipi_spec_dst; /* Local address */
                      struct in_addr ipi_addr;     /* Header Destination
                                                      address */
                  };

    Would it be incorrect if I request the kernel coders to add the
sender's IP address as well in this structure, so that the user will
get both the sender's IP and the destination IP address of the
datagram in a single call to recvmsg()?
    I very well understand that my knowledge is very much diminished.
Hence I request you to kindly correct me if what I have
understood/suggested is incorrect.
Please suggest.

Regards,
Sreeram

View attachment "sigioserv.c" of type "text/plain" (4825 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ