Re: [PATCH net 3/3] gre: receive also TEB packets for lwtunnels

pravin shelar
2016-04-22T21:13:58Z

On Fri, Apr 22, 2016 at 10:44 AM, Jiri Benc <jbenc@redhat.com> wrote:
> For ipgre interfaces in collect metadata mode, receive also traffic with
> encapsulated Ethernet headers. The lwtunnel users are supposed to sort this
> out correctly. This allows to have mixed Ethernet + L3-only traffic on the
> same lwtunnel interface.
>
How user is suppose to sort out the type of packet? whether it is L2 or L3.

> To keep backwards compatibility and prevent any surprises, gretap interfaces
> have priority in receiving packets with Ethernet headers.
>
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
> ---
> include/net/ip_tunnels.h | 1 +
> net/ipv4/ip_gre.c | 34 +++++++++++++++++++++++++---------
> 2 files changed, 26 insertions(+), 9 deletions(-)
>

...

> +
> +static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
> +{
> + struct net *net = dev_net(skb->dev);
> + struct ip_tunnel_net *itn;
> + int res;
> +
> + if (tpi->proto == htons(ETH_P_TEB))
> + itn = net_generic(net, gre_tap_net_id);
> + else
> + itn = net_generic(net, ipgre_net_id);
> +
> + res = __ipgre_rcv(skb, tpi, itn);
> + if (res == PACKET_NEXT && tpi->proto == htons(ETH_P_TEB)) {
> + /* ipgre tunnels in collect metadata mode should receive
> + * also ETH_P_TEB traffic
> + */
> + itn = net_generic(net, ipgre_net_id);
> + res = __ipgre_rcv(skb, tpi, int);

Is it fine to receive L2 packet over L3 device?
At least ip_tunnel_rcv() is not ready to handle such packet.