mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-12 19:01:10 +00:00
tc/m_tunnel_key: Add dest UDP port to tunnel key action
Enhance tunnel key action parameters by adding destination UDP port. Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com>
This commit is contained in:
parent
41aa17ff46
commit
449c709c38
@ -15,6 +15,7 @@ tunnel_key - Tunnel metadata manipulation
|
|||||||
.BR dst_ip
|
.BR dst_ip
|
||||||
.IR ADDRESS
|
.IR ADDRESS
|
||||||
.BI id " KEY_ID"
|
.BI id " KEY_ID"
|
||||||
|
.BI dst_port " UDP_PORT"
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The
|
The
|
||||||
@ -61,6 +62,8 @@ Set tunnel metadata to be used by the IP tunnel device. Requires
|
|||||||
and
|
and
|
||||||
.B dst_ip
|
.B dst_ip
|
||||||
options.
|
options.
|
||||||
|
.B dst_port
|
||||||
|
is optional.
|
||||||
.RS
|
.RS
|
||||||
.TP
|
.TP
|
||||||
.B id
|
.B id
|
||||||
@ -71,6 +74,9 @@ Outer header source IP address (IPv4 or IPv6)
|
|||||||
.TP
|
.TP
|
||||||
.B dst_ip
|
.B dst_ip
|
||||||
Outer header destination IP address (IPv4 or IPv6)
|
Outer header destination IP address (IPv4 or IPv6)
|
||||||
|
.TP
|
||||||
|
.B dst_port
|
||||||
|
Outer header destination UDP port
|
||||||
.RE
|
.RE
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
The following example encapsulates incoming ICMP packets on eth0 into a vxlan
|
The following example encapsulates incoming ICMP packets on eth0 into a vxlan
|
||||||
|
@ -60,6 +60,20 @@ static int tunnel_key_parse_key_id(const char *str, int type,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tunnel_key_parse_dst_port(char *str, int type, struct nlmsghdr *n)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
__be16 dst_port;
|
||||||
|
|
||||||
|
ret = get_be16(&dst_port, str, 10);
|
||||||
|
if (ret)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
addattr16(n, MAX_MSG, type, dst_port);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
||||||
int tca_id, struct nlmsghdr *n)
|
int tca_id, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
@ -128,6 +142,14 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
has_key_id = 1;
|
has_key_id = 1;
|
||||||
|
} else if (matches(*argv, "dst_port") == 0) {
|
||||||
|
NEXT_ARG();
|
||||||
|
ret = tunnel_key_parse_dst_port(*argv,
|
||||||
|
TCA_TUNNEL_KEY_ENC_DST_PORT, n);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Illegal \"dst port\"\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
} else if (matches(*argv, "help") == 0) {
|
} else if (matches(*argv, "help") == 0) {
|
||||||
usage();
|
usage();
|
||||||
} else {
|
} else {
|
||||||
@ -197,6 +219,14 @@ static void tunnel_key_print_key_id(FILE *f, const char *name,
|
|||||||
fprintf(f, "\n\t%s %d", name, rta_getattr_be32(attr));
|
fprintf(f, "\n\t%s %d", name, rta_getattr_be32(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tunnel_key_print_dst_port(FILE *f, char *name,
|
||||||
|
struct rtattr *attr)
|
||||||
|
{
|
||||||
|
if (!attr)
|
||||||
|
return;
|
||||||
|
fprintf(f, "\n\t%s %d", name, rta_getattr_be16(attr));
|
||||||
|
}
|
||||||
|
|
||||||
static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
|
static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
|
||||||
{
|
{
|
||||||
struct rtattr *tb[TCA_TUNNEL_KEY_MAX + 1];
|
struct rtattr *tb[TCA_TUNNEL_KEY_MAX + 1];
|
||||||
@ -231,6 +261,8 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
|
|||||||
tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
|
tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
|
||||||
tunnel_key_print_key_id(f, "key_id",
|
tunnel_key_print_key_id(f, "key_id",
|
||||||
tb[TCA_TUNNEL_KEY_ENC_KEY_ID]);
|
tb[TCA_TUNNEL_KEY_ENC_KEY_ID]);
|
||||||
|
tunnel_key_print_dst_port(f, "dst_port",
|
||||||
|
tb[TCA_TUNNEL_KEY_ENC_DST_PORT]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(f, " %s", action_n2a(parm->action));
|
fprintf(f, " %s", action_n2a(parm->action));
|
||||||
|
Loading…
Reference in New Issue
Block a user