mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-18 22:00:05 +00:00
iplink_geneve: add tos configuration at link creation
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
f4c05c2e99
commit
f4739b2ee7
@ -394,6 +394,7 @@ enum {
|
|||||||
IFLA_GENEVE_ID,
|
IFLA_GENEVE_ID,
|
||||||
IFLA_GENEVE_REMOTE,
|
IFLA_GENEVE_REMOTE,
|
||||||
IFLA_GENEVE_TTL,
|
IFLA_GENEVE_TTL,
|
||||||
|
IFLA_GENEVE_TOS,
|
||||||
__IFLA_GENEVE_MAX
|
__IFLA_GENEVE_MAX
|
||||||
};
|
};
|
||||||
#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
|
#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
|
||||||
|
@ -11,16 +11,18 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "rt_names.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "ip_common.h"
|
#include "ip_common.h"
|
||||||
|
|
||||||
static void print_explain(FILE *f)
|
static void print_explain(FILE *f)
|
||||||
{
|
{
|
||||||
fprintf(f, "Usage: ... geneve id VNI remote ADDR\n");
|
fprintf(f, "Usage: ... geneve id VNI remote ADDR\n");
|
||||||
fprintf(f, " [ ttl TTL ]\n");
|
fprintf(f, " [ ttl TTL ] [ tos TOS ]\n");
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
fprintf(f, "Where: VNI := 0-16777215\n");
|
fprintf(f, "Where: VNI := 0-16777215\n");
|
||||||
fprintf(f, " ADDR := IP_ADDRESS\n");
|
fprintf(f, " ADDR := IP_ADDRESS\n");
|
||||||
|
fprintf(f, " TOS := { NUMBER | inherit }\n");
|
||||||
fprintf(f, " TTL := { 1..255 | inherit }\n");
|
fprintf(f, " TTL := { 1..255 | inherit }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
__u32 daddr = 0;
|
__u32 daddr = 0;
|
||||||
struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
|
struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
|
||||||
__u8 ttl = 0;
|
__u8 ttl = 0;
|
||||||
|
__u8 tos = 0;
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (!matches(*argv, "id") ||
|
if (!matches(*argv, "id") ||
|
||||||
@ -66,6 +69,17 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
invarg("TTL must be <= 255", *argv);
|
invarg("TTL must be <= 255", *argv);
|
||||||
ttl = uval;
|
ttl = uval;
|
||||||
}
|
}
|
||||||
|
} else if (!matches(*argv, "tos") ||
|
||||||
|
!matches(*argv, "dsfield")) {
|
||||||
|
__u32 uval;
|
||||||
|
|
||||||
|
NEXT_ARG();
|
||||||
|
if (strcmp(*argv, "inherit") != 0) {
|
||||||
|
if (rtnl_dsfield_a2n(&uval, *argv))
|
||||||
|
invarg("bad TOS value", *argv);
|
||||||
|
tos = uval;
|
||||||
|
} else
|
||||||
|
tos = 1;
|
||||||
} else if (matches(*argv, "help") == 0) {
|
} else if (matches(*argv, "help") == 0) {
|
||||||
explain();
|
explain();
|
||||||
return -1;
|
return -1;
|
||||||
@ -95,6 +109,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
if (daddr)
|
if (daddr)
|
||||||
addattr_l(n, 1024, IFLA_GENEVE_REMOTE, &daddr, 4);
|
addattr_l(n, 1024, IFLA_GENEVE_REMOTE, &daddr, 4);
|
||||||
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
|
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
|
||||||
|
addattr8(n, 1024, IFLA_GENEVE_TOS, tos);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -103,6 +118,7 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||||||
{
|
{
|
||||||
__u32 vni;
|
__u32 vni;
|
||||||
char s1[1024];
|
char s1[1024];
|
||||||
|
__u8 tos;
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return;
|
return;
|
||||||
@ -126,6 +142,14 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||||||
if (ttl)
|
if (ttl)
|
||||||
fprintf(f, "ttl %d ", ttl);
|
fprintf(f, "ttl %d ", ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tb[IFLA_GENEVE_TOS] &&
|
||||||
|
(tos = rta_getattr_u8(tb[IFLA_GENEVE_TOS]))) {
|
||||||
|
if (tos == 1)
|
||||||
|
fprintf(f, "tos inherit ");
|
||||||
|
else
|
||||||
|
fprintf(f, "tos %#x ", tos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void geneve_print_help(struct link_util *lu, int argc, char **argv,
|
static void geneve_print_help(struct link_util *lu, int argc, char **argv,
|
||||||
|
@ -608,6 +608,8 @@ the following additional arguments are supported:
|
|||||||
.BI type " geneve " id " ID " remote " IPADDR"
|
.BI type " geneve " id " ID " remote " IPADDR"
|
||||||
.R " [ "
|
.R " [ "
|
||||||
.BI ttl " TTL "
|
.BI ttl " TTL "
|
||||||
|
.R " ] [ "
|
||||||
|
.BI tos " TOS "
|
||||||
.R " ]"
|
.R " ]"
|
||||||
|
|
||||||
.in +8
|
.in +8
|
||||||
@ -623,6 +625,10 @@ the following additional arguments are supported:
|
|||||||
.BI ttl " TTL"
|
.BI ttl " TTL"
|
||||||
- specifies the TTL value to use in outgoing packets.
|
- specifies the TTL value to use in outgoing packets.
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.BI tos " TOS"
|
||||||
|
- specifies the TOS value to use in outgoing packets.
|
||||||
|
|
||||||
.in -8
|
.in -8
|
||||||
|
|
||||||
.SS ip link delete - delete virtual link
|
.SS ip link delete - delete virtual link
|
||||||
|
Loading…
Reference in New Issue
Block a user