tech-net archive

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

sendmsg(2) with IP_PKTINFO



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?

Thanks,

--
ryo shimiz


Home | Main Index | Thread Index | Old Index