tech-net archive

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

Re: sendmsg(), IPv4, and ancilliary socket data



Hi,

On Sat, Oct 08, 2016 at 02:30:36PM +0200, Gert Doering wrote:
> What I want to do is: 
> 
>  - have an UDP socket that is bound to INADDR_ANY
>  - receive the destination address for incoming packets via recvmsg()
>    (this works, using IP_RECVDSTADDR setsockopt())
>  - send the reply packet with sendmsg(), ensuring the source address is
>    where the incoming packet was sent to
> 
> I have this working for IPv6, and for IPv4 on "about everything but
> NetBSD"

I've now spent a while trying to understand the kernel paths taken
when this happens, and I think the EINVAL is coming from "udp_send()"
in netinet/udp_usrreq.c, which has this code

        if (control && control->m_len) {
                m_freem(control);
                m_freem(m);
                return EINVAL;
        }

... which very much looks like "in the sendmsg() to IPv4 UDP socket 
path, no control options are supported at all" - so, neither IP_PKTINFO
nor IP_RECVDSTADDR.

Am I misreading this?

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert%greenie.muc.de@localhost
fax: +49-89-35655025                        gert%net.informatik.tu-muenchen.de@localhost


Home | Main Index | Thread Index | Old Index