netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] vxlan: do not use fdb in metadata mode
@ 2016-02-16 21:18 Jiri Benc
  2016-02-18  6:32 ` Simon Horman
  2016-02-18 20:01 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Benc @ 2016-02-16 21:18 UTC (permalink / raw)
  To: netdev

In metadata mode, the vxlan interface is not supposed to use the fdb control
plane but an external one (openvswitch or static routes). With the current
code, packets may leak into the fdb handling code which usually causes them
to be dropped anyway but may have strange side effects.

Just drop the packets directly when in metadata mode if the destination data
are not correctly provided on egress.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 drivers/net/vxlan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index db96f3a16f6c..e6944b29588e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2171,9 +2171,11 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif
 	}
 
-	if (vxlan->flags & VXLAN_F_COLLECT_METADATA &&
-	    info && info->mode & IP_TUNNEL_INFO_TX) {
-		vxlan_xmit_one(skb, dev, NULL, false);
+	if (vxlan->flags & VXLAN_F_COLLECT_METADATA) {
+		if (info && info->mode & IP_TUNNEL_INFO_TX)
+			vxlan_xmit_one(skb, dev, NULL, false);
+		else
+			kfree_skb(skb);
 		return NETDEV_TX_OK;
 	}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] vxlan: do not use fdb in metadata mode
  2016-02-16 21:18 [PATCH net] vxlan: do not use fdb in metadata mode Jiri Benc
@ 2016-02-18  6:32 ` Simon Horman
  2016-02-18  9:11   ` Jiri Benc
  2016-02-18 20:01 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2016-02-18  6:32 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev

Hi Jiri,

On Tue, Feb 16, 2016 at 10:18:26PM +0100, Jiri Benc wrote:
> In metadata mode, the vxlan interface is not supposed to use the fdb control
> plane but an external one (openvswitch or static routes). With the current
> code, packets may leak into the fdb handling code which usually causes them
> to be dropped anyway but may have strange side effects.
> 
> Just drop the packets directly when in metadata mode if the destination data
> are not correctly provided on egress.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

The logic here looks correct to me but I am curious to know
what circumstances would lead to the kfree_skb() case.

> ---
>  drivers/net/vxlan.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index db96f3a16f6c..e6944b29588e 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2171,9 +2171,11 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
>  #endif
>  	}
>  
> -	if (vxlan->flags & VXLAN_F_COLLECT_METADATA &&
> -	    info && info->mode & IP_TUNNEL_INFO_TX) {
> -		vxlan_xmit_one(skb, dev, NULL, false);
> +	if (vxlan->flags & VXLAN_F_COLLECT_METADATA) {
> +		if (info && info->mode & IP_TUNNEL_INFO_TX)
> +			vxlan_xmit_one(skb, dev, NULL, false);
> +		else
> +			kfree_skb(skb);
>  		return NETDEV_TX_OK;
>  	}
>  
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] vxlan: do not use fdb in metadata mode
  2016-02-18  6:32 ` Simon Horman
@ 2016-02-18  9:11   ` Jiri Benc
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2016-02-18  9:11 UTC (permalink / raw)
  To: Simon Horman; +Cc: netdev

On Thu, 18 Feb 2016 15:32:40 +0900, Simon Horman wrote:
> The logic here looks correct to me but I am curious to know
> what circumstances would lead to the kfree_skb() case.

Setting up the interface in "external" (VXLAN_F_COLLECT_METADATA) mode,
assigning an IP address and not setting a route with the "encap"
parameter.

 Jiri

-- 
Jiri Benc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] vxlan: do not use fdb in metadata mode
  2016-02-16 21:18 [PATCH net] vxlan: do not use fdb in metadata mode Jiri Benc
  2016-02-18  6:32 ` Simon Horman
@ 2016-02-18 20:01 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-02-18 20:01 UTC (permalink / raw)
  To: jbenc; +Cc: netdev

From: Jiri Benc <jbenc@redhat.com>
Date: Tue, 16 Feb 2016 22:18:26 +0100

> In metadata mode, the vxlan interface is not supposed to use the fdb control
> plane but an external one (openvswitch or static routes). With the current
> code, packets may leak into the fdb handling code which usually causes them
> to be dropped anyway but may have strange side effects.
> 
> Just drop the packets directly when in metadata mode if the destination data
> are not correctly provided on egress.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-18 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 21:18 [PATCH net] vxlan: do not use fdb in metadata mode Jiri Benc
2016-02-18  6:32 ` Simon Horman
2016-02-18  9:11   ` Jiri Benc
2016-02-18 20:01 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).