All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior
@ 2018-04-18  5:05 Hangbin Liu
  2018-04-18  5:10 ` Hangbin Liu
  2018-04-19 18:15 ` David Ahern
  0 siblings, 2 replies; 5+ messages in thread
From: Hangbin Liu @ 2018-04-18  5:05 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Jiri Benc, Hangbin Liu

Like kernel net-next commit 72f6d71e491e6 ("vxlan: add ttl inherit support"),
vxlan ttl inherit should means inherit the inner protocol's ttl value.

But currently when we add vxlan with "ttl inherit", we only set ttl 0,
which is actually use whatever default value instead of inherit the inner
protocol's ttl value.

To make a difference with ttl inherit and ttl == 0, we add an attribute
IFLA_VXLAN_TTL_INHERIT when "ttl inherit" specified. And use "ttl auto"
to means "use whatever default value", the same behavior with ttl == 0.

Reported-by: Jianlin Shi <jishi@redhat.com>
Suggested-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 include/uapi/linux/if_link.h | 1 +
 ip/iplink_vxlan.c            | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index dab5246..387f873 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -511,6 +511,7 @@ enum {
 	IFLA_VXLAN_COLLECT_METADATA,
 	IFLA_VXLAN_LABEL,
 	IFLA_VXLAN_GPE,
+	IFLA_VXLAN_TTL_INHERIT,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 661eaa7..5804db3 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -165,14 +165,18 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			NEXT_ARG();
 			check_duparg(&attrs, IFLA_VXLAN_TTL, "ttl", *argv);
-			if (strcmp(*argv, "inherit") != 0) {
+			if (strcmp(*argv, "inherit") == 0) {
+				addattr_l(n, 1024, IFLA_VXLAN_TTL_INHERIT, NULL, 0);
+			} else if (strcmp(*argv, "auto") == 0) {
+				addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
+			} else {
 				if (get_unsigned(&uval, *argv, 0))
 					invarg("invalid TTL", *argv);
 				if (uval > 255)
 					invarg("TTL must be <= 255", *argv);
 				ttl = uval;
+				addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
 			}
-			addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
 		} else if (!matches(*argv, "tos") ||
 			   !matches(*argv, "dsfield")) {
 			__u32 uval;
-- 
2.5.5

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

* Re: [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior
  2018-04-18  5:05 [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior Hangbin Liu
@ 2018-04-18  5:10 ` Hangbin Liu
  2018-04-18 15:50   ` Stephen Hemminger
  2018-04-19 18:15 ` David Ahern
  1 sibling, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2018-04-18  5:10 UTC (permalink / raw)
  To: network dev; +Cc: Stephen Hemminger, Jiri Benc, Hangbin Liu

Hi Stephen,

The patch's subject contains fix. But the kernel feature is applied on net-next.
So I'm not sure if iproute2 net-next is suitable. If you are OK with the patch,
please feel free to apply it on the branch which you think is suitable.

Thanks
Hangbin

On 18 April 2018 at 13:05, Hangbin Liu <liuhangbin@gmail.com> wrote:
> Like kernel net-next commit 72f6d71e491e6 ("vxlan: add ttl inherit support"),
> vxlan ttl inherit should means inherit the inner protocol's ttl value.
>
> But currently when we add vxlan with "ttl inherit", we only set ttl 0,
> which is actually use whatever default value instead of inherit the inner
> protocol's ttl value.
>
> To make a difference with ttl inherit and ttl == 0, we add an attribute
> IFLA_VXLAN_TTL_INHERIT when "ttl inherit" specified. And use "ttl auto"
> to means "use whatever default value", the same behavior with ttl == 0.
>
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Suggested-by: Jiri Benc <jbenc@redhat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>

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

* Re: [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior
  2018-04-18  5:10 ` Hangbin Liu
@ 2018-04-18 15:50   ` Stephen Hemminger
  2018-04-19  0:09     ` Hangbin Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2018-04-18 15:50 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: network dev, Jiri Benc

On Wed, 18 Apr 2018 13:10:49 +0800
Hangbin Liu <liuhangbin@gmail.com> wrote:

> Hi Stephen,
> 
> The patch's subject contains fix. But the kernel feature is applied on net-next.
> So I'm not sure if iproute2 net-next is suitable. If you are OK with the patch,
> please feel free to apply it on the branch which you think is suitable.
> 
> Thanks
> Hangbin
> 
> On 18 April 2018 at 13:05, Hangbin Liu <liuhangbin@gmail.com> wrote:
> > Like kernel net-next commit 72f6d71e491e6 ("vxlan: add ttl inherit support"),
> > vxlan ttl inherit should means inherit the inner protocol's ttl value.
> >
> > But currently when we add vxlan with "ttl inherit", we only set ttl 0,
> > which is actually use whatever default value instead of inherit the inner
> > protocol's ttl value.
> >
> > To make a difference with ttl inherit and ttl == 0, we add an attribute
> > IFLA_VXLAN_TTL_INHERIT when "ttl inherit" specified. And use "ttl auto"
> > to means "use whatever default value", the same behavior with ttl == 0.
> >
> > Reported-by: Jianlin Shi <jishi@redhat.com>
> > Suggested-by: Jiri Benc <jbenc@redhat.com>
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>  

When davem  merges the feature into net-next, dsa will merge this into iproute2-next.
We hold off merging into iproute2 because often the kernel review feedback causes
API changes.

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

* Re: [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior
  2018-04-18 15:50   ` Stephen Hemminger
@ 2018-04-19  0:09     ` Hangbin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2018-04-19  0:09 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: network dev

On Wed, Apr 18, 2018 at 08:50:16AM -0700, Stephen Hemminger wrote:
> When davem  merges the feature into net-next, dsa will merge this into iproute2-next.
> We hold off merging into iproute2 because often the kernel review feedback causes
> API changes.

Got it, Thanks.

Regards
Hangbin

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

* Re: [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior
  2018-04-18  5:05 [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior Hangbin Liu
  2018-04-18  5:10 ` Hangbin Liu
@ 2018-04-19 18:15 ` David Ahern
  1 sibling, 0 replies; 5+ messages in thread
From: David Ahern @ 2018-04-19 18:15 UTC (permalink / raw)
  To: Hangbin Liu, netdev; +Cc: Stephen Hemminger, Jiri Benc

On 4/17/18 11:05 PM, Hangbin Liu wrote:
> Like kernel net-next commit 72f6d71e491e6 ("vxlan: add ttl inherit support"),
> vxlan ttl inherit should means inherit the inner protocol's ttl value.
> 
> But currently when we add vxlan with "ttl inherit", we only set ttl 0,
> which is actually use whatever default value instead of inherit the inner
> protocol's ttl value.
> 
> To make a difference with ttl inherit and ttl == 0, we add an attribute
> IFLA_VXLAN_TTL_INHERIT when "ttl inherit" specified. And use "ttl auto"
> to means "use whatever default value", the same behavior with ttl == 0.
> 
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Suggested-by: Jiri Benc <jbenc@redhat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  include/uapi/linux/if_link.h | 1 +
>  ip/iplink_vxlan.c            | 8 ++++++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 

applied to iproute2-next.

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

end of thread, other threads:[~2018-04-19 18:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18  5:05 [PATCH iproute2 net-next] vxlan: fix ttl inherit behavior Hangbin Liu
2018-04-18  5:10 ` Hangbin Liu
2018-04-18 15:50   ` Stephen Hemminger
2018-04-19  0:09     ` Hangbin Liu
2018-04-19 18:15 ` David Ahern

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.