Message ID | 20160428064915.GA29503@penelope.isobedori.kobe.vergenet.net |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 28 Apr 2016 16:49:19 +1000, Simon Horman wrote: > I have had some success wiring up Open vSwitch to use this patch for > transmit. However, I am wondering if something more is needed to allow > differentiation between packets with and without an L2 header present > on receive. The problem, as Pravin pointed out, is the patch does not correctly set skb->protocol to ETH_P_TEB because of special handling of ETH_P_TEB in iptunnel_pull_header. This will be fixed in v2 of the patch. No flag will be needed then, just use skb->protocol. Jiri
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index d916b4315903..cdf71ced429e 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -58,6 +58,12 @@ struct ip_tunnel_key { /* Flags for ip_tunnel_info mode. */ #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ +#define IP_TUNNEL_INFO_L2_PRESENT 0x04 /* Set on receive by tunnels that + * may receive packets both with + * and without an L2 header present + * when a packet is received with + * L2 header present. + */ /* Maximum tunnel options length. */ #define IP_TUNNEL_OPTS_MAX \ diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 0a4af2896a15..1290695fbc95 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -401,6 +401,9 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi, tun_dst = ip_tun_rx_dst(skb, flags, tun_id, 0); if (!tun_dst) return PACKET_REJECT; + if (tpi->proto == htons(ETH_P_TEB)) + tun_dst->u.tun_info.mode |= + IP_TUNNEL_INFO_L2_PRESENT; } ip_tunnel_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error);