ip/tunnel: always print all known attributes
Presently, if a Geneve or VXLAN interface was created with 'external',
it's not possible for a user to determine e.g. the value of 'dstport'
after creation. This change fixes that by avoiding early returns.
This change partly reverts commit 00ff4b8e31 ("ip/tunnel: Be consistent
when printing tunnel collect metadata").
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
71ba9c18e0
commit
51d8fc708c
|
|
@ -243,7 +243,6 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
|
|
||||||
static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
{
|
{
|
||||||
__u32 vni;
|
|
||||||
__u8 ttl = 0;
|
__u8 ttl = 0;
|
||||||
__u8 tos = 0;
|
__u8 tos = 0;
|
||||||
|
|
||||||
|
|
@ -252,15 +251,12 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
|
|
||||||
if (tb[IFLA_GENEVE_COLLECT_METADATA]) {
|
if (tb[IFLA_GENEVE_COLLECT_METADATA]) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tb[IFLA_GENEVE_ID] ||
|
if (tb[IFLA_GENEVE_ID] &&
|
||||||
RTA_PAYLOAD(tb[IFLA_GENEVE_ID]) < sizeof(__u32))
|
RTA_PAYLOAD(tb[IFLA_GENEVE_ID]) >= sizeof(__u32)) {
|
||||||
return;
|
print_uint(PRINT_ANY, "id", "id %u ", rta_getattr_u32(tb[IFLA_GENEVE_ID]));
|
||||||
|
}
|
||||||
vni = rta_getattr_u32(tb[IFLA_GENEVE_ID]);
|
|
||||||
print_uint(PRINT_ANY, "id", "id %u ", vni);
|
|
||||||
|
|
||||||
if (tb[IFLA_GENEVE_REMOTE]) {
|
if (tb[IFLA_GENEVE_REMOTE]) {
|
||||||
__be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_REMOTE]);
|
__be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_REMOTE]);
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,6 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
|
|
||||||
static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
{
|
{
|
||||||
__u32 vni;
|
|
||||||
__u8 ttl = 0;
|
__u8 ttl = 0;
|
||||||
__u8 tos = 0;
|
__u8 tos = 0;
|
||||||
__u32 maxaddr;
|
__u32 maxaddr;
|
||||||
|
|
@ -419,15 +418,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
if (tb[IFLA_VXLAN_COLLECT_METADATA] &&
|
if (tb[IFLA_VXLAN_COLLECT_METADATA] &&
|
||||||
rta_getattr_u8(tb[IFLA_VXLAN_COLLECT_METADATA])) {
|
rta_getattr_u8(tb[IFLA_VXLAN_COLLECT_METADATA])) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tb[IFLA_VXLAN_ID] ||
|
if (tb[IFLA_VXLAN_ID] &&
|
||||||
RTA_PAYLOAD(tb[IFLA_VXLAN_ID]) < sizeof(__u32))
|
RTA_PAYLOAD(tb[IFLA_VXLAN_ID]) >= sizeof(__u32)) {
|
||||||
return;
|
print_uint(PRINT_ANY, "id", "id %u ", rta_getattr_u32(tb[IFLA_VXLAN_ID]));
|
||||||
|
}
|
||||||
vni = rta_getattr_u32(tb[IFLA_VXLAN_ID]);
|
|
||||||
print_uint(PRINT_ANY, "id", "id %u ", vni);
|
|
||||||
|
|
||||||
if (tb[IFLA_VXLAN_GROUP]) {
|
if (tb[IFLA_VXLAN_GROUP]) {
|
||||||
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_GROUP]);
|
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_GROUP]);
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,6 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
|
|
||||||
if (tb[IFLA_GRE_COLLECT_METADATA]) {
|
if (tb[IFLA_GRE_COLLECT_METADATA]) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tnl_print_endpoint("remote", tb[IFLA_GRE_REMOTE], AF_INET);
|
tnl_print_endpoint("remote", tb[IFLA_GRE_REMOTE], AF_INET);
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,6 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
|
|
||||||
if (tb[IFLA_GRE_COLLECT_METADATA]) {
|
if (tb[IFLA_GRE_COLLECT_METADATA]) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[IFLA_GRE_FLAGS])
|
if (tb[IFLA_GRE_FLAGS])
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,6 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
|
||||||
|
|
||||||
if (tb[IFLA_IPTUN_COLLECT_METADATA]) {
|
if (tb[IFLA_IPTUN_COLLECT_METADATA]) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[IFLA_IPTUN_FLAGS])
|
if (tb[IFLA_IPTUN_FLAGS])
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,6 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
|
||||||
|
|
||||||
if (tb[IFLA_IPTUN_COLLECT_METADATA]) {
|
if (tb[IFLA_IPTUN_COLLECT_METADATA]) {
|
||||||
print_bool(PRINT_ANY, "external", "external ", true);
|
print_bool(PRINT_ANY, "external", "external ", true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[IFLA_IPTUN_PROTO]) {
|
if (tb[IFLA_IPTUN_PROTO]) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue