using ancillary data (control information) when sending packets witha UDP socket

Discussion in 'Linux Networking' started by wkevin, Aug 26, 2013.

  1. wkevin

    wkevin Guest

    Hello,
    It is possible to set ancillary data (control information) in the msghdr object when sending data with a UDP packet with the sendmsg() system call.

    Can someone give an example when this is used?

    regards,
    Kevin
     
    wkevin, Aug 26, 2013
    #1
    1. Advertisements

  2. See ‘man 7 ip’.
     
    Richard Kettlewell, Aug 26, 2013
    #2
    1. Advertisements

  3. wkevin

    wkevin Guest

    Thanks, Richard

    looking in man 7 ip:
    http://man7.org/linux/man-pages/man7/ip.7.html


    It seems to me that only the IP_PKTINFO is relevant.
    and it can be used, for example, to set an IP address that is used as the source IP when packets are sent out when using a UDP socket.

    The others options are not relavant/not ancillary:
    IP_RECVERR - for recvmsg()

    IP_RECVOPTS - not ancillary
    (setsockopt (sock, IPPROTO_IP, IP_RECVOPTS, (char *)&on,
    IP_RECVORIGDSTADDR - recvmsg
    IP_RECVTOS - incoming packets.
    IP_RECVTTL
    IP_RETOPTS
    IP_ROUTER_ALERT - Only valid for raw sockets
    IP_TOS,IP_TRANSPARENT,IP_TTL,IP_UNBLOCK_SOURCE - not ancillary

    Am I right about it ?

    regards,
    Kevin
     
    wkevin, Aug 26, 2013
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.