lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [task #14247] socket API: implement recvmsg msg_control sup


From: Joel Cunningham
Subject: [lwip-devel] [task #14247] socket API: implement recvmsg msg_control support
Date: Sat, 15 Apr 2017 13:08:08 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #11, task #14247 (project lwip):

Attached is patch implementing CMSG infrastructure (only for recvmsg) and
IP_PKTINFO socket option (including unit test)

I have a couple of things to discuss about the change, patch contains current
approach:

1. For struct in_pktinfo, I went with the netbsd usage rather than Linux.  My
thoughts here are that Linux has the additional ipi_spec_dst, which I believe
will be set to the source address of the interface that received the packet. 
Since this was going to be an additional lookup once we are outside of the
LwIP core context, it didn't seem necessary.  Applications can still get this
address from the interface index (we can implement SIOCGIFADDR if needed)

2. I re-used the LWIP_NETBUF_RECVINFO feature (rather than create a new
option) to record the destination when the datagram is received, but I made a
modification to the option.  I added a new subset of behavior.  If
LWIP_NETBUF_RECVINFO is 2, the destination and port are only recorded when
IP_PKTINFO is enabled.  This preserves the old API behavior of
LWIP_NETBUF_RECVINFO == 1 and doesn't suffer the performance hit of recording
on every received datagram.  I also enabled the netbuf flags for this case so
we can check that the address was recorded since it's now dependent on
IP_PKTINFO being enabled

3. I added an IP level so_option for PKTINFO (called SOF_PKTINFO).  This
differs a little from the other options because it doesn't directly map from
the SO_ equvialent because IP_PKTINFO if an IP level option.  I didn't see a
better way to record this setting without introducing a separate flag

4. I changed lwip_recvfrom_udp_raw() to take struct msghdr because I need
msg_control, msg_controllen, msg_flags and almost all members of the msghdr
were being passed individually.  This also means that lwip_recvfrom() is more
or less just calling recvmsg because it sets up struct msghdr

Thanks :)

(file #40412)
    _______________________________________________________

Additional Item Attachment:

File name: 0001-sockets-task-14247-add-CMSG-and-IP_PKTINFO.patch Size:15 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?14247>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]