vxlan: show correct ttl inherit info
Subsystems (2)
PATCH 1/1 vxlan: show correct ttl inherit info
We should only show ttl inherit when IFLA_VXLAN_TTL_INHERIT supplied. Otherwise show the ttl number, or auto when it is 0.
--- ip/iplink_vxlan.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
ip/iplink_vxlan.c +10 -6
@@ -145,7 +145,7 @@ 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 ) { -addattr_l (n,1024 ,IFLA_VXLAN_TTL_INHERIT ,NULL ,0 ); +addattr (n,1024 ,IFLA_VXLAN_TTL_INHERIT ); }else if (strcmp (*argv,"auto" ) ==0 ) {addattr8 (n,1024 ,IFLA_VXLAN_TTL , ttl); }else {
@@ -527,12 +527,16 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])print_string (PRINT_FP ,NULL ,"tos %s " ,"inherit" ); } -if (tb[IFLA_VXLAN_TTL ]) - ttl =rta_getattr_u8 (tb[IFLA_VXLAN_TTL ]); -if (is_json_context () || ttl) -print_uint (PRINT_ANY ,"ttl" ,"ttl %u " , ttl); -else +if (tb[IFLA_VXLAN_TTL_INHERIT ] && +rta_getattr_u8 (tb[IFLA_VXLAN_TTL_INHERIT ])) {print_string (PRINT_FP ,NULL ,"ttl %s " ,"inherit" ); + }else if (tb[IFLA_VXLAN_TTL ]) { + ttl =rta_getattr_u8 (tb[IFLA_VXLAN_TTL ]); +if (is_json_context () || ttl) +print_uint (PRINT_ANY ,"ttl" ,"ttl %u " , ttl); +else +print_string (PRINT_FP ,NULL ,"ttl %s " ,"auto" ); + }if (tb[IFLA_VXLAN_LABEL ]) {__u32 label =rta_getattr_u32 (tb[IFLA_VXLAN_LABEL ]);
Signature · 1 line
2.5.5
Hi Hangbin,
Quoted 13 lines · Hangbin Liu
We should only show ttl inherit when
IFLA_VXLAN_TTL_INHERITsupplied. Otherwise show the ttl number, or auto when it is 0.Signed-off-by Hangbin Liu <[email protected]>--- ip/iplink_vxlan.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)ip/iplink_vxlan.c +0
-0
ip/iplink_vxlan.c static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, · line 148
Quoted 5 lines
ip/iplink_vxlan.c +1
-1@@ -145,7 +145,7 @@ 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 ) { -addattr_l (n,1024 ,IFLA_VXLAN_TTL_INHERIT ,NULL ,0 ); +addattr (n,1024 ,IFLA_VXLAN_TTL_INHERIT );
So for VXLAN, the attribute is just added but with a zero value. Looking at respective kernel code, this seems fine. Now I wonder why for Geneve, you set the value to 1 and when displaying explicitly check whether the attribute is there *and* non-zero. OK, looks like Geneve driver always exports IFLA_GENEVE_TTL_INHERIT. Oddly, I can't find where VXLAN driver in kernel does export the IFLA_VXLAN_TTL_INHERIT attribute. Am I missing something?
Do you know why handling of the attributes in both drivers differ?
Cheers, Phil
Quoted 22 lines · Phil Sutter
Hi Hangbin,
Quoted 13 lines · Hangbin Liu
We should only show ttl inherit when
IFLA_VXLAN_TTL_INHERITsupplied. Otherwise show the ttl number, or auto when it is 0.Signed-off-by Hangbin Liu <[email protected]>--- ip/iplink_vxlan.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)ip/iplink_vxlan.c +0
-0ip/iplink_vxlan.c static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, · line 148
Quoted 5 lines
ip/iplink_vxlan.c +1
-1@@ -145,7 +145,7 @@ 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 ) { -addattr_l (n,1024 ,IFLA_VXLAN_TTL_INHERIT ,NULL ,0 ); +addattr (n,1024 ,IFLA_VXLAN_TTL_INHERIT );
Quoted 7 lines
So for VXLAN, the attribute is just added but with a zero value. Looking at respective kernel code, this seems fine. Now I wonder why for Geneve, you set the value to 1 and when displaying explicitly check whether the attribute is there *and* non-zero. OK, looks like Geneve driver always exports
IFLA_GENEVE_TTL_INHERIT. Oddly, I can't find where VXLAN driver in kernel does export theIFLA_VXLAN_TTL_INHERITattribute. Am I missing something?
Hi Phil,
The vxlan ttl inherit exportation is just fixed by
net commit 8fd78069874 ("vxlan: fill ttl inherit info") yesterday.
Quoted 1 line
Do you know why handling of the attributes in both drivers differ?
That's because I set IFLA_VXLAN_TTL_INHERIT type to NLA_FLAG. But when fix the geneve issue, I forgot this and set IFLA_GENEVE_TTL_INHERIT type to NLA_U8... :(
I noticed this when post the iproute2 patch. But I thought this should have no much influence, so I just leave it as it is.
If you think we'd better have a same behaver. We can drop the geneve iproute2 patch and post a fix to net kernel tree.
Thanks
Hangbin
Hi Hangbin,
Quoted 29 lines · Hangbin Liu
Quoted 20 lines · Phil Sutter
Quoted 13 lines · Hangbin Liu
We should only show ttl inherit when
IFLA_VXLAN_TTL_INHERITsupplied. Otherwise show the ttl number, or auto when it is 0.Signed-off-by Hangbin Liu <[email protected]>--- ip/iplink_vxlan.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)ip/iplink_vxlan.c +0
-0ip/iplink_vxlan.c static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, · line 148
Quoted 5 lines
ip/iplink_vxlan.c +1
-1@@ -145,7 +145,7 @@ 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 ) { -addattr_l (n,1024 ,IFLA_VXLAN_TTL_INHERIT ,NULL ,0 ); +addattr (n,1024 ,IFLA_VXLAN_TTL_INHERIT );Quoted 7 lines
So for VXLAN, the attribute is just added but with a zero value. Looking at respective kernel code, this seems fine. Now I wonder why for Geneve, you set the value to 1 and when displaying explicitly check whether the attribute is there *and* non-zero. OK, looks like Geneve driver always exports
IFLA_GENEVE_TTL_INHERIT. Oddly, I can't find where VXLAN driver in kernel does export theIFLA_VXLAN_TTL_INHERITattribute. Am I missing something?
Quoted 4 lines
Hi Phil,
The vxlan ttl inherit exportation is just fixed by
net commit8fd78069874("vxlan: fill ttl inherit info") yesterday.
Ah, thanks!
Quoted 11 lines
Quoted 1 line
Do you know why handling of the attributes in both drivers differ?
That's because I set
IFLA_VXLAN_TTL_INHERITtype toNLA_FLAG. But when fix the geneve issue, I forgot this and setIFLA_GENEVE_TTL_INHERITtype toNLA_U8... :(I noticed this when post the iproute2 patch. But I thought this should have no much influence, so I just leave it as it is.
If you think we'd better have a same behaver. We can drop the geneve iproute2 patch and post a fix to net kernel tree.
I guess it doesn't make much difference, but NLA_FLAG would be more appropriate. If you want to spend the extra effort to fix it, I guess now's the time - later it can't be changed anymore due to compatibility issues (I guess).
Thanks, Phil