Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Aug 2016 16:42:44 +0100
From:      Bruce Simpson <bms@fastmail.net>
To:        Ryan Stone <rysto32@gmail.com>
Cc:        Ryan Stone <rstone@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r304436 - in head: . sys/netinet
Message-ID:  <6f4449f2-d145-8b49-c3f0-433e8ff4d2a2@fastmail.net>
In-Reply-To: <CAFMmRNwDPy4Hd35DrfREZQzjvd89qw=zhEriddG8U8NV7tD=EA@mail.gmail.com>
References:  <201608182259.u7IMx5oW002018@repo.freebsd.org> <4fbc2e1d-3a62-5963-83d5-f9c931503e51@fastmail.net> <3806700d-ed27-7915-4818-c2d64f7b806d@fastmail.net> <CAFMmRNyi=PwE9pc9_8wCU63=HttUzFR4Zh2v=uHKcQ-zaLxdJQ@mail.gmail.com> <fcb33eac-ec99-03c7-57b5-f24f86c4f41a@fastmail.net> <CAFMmRNwDPy4Hd35DrfREZQzjvd89qw=zhEriddG8U8NV7tD=EA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6f4449f2-d145-8b49-c3f0-433e8ff4d2a2>