tc: m_tunnel_key: Allow key-less tunnels
Change the id parameter of the tunnel_key set action from mandatory to optional. Some tunneling protocols (e.g. GRE) specify the id as an optional field. Signed-off-by: Adi Nissim <adin@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
3bc2dc7668
commit
dc0332b1e8
|
|
@ -59,12 +59,12 @@ above).
|
||||||
.TP
|
.TP
|
||||||
.B set
|
.B set
|
||||||
Set tunnel metadata to be used by the IP tunnel device. Requires
|
Set tunnel metadata to be used by the IP tunnel device. Requires
|
||||||
.B id
|
|
||||||
,
|
|
||||||
.B src_ip
|
.B src_ip
|
||||||
and
|
and
|
||||||
.B dst_ip
|
.B dst_ip
|
||||||
options.
|
options.
|
||||||
|
.B id
|
||||||
|
,
|
||||||
.B dst_port
|
.B dst_port
|
||||||
and
|
and
|
||||||
.B geneve_opts
|
.B geneve_opts
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ static void explain(void)
|
||||||
fprintf(stderr, " tunnel_key set <TUNNEL_KEY>\n");
|
fprintf(stderr, " tunnel_key set <TUNNEL_KEY>\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Where TUNNEL_KEY is a combination of:\n"
|
"Where TUNNEL_KEY is a combination of:\n"
|
||||||
"id <TUNNELID> (mandatory)\n"
|
"id <TUNNELID>\n"
|
||||||
"src_ip <IP> (mandatory)\n"
|
"src_ip <IP> (mandatory)\n"
|
||||||
"dst_ip <IP> (mandatory)\n"
|
"dst_ip <IP> (mandatory)\n"
|
||||||
"dst_port <UDP_PORT>\n"
|
"dst_port <UDP_PORT>\n"
|
||||||
|
|
@ -217,7 +217,6 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
||||||
int ret;
|
int ret;
|
||||||
int has_src_ip = 0;
|
int has_src_ip = 0;
|
||||||
int has_dst_ip = 0;
|
int has_dst_ip = 0;
|
||||||
int has_key_id = 0;
|
|
||||||
int csum = 1;
|
int csum = 1;
|
||||||
|
|
||||||
if (matches(*argv, "tunnel_key") != 0)
|
if (matches(*argv, "tunnel_key") != 0)
|
||||||
|
|
@ -273,7 +272,6 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
||||||
fprintf(stderr, "Illegal \"id\"\n");
|
fprintf(stderr, "Illegal \"id\"\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
has_key_id = 1;
|
|
||||||
} else if (matches(*argv, "dst_port") == 0) {
|
} else if (matches(*argv, "dst_port") == 0) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
ret = tunnel_key_parse_dst_port(*argv,
|
ret = tunnel_key_parse_dst_port(*argv,
|
||||||
|
|
@ -335,7 +333,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == TCA_TUNNEL_KEY_ACT_SET &&
|
if (action == TCA_TUNNEL_KEY_ACT_SET &&
|
||||||
(!has_src_ip || !has_dst_ip || !has_key_id)) {
|
(!has_src_ip || !has_dst_ip)) {
|
||||||
fprintf(stderr, "set needs tunnel_key parameters\n");
|
fprintf(stderr, "set needs tunnel_key parameters\n");
|
||||||
explain();
|
explain();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue