Skip to contentSkip to conversation

vxlan: use nla_put_flag for ttl inherit

PATCH Applied Hangbin Liu 4 participants 7 messages Sep 28, 2018 – Oct 4, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vxlan: use nla_put_flag for ttl inherit

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

Fixes 8fd780698745b ("vxlan: fill ttl inherit info")
---
 drivers/net/vxlan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/vxlan.c +5 -3
index 2b8da2b..479dda4 100644
@@ -3539,7 +3539,7 @@ static size_t vxlan_get_size(const struct net_device *dev)
 		nla_total_size(sizeof(__u32)) +	/* IFLA_VXLAN_LINK */
 		nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TTL */
-		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TTL_INHERIT */
+		nla_total_size(0) +		/* IFLA_VXLAN_TTL_INHERIT */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TOS */
 		nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_LEARNING */
@@ -3604,8 +3604,6 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	}
 
 	if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) ||
-	    nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,
-		       !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) ||
 	    nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LEARNING,
@@ -3650,6 +3648,10 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	    nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL))
 		goto nla_put_failure;
 
+	if (vxlan->cfg.flags & VXLAN_F_TTL_INHERIT &&
+	    nla_put_flag(skb, IFLA_VXLAN_TTL_INHERIT))
+		goto nla_put_failure;
+
 	return 0;
 
 nla_put_failure:
Signature · 1 line
2.5.5
#1 lore raw
Quoted 2 lines · Hangbin Liu

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

s/opiton/option/

Apart from that, LGTM!

Thanks, Phil

#2 lore raw
Quoted 9 lines · Phil Sutter
Quoted 2 lines · Hangbin Liu

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

s/opiton/option/

Apart from that, LGTM!

Thanks, Phil

Opps, sorry...

Hi David,

Should I re-send a patch or will you help fix it directly?

Thanks
Hangbin

#3 lore raw
Quoted 11 lines · Hangbin Liu
Quoted 9 lines · Phil Sutter
Quoted 2 lines · Hangbin Liu

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

s/opiton/option/

Apart from that, LGTM!

Thanks, Phil

Quoted 9 lines

Opps, sorry...

Hi David,

Should I re-send a patch or will you help fix it directly?

Thanks
Hangbin

you have this targeted at net; is it a bug in current iproute2 or an update to a new feature in -next?

#4 lore raw
Quoted 16 lines · David Ahern
Quoted 15 lines · Hangbin Liu
Quoted 9 lines · Phil Sutter
Quoted 2 lines · Hangbin Liu

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

s/opiton/option/

Apart from that, LGTM!

Thanks, Phil

Opps, sorry...

Hi David,

Quoted 8 lines
Quoted 5 lines

Should I re-send a patch or will you help fix it directly?

Thanks
Hangbin

you have this targeted at net; is it a bug in current iproute2 or an update to a new feature in -next?

Hi David Ahern,

This patch targets to kernel net tree. The previous question is for "David Miller". Sorry for the confusing. Anyway, I will send a v2 patch for this one as I need to change the commit message.

Thanks
Hangbin

#5 lore raw
In reply to Hangbin Liu
Quoted 4 lines · Hangbin Liu

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

Fixes 8fd780698745b ("vxlan: fill ttl inherit info")

Wrong Fixes tag:

kenny:mgmt:iproute2-next.git$ git show 8fd780698745b
fatal: ambiguous argument '8fd780698745b': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Quoted 40 lines
---
 drivers/net/vxlan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/vxlan.c +5 -3
index 2b8da2b..479dda4 100644
@@ -3539,7 +3539,7 @@ static size_t vxlan_get_size(const struct net_device *dev)
 		nla_total_size(sizeof(__u32)) +	/* IFLA_VXLAN_LINK */
 		nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TTL */
-		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TTL_INHERIT */
+		nla_total_size(0) +		/* IFLA_VXLAN_TTL_INHERIT */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_TOS */
 		nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */
 		nla_total_size(sizeof(__u8)) +	/* IFLA_VXLAN_LEARNING */
@@ -3604,8 +3604,6 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	}
 
 	if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) ||
-	    nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,
-		       !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) ||
 	    nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LEARNING,
@@ -3650,6 +3648,10 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	    nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL))
 		goto nla_put_failure;
 
+	if (vxlan->cfg.flags & VXLAN_F_TTL_INHERIT &&
+	    nla_put_flag(skb, IFLA_VXLAN_TTL_INHERIT))
+		goto nla_put_failure;
+
 	return 0;
 
 nla_put_failure:
#6 lore raw
In reply to Hangbin Liu
Quoted 6 lines · On Fri, 28 Sep 2018 09:08:26 +0800 Hangbin Liu <[email protected]> wrote:

Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton.

Fixes 8fd780698745b ("vxlan: fill ttl inherit info")

Applied to iproute2 current release.