IP_SENDSRCADDR & vlan interfaces

Keith Mitchell kmitch at guru.org
Fri Dec 29 07:48:19 PST 2006


Hi,

I've been trying to get the avahi port working on my system and haven't
been able to get it to work.  I've done some debugging of the
application as well as discussed the problem with the maintainer of
avahi.  As a result of the debugging, it appears as though avahi works
just fine when I just have the physical interfaces on the machine
configured.  But, when I use a VLAN trunk and the vlan virtual
interfaces it does not work.

Avahi tries to send out messages on the interfaces with the following
code which seems reasonable:

    memset(&io, 0, sizeof(io));
    io.iov_base = AVAHI_DNS_PACKET_DATA(p);
    io.iov_len = p->size;

    memset(&msg, 0, sizeof(msg));
    msg.msg_name = &sa;
    msg.msg_namelen = sizeof(sa);
    msg.msg_iov = &io;
    msg.msg_iovlen = 1;
    msg.msg_flags = 0;
    msg.msg_control = NULL;
    msg.msg_controllen = 0;

    if (src_address) {
        struct in_addr *addr;

        memset(cmsg_data, 0, sizeof(cmsg_data));
        msg.msg_control = cmsg_data;
        msg.msg_controllen = sizeof(cmsg_data);

        cmsg = CMSG_FIRSTHDR(&msg);
        cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
        cmsg->cmsg_level = IPPROTO_IP;
        cmsg->cmsg_type = IP_SENDSRCADDR;

        addr = (struct in_addr *)CMSG_DATA(cmsg);
        addr->s_addr =  src_address->address;

        msg.msg_controllen = cmsg->cmsg_len;
    }

    return sendmsg_loop(fd, &msg, 0);


The eventually call to sendmsg() does return success but nothing ever
appears on the wire.  I've tried sniffing both on the machine avahi is
running on as well as another machine on the network and nothing ever
goes out.  Is there any known issue with using sendmsg/IP_SENDSRCADDR on
the vlan virtual interfaces (as I mentioned above this works fine when
using physical interfaces and not the vlan psuedo interfaces)?

Thanks.

-- 
Keith Mitchell
Email: kmitch at guru.org		PGP key available upon request




More information about the freebsd-net mailing list