tech-net archive

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

Re: sendmsg(2) with IP_PKTINFO



>In article <20170725055344.7D3621CC0B4%yaml.nerv.org@localhost>,
>Ryo Shimizu  <ryo%nerv.org@localhost> wrote:
>>
>>Hi,
>>
>>I implemented IP_PKTINFO for sendmsg(2). For recvmsg(2) IP_PKTINFO is already
>>supported, but it is not supported for sending. This causes problems
>>described in https://mail-index.netbsd.org/tech-net/2013/09/22/msg004252.html
>>
>>patch is here.
>>     http://www.netbsd.org/~ryo/ip_pktinfo.patch
>>  or https://github.com/ryo/netbsd-src/compare/master...ip_pktinfo
>>
>>summary of patch:
>> - udp_output()
>>    - process IP_PKTINFO in cmsg
>>    - specified ip_pktinfo->ipi_addr, check the address is bindable, and use it.
>>    - specified ip_pktinfo->ipi_ifindex, pick up an address from the interface,
>>      and IP_ROUTETOIFINDEX flag and imo.imo_multicast_if_index are passed to
>>      ip_output() to output from the interface. Multicast already has similar
>>      function, therefore I used ip_moptions argument for specifying ifindex.
>>
>> - rip_output()
>>    - just about same as udp_output() except checking pcb.
>>
>> - ip_output()
>>    - if IP_ROUTETOIFINDEX is set, checking that whether packets can be output
>>      from the specified interface. loopback, p2p interface, or direct address
>>      are ok. Otherwise, checking that the destination address has a gateway
>>      address on the interface.
>>
>>
>>any comment? or ok to commit?
>
>Why don't you share the code in udp_output and rip_output?
>Otherwise LGTM.

Thank you for your advice.
I revised to add new function ip_pktopts() for processing control messages.

latest patch is here:
     http://www.netbsd.org/~ryo/ip_pktinfo.patch2.diff
  or https://github.com/ryo/netbsd-src/compare/master...ip_pktinfo

If there is no problem, I'll commit next week.

--
ryo shimizu


Home | Main Index | Thread Index | Old Index