svn commit: r304436 - in head: . sys/netinet

Bruce Simpson bms at fastmail.net
Sat Aug 20 15:42:55 UTC 2016


On 20/08/16 16:27, Ryan Stone wrote:
> Can you send a broadcast packet through an L3 tunnel?  I thought that a
> L2 tunnel was required.

Yes. This is perfectly legal and necessary for forwarding of IPv4 
broadcasts to work. (it is Internet Protocol after all, not 
Infernal-ethernet-extension Protocol. ;-))

The change is in UDP input so it will not affect routers. But if a 
FreeBSD system were at the end of a link layer, and was the final 
recipient of the IPv4 broadcast packet, then if that link layer is not 
Ethernet, all bets are off.

That situation could occur very easily where FreeBSD is hanging off the 
end of a PPPoE link: e.g. consumer DSL, microwave, etc.

The underlying link layer for the tunnel might be Ethernet, but it will 
be demuxed as a PPP tunnel. PPP is treated as a bit pipe and does not 
normally distinguish between unicast, broadcast, multicast.

Broadcast destined for the host on its PPP address would be transported 
inside the tunnel, encapsulated as a normal unicast Ethernet packet.

>     But this mbuf flag is not guaranteed to be set in all situations;
>     e.g. where the link layer does not have the concept of broadcast
>     being distinct from other kinds of network traffic. PPP and ATM are
>     the most obvious examples.
>
>
> We don't support ATM, but PPP is a good example.  I hadn't thought of
> that.  Hm, ip_input() already has to check for a broadcast IP.  What it
> set M_BCAST on the mbuf at that time?

ATM is one of those things everyone kind of has to support by default in 
some way because of the ITU ADSL specs. It is literally written into 
G.992.x.

Linux can do it, FreeBSD can't. PPP over ATM is something BT inflicted 
on the UK all by themselves, though, and we wish it would just go away.

Whilst your suggestion may work, it may be dangerous, as you are then 
stepping on the meaning of the flags. Some of them are intended to be 
used for one layer to signal another.

M_BCAST is pretty rigidly defined in mbuf.h as "The link layer received 
this as a broadcast / I intended for link layer to send this as a 
broadcast". M_PROTOFLAGS is normally used to clear flags with different 
meaning in different protocol layers.

M_MCAST also has similar status. On my PhD, I wrote code which uses a 
private Ethernet link between FreeBSD routers for load distribution; it 
distributes unicast traffic using IPv6 multicast.

It uses multicast both as convenience, and as a way to 'channelise' 
traffic if the Ethernet link supports it, using multicast groups. 
(Modern shared memory switches can slice L2 multicast traffic like this 
quite efficiently. So one slice of unicast traffic could be switched 
across locations purely at L2. However, the distribution of actual IPv6 
multicast was out of scope.)

The routers have to very carefully clear M_MCAST on egress, to ensure 
normal L2 next-hop resolution for IPv6 destinations.



More information about the svn-src-all mailing list