ip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT
Subsystems (2)
PATCH 1/1 ip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT
Add support for creating devices with this property. Since it cannot be changed, not adding a [no] option.
Signed-off-by Eyal Birger <[email protected]>
--- include/uapi/linux/if_link.h | 1 + ip/iplink_geneve.c | 13 +++++++++++++ man/man8/ip-link.8.in | 6 ++++++ 3 files changed, 20 insertions(+)
include/uapi/linux/if_link.h +1 -0
@@ -840,6 +840,7 @@ enum {IFLA_GENEVE_LABEL ,IFLA_GENEVE_TTL_INHERIT ,IFLA_GENEVE_DF , +IFLA_GENEVE_INNER_PROTO_INHERIT , __IFLA_GENEVE_MAX };#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
ip/iplink_geneve.c +13 -0
@@ -31,6 +31,7 @@ static void print_explain(FILE *f)" [ [no]udpcsum ]\n" " [ [no]udp6zerocsumtx ]\n" " [ [no]udp6zerocsumrx ]\n" +" [ innerprotoinherit ]\n" "\n" "Where: VNI := 0-16777215\n" " ADDR := IP_ADDRESS\n"
@@ -72,6 +73,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,__u64 attrs =0 ;bool set_op = (n->nlmsg_type ==RTM_NEWLINK && !(n->nlmsg_flags &NLM_F_CREATE )); +bool inner_proto_inherit = false;inet_prefix_reset (&daddr);
@@ -182,6 +184,10 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,check_duparg (&attrs,IFLA_GENEVE_UDP_ZERO_CSUM6_RX , *argv, *argv); udp6zerocsumrx =0 ; + }else if (!matches (*argv,"innerprotoinherit" )) { +check_duparg (&attrs,IFLA_GENEVE_INNER_PROTO_INHERIT , + *argv, *argv); + inner_proto_inherit = true; }else if (matches (*argv,"help" ) ==0 ) {explain ();return -1 ;
@@ -231,6 +237,8 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,addattr16 (n,1024 ,IFLA_GENEVE_PORT ,htons (dstport));if (metadata)addattr (n,1024 ,IFLA_GENEVE_COLLECT_METADATA ); +if (inner_proto_inherit) +addattr (n,1024 ,IFLA_GENEVE_INNER_PROTO_INHERIT );if (GENEVE_ATTRSET (attrs,IFLA_GENEVE_UDP_CSUM ))addattr8 (n,1024 ,IFLA_GENEVE_UDP_CSUM , udpcsum);if (GENEVE_ATTRSET (attrs,IFLA_GENEVE_UDP_ZERO_CSUM6_TX ))
@@ -365,6 +373,11 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])fputs ("udp6zerocsumrx " , f); } } + +if (tb[IFLA_GENEVE_INNER_PROTO_INHERIT ]) { +print_bool (PRINT_ANY ,"inner_proto_inherit" , +"innerprotoinherit " , true); + } } static void geneve_print_help(struct link_util *lu, int argc, char **argv,
man/man8/ip-link.8.in +6 -0
@@ -1255,6 +1255,8 @@ the following additional arguments are supported: .RB [ no ] udp6zerocsumtx ] [ .RB [ no ] udp6zerocsumrx +] [ +.B innerprotoinherit ] .in +8
@@ -1318,6 +1320,10 @@ options. .RB [ no ] udp6zerocsumrx - allow incoming UDP packets over IPv6 with zero checksum field. +.sp +.B innerprotoinherit +- use IPv4/IPv6 as inner protocol instead of Ethernet. + .in -8 .TP
Signature · 1 line
2.32.0
ip/iplink_geneve.c static int geneve_parse_opt(struct link_util *lu, int argc, char **argv, · line 187
Quoted 5 lines · Eyal Birger
ip/iplink_geneve.c +1
-0@@ -182,6 +184,10 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,check_duparg (&attrs,IFLA_GENEVE_UDP_ZERO_CSUM6_RX , *argv, *argv); udp6zerocsumrx =0 ; + }else if (!matches (*argv,"innerprotoinherit" )) {
changed matches to strcmp (not taking any more usage of matches) and applied to iproute2-next.