* [PATCH net v3 0/2] gre: fix lwtunnel support
@ 2016-04-27 9:29 Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 1/2] gre: do not assign header_ops in collect metadata mode Jiri Benc
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiri Benc @ 2016-04-27 9:29 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, Thomas Graf, Simon Horman
This patchset fixes a few bugs in ipgre metadata mode implementation.
As an example, in this setup:
ip a a 192.168.1.1/24 dev eth0
ip l a gre1 type gre external
ip l s gre1 up
ip a a 192.168.99.1/24 dev gre1
ip r a 192.168.99.2/32 encap ip dst 192.168.1.2 ttl 10 dev gre1
ping 192.168.99.2
the traffic does not go through before this patchset and does as expected
with it applied.
v3: Back to v1 in order not to break existing users. Dropped patch 3, will
be fixed in iproute2 instead.
v2: Rejecting invalid configuration, added patch 3, dropped patch for
ETH_P_TEB (will target net-next).
Jiri Benc (2):
gre: do not assign header_ops in collect metadata mode
gre: build header correctly for collect metadata tunnels
net/ipv4/ip_gre.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net v3 1/2] gre: do not assign header_ops in collect metadata mode
2016-04-27 9:29 [PATCH net v3 0/2] gre: fix lwtunnel support Jiri Benc
@ 2016-04-27 9:29 ` Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 2/2] gre: build header correctly for collect metadata tunnels Jiri Benc
2016-04-28 21:03 ` [PATCH net v3 0/2] gre: fix lwtunnel support David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2016-04-27 9:29 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, Thomas Graf, Simon Horman
In ipgre mode (i.e. not gretap) with collect metadata flag set, the tunnel
is incorrectly assumed to be mGRE in NBMA mode (see commit 6a5f44d7a048c).
This is not the case, we're controlling the encapsulation addresses by
lwtunnel metadata. And anyway, assigning dev->header_ops in collect metadata
mode does not make sense.
Although it would be more user firendly to reject requests that specify
both the collect metadata flag and a remote/local IP address, this would
break current users of gretap or introduce ugly code and differences in
handling ipgre and gretap configuration. Keep the current behavior of
remote/local IP address being ignored in such case.
v3: Back to v1, added explanation paragraph.
v2: Reject configuration specifying both remote/local address and collect
metadata flag.
Fixes: 2e15ea390e6f4 ("ip_gre: Add support to collect tunnel metadata.")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
net/ipv4/ip_gre.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index af5d1f38217f..d0abde4236af 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -893,7 +893,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
netif_keep_dst(dev);
dev->addr_len = 4;
- if (iph->daddr) {
+ if (iph->daddr && !tunnel->collect_md) {
#ifdef CONFIG_NET_IPGRE_BROADCAST
if (ipv4_is_multicast(iph->daddr)) {
if (!iph->saddr)
@@ -902,8 +902,9 @@ static int ipgre_tunnel_init(struct net_device *dev)
dev->header_ops = &ipgre_header_ops;
}
#endif
- } else
+ } else if (!tunnel->collect_md) {
dev->header_ops = &ipgre_header_ops;
+ }
return ip_tunnel_init(dev);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net v3 2/2] gre: build header correctly for collect metadata tunnels
2016-04-27 9:29 [PATCH net v3 0/2] gre: fix lwtunnel support Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 1/2] gre: do not assign header_ops in collect metadata mode Jiri Benc
@ 2016-04-27 9:29 ` Jiri Benc
2016-04-28 21:03 ` [PATCH net v3 0/2] gre: fix lwtunnel support David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2016-04-27 9:29 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, Thomas Graf, Simon Horman
In ipgre (i.e. not gretap) + collect metadata mode, the skb was assumed to
contain Ethernet header and was encapsulated as ETH_P_TEB. This is not the
case, the interface is ARPHRD_IPGRE and the protocol to be used for
encapsulation is skb->protocol.
Fixes: 2e15ea390e6f4 ("ip_gre: Add support to collect tunnel metadata.")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
v3: unchanged
v2: unchanged
---
net/ipv4/ip_gre.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index d0abde4236af..f973e0a58993 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -523,7 +523,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb,
return ip_route_output_key(net, fl);
}
-static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
+static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
+ __be16 proto)
{
struct ip_tunnel_info *tun_info;
const struct ip_tunnel_key *key;
@@ -575,7 +576,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
}
flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
- build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB),
+ build_header(skb, tunnel_hlen, flags, proto,
tunnel_id_to_key(tun_info->key.tun_id), 0);
df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -616,7 +617,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
const struct iphdr *tnl_params;
if (tunnel->collect_md) {
- gre_fb_xmit(skb, dev);
+ gre_fb_xmit(skb, dev, skb->protocol);
return NETDEV_TX_OK;
}
@@ -660,7 +661,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
struct ip_tunnel *tunnel = netdev_priv(dev);
if (tunnel->collect_md) {
- gre_fb_xmit(skb, dev);
+ gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
return NETDEV_TX_OK;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v3 0/2] gre: fix lwtunnel support
2016-04-27 9:29 [PATCH net v3 0/2] gre: fix lwtunnel support Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 1/2] gre: do not assign header_ops in collect metadata mode Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 2/2] gre: build header correctly for collect metadata tunnels Jiri Benc
@ 2016-04-28 21:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-04-28 21:03 UTC (permalink / raw)
To: jbenc; +Cc: netdev, pshelar, tgraf, simon.horman
From: Jiri Benc <jbenc@redhat.com>
Date: Wed, 27 Apr 2016 11:29:05 +0200
> This patchset fixes a few bugs in ipgre metadata mode implementation.
>
> As an example, in this setup:
>
> ip a a 192.168.1.1/24 dev eth0
> ip l a gre1 type gre external
> ip l s gre1 up
> ip a a 192.168.99.1/24 dev gre1
> ip r a 192.168.99.2/32 encap ip dst 192.168.1.2 ttl 10 dev gre1
> ping 192.168.99.2
>
> the traffic does not go through before this patchset and does as expected
> with it applied.
>
> v3: Back to v1 in order not to break existing users. Dropped patch 3, will
> be fixed in iproute2 instead.
> v2: Rejecting invalid configuration, added patch 3, dropped patch for
> ETH_P_TEB (will target net-next).
Series applied, thanks Jiri.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-28 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 9:29 [PATCH net v3 0/2] gre: fix lwtunnel support Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 1/2] gre: do not assign header_ops in collect metadata mode Jiri Benc
2016-04-27 9:29 ` [PATCH net v3 2/2] gre: build header correctly for collect metadata tunnels Jiri Benc
2016-04-28 21:03 ` [PATCH net v3 0/2] gre: fix lwtunnel support David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.