broadcast oddity

Eygene Ryabinkin rea at freebsd.org
Tue Jul 19 17:25:00 UTC 2011


Tue, Jul 19, 2011 at 10:40:11AM +0300, Daniel Braniss wrote:
> > And that non-broadcast ethernet address is the MAC of your
> > default router?
> yes.

Fine, that is more-or-less expected, since the network subsystem
just routes 255.255.255.255 to the default gateway.  The issue
you're seeing were already seen before,
  http://lists.freebsd.org/pipermail/freebsd-net/2005-October/008626.html
  http://www.freebsd.org/cgi/query-pr.cgi?pr=72468
  http://lists.freebsd.org/pipermail/freebsd-net/2007-January/012874.html [1]
and bms@ told me that in this case the default gateway routing is the
correct historical behaviour of FreeBSD.

[1] I finally remembered that I had seen this issue too ;))

> > What's your routing table (netstat -rn) for the PXE-booted host?
>
> it's ok, same in both cases. it's picked up via DHCP, in the diskless
> case by the boot/loader in the second via dhcpclient.

Still, can you show both of them?

> > You nailed it: you should send packets to the network's broadcast,
> > not to the 0xffffffff.
> > 
> but I'm at the user/ip level!, have no way to set mac/ethernet address.

I meant the IP's network broadcast and by 0xffffffff I meant
255.255.255.255.  Please, look at the posted code.

> still, the question is why it works in one case, and failes in the other.

Yes, it is.  But ip_output.c has the following code,
{{{
                if (rte->rt_flags & RTF_GATEWAY)
                        dst = (struct sockaddr_in *)rte->rt_gateway;
                if (rte->rt_flags & RTF_HOST)
                        isbroadcast = (rte->rt_flags & RTF_BROADCAST);
                else
                        isbroadcast = in_broadcast(dst->sin_addr, ifp);
}}}

So, if the route that is selected is the gateway, then there will be
no broadcast on the L2.  At least in my understanding of the code.
Thus, I am interested in the routing tables and route flags.
-- 
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110719/4dcc2aa8/attachment.pgp


More information about the freebsd-hackers mailing list