mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-06 01:49:39 +00:00
iplink_vxlan: Add DF configuration
Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be always on, inherited from the inner header, or, by default, always off, which is the current behaviour. v2: - Indicate in the man page what DF refers to, using RFC 791 wording (David Ahern) Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
3a7246dce4
commit
3d98eba4fe
@ -531,6 +531,7 @@ enum {
|
|||||||
IFLA_VXLAN_LABEL,
|
IFLA_VXLAN_LABEL,
|
||||||
IFLA_VXLAN_GPE,
|
IFLA_VXLAN_GPE,
|
||||||
IFLA_VXLAN_TTL_INHERIT,
|
IFLA_VXLAN_TTL_INHERIT,
|
||||||
|
IFLA_VXLAN_DF,
|
||||||
__IFLA_VXLAN_MAX
|
__IFLA_VXLAN_MAX
|
||||||
};
|
};
|
||||||
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
|
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
|
||||||
@ -540,6 +541,14 @@ struct ifla_vxlan_port_range {
|
|||||||
__be16 high;
|
__be16 high;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ifla_vxlan_df {
|
||||||
|
VXLAN_DF_UNSET = 0,
|
||||||
|
VXLAN_DF_SET,
|
||||||
|
VXLAN_DF_INHERIT,
|
||||||
|
__VXLAN_DF_END,
|
||||||
|
VXLAN_DF_MAX = __VXLAN_DF_END - 1,
|
||||||
|
};
|
||||||
|
|
||||||
/* GENEVE section */
|
/* GENEVE section */
|
||||||
enum {
|
enum {
|
||||||
IFLA_GENEVE_UNSPEC,
|
IFLA_GENEVE_UNSPEC,
|
||||||
|
@ -31,6 +31,7 @@ static void print_explain(FILE *f)
|
|||||||
" [ local ADDR ]\n"
|
" [ local ADDR ]\n"
|
||||||
" [ ttl TTL ]\n"
|
" [ ttl TTL ]\n"
|
||||||
" [ tos TOS ]\n"
|
" [ tos TOS ]\n"
|
||||||
|
" [ df DF ]\n"
|
||||||
" [ flowlabel LABEL ]\n"
|
" [ flowlabel LABEL ]\n"
|
||||||
" [ dev PHYS_DEV ]\n"
|
" [ dev PHYS_DEV ]\n"
|
||||||
" [ dstport PORT ]\n"
|
" [ dstport PORT ]\n"
|
||||||
@ -52,6 +53,7 @@ static void print_explain(FILE *f)
|
|||||||
" ADDR := { IP_ADDRESS | any }\n"
|
" ADDR := { IP_ADDRESS | any }\n"
|
||||||
" TOS := { NUMBER | inherit }\n"
|
" TOS := { NUMBER | inherit }\n"
|
||||||
" TTL := { 1..255 | auto | inherit }\n"
|
" TTL := { 1..255 | auto | inherit }\n"
|
||||||
|
" DF := { unset | set | inherit }\n"
|
||||||
" LABEL := 0-1048575\n"
|
" LABEL := 0-1048575\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -170,6 +172,22 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
} else
|
} else
|
||||||
tos = 1;
|
tos = 1;
|
||||||
addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
|
addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
|
||||||
|
} else if (!matches(*argv, "df")) {
|
||||||
|
enum ifla_vxlan_df df;
|
||||||
|
|
||||||
|
NEXT_ARG();
|
||||||
|
check_duparg(&attrs, IFLA_VXLAN_DF, "df", *argv);
|
||||||
|
if (strcmp(*argv, "unset") == 0)
|
||||||
|
df = VXLAN_DF_UNSET;
|
||||||
|
else if (strcmp(*argv, "set") == 0)
|
||||||
|
df = VXLAN_DF_SET;
|
||||||
|
else if (strcmp(*argv, "inherit") == 0)
|
||||||
|
df = VXLAN_DF_INHERIT;
|
||||||
|
else
|
||||||
|
invarg("DF must be 'unset', 'set' or 'inherit'",
|
||||||
|
*argv);
|
||||||
|
|
||||||
|
addattr8(n, 1024, IFLA_VXLAN_DF, df);
|
||||||
} else if (!matches(*argv, "label") ||
|
} else if (!matches(*argv, "label") ||
|
||||||
!matches(*argv, "flowlabel")) {
|
!matches(*argv, "flowlabel")) {
|
||||||
__u32 uval;
|
__u32 uval;
|
||||||
@ -538,6 +556,17 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||||||
print_string(PRINT_FP, NULL, "ttl %s ", "auto");
|
print_string(PRINT_FP, NULL, "ttl %s ", "auto");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tb[IFLA_VXLAN_DF]) {
|
||||||
|
enum ifla_vxlan_df df = rta_getattr_u8(tb[IFLA_VXLAN_DF]);
|
||||||
|
|
||||||
|
if (df == VXLAN_DF_UNSET)
|
||||||
|
print_string(PRINT_JSON, "df", "df %s ", "unset");
|
||||||
|
else if (df == VXLAN_DF_SET)
|
||||||
|
print_string(PRINT_ANY, "df", "df %s ", "set");
|
||||||
|
else if (df == VXLAN_DF_INHERIT)
|
||||||
|
print_string(PRINT_ANY, "df", "df %s ", "inherit");
|
||||||
|
}
|
||||||
|
|
||||||
if (tb[IFLA_VXLAN_LABEL]) {
|
if (tb[IFLA_VXLAN_LABEL]) {
|
||||||
__u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
|
__u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
|
||||||
|
|
||||||
|
@ -496,6 +496,8 @@ the following additional arguments are supported:
|
|||||||
] [
|
] [
|
||||||
.BI tos " TOS "
|
.BI tos " TOS "
|
||||||
] [
|
] [
|
||||||
|
.BI df " DF "
|
||||||
|
] [
|
||||||
.BI flowlabel " FLOWLABEL "
|
.BI flowlabel " FLOWLABEL "
|
||||||
] [
|
] [
|
||||||
.BI dstport " PORT "
|
.BI dstport " PORT "
|
||||||
@ -565,6 +567,18 @@ parameter.
|
|||||||
.BI tos " TOS"
|
.BI tos " TOS"
|
||||||
- specifies the TOS value to use in outgoing packets.
|
- specifies the TOS value to use in outgoing packets.
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.BI df " DF"
|
||||||
|
- specifies the usage of the Don't Fragment flag (DF) bit in outgoing packets
|
||||||
|
with IPv4 headers. The value
|
||||||
|
.B inherit
|
||||||
|
causes the bit to be copied from the original IP header. The values
|
||||||
|
.B unset
|
||||||
|
and
|
||||||
|
.B set
|
||||||
|
cause the bit to be always unset or always set, respectively. By default, the
|
||||||
|
bit is not set.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.BI flowlabel " FLOWLABEL"
|
.BI flowlabel " FLOWLABEL"
|
||||||
- specifies the flow label to use in outgoing packets.
|
- specifies the flow label to use in outgoing packets.
|
||||||
|
Loading…
Reference in New Issue
Block a user