mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-19 20:57:04 +00:00
macsec: add an accessor for validate_str
This patch adds an accessor for the validate_str array, to handle future changes adding a member. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
69166f909b
commit
c15674d80d
@ -653,6 +653,14 @@ static const char *cs_id_to_name(__u64 cid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *validate_to_str(__u8 validate)
|
||||||
|
{
|
||||||
|
if (validate >= ARRAY_SIZE(validate_str))
|
||||||
|
return "(unknown)";
|
||||||
|
|
||||||
|
return validate_str[validate];
|
||||||
|
}
|
||||||
|
|
||||||
static const char *offload_to_str(__u8 offload)
|
static const char *offload_to_str(__u8 offload)
|
||||||
{
|
{
|
||||||
if (offload >= ARRAY_SIZE(offload_str))
|
if (offload >= ARRAY_SIZE(offload_str))
|
||||||
@ -669,7 +677,7 @@ static void print_attrs(struct rtattr *attrs[])
|
|||||||
__u8 val = rta_getattr_u8(attrs[MACSEC_SECY_ATTR_VALIDATE]);
|
__u8 val = rta_getattr_u8(attrs[MACSEC_SECY_ATTR_VALIDATE]);
|
||||||
|
|
||||||
print_string(PRINT_ANY, "validate",
|
print_string(PRINT_ANY, "validate",
|
||||||
"validate %s ", validate_str[val]);
|
"validate %s ", validate_to_str(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
print_flag(attrs, "sc", MACSEC_RXSC_ATTR_ACTIVE);
|
print_flag(attrs, "sc", MACSEC_RXSC_ATTR_ACTIVE);
|
||||||
@ -1208,7 +1216,7 @@ static void macsec_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||||||
print_string(PRINT_ANY,
|
print_string(PRINT_ANY,
|
||||||
"validation",
|
"validation",
|
||||||
"validate %s ",
|
"validate %s ",
|
||||||
validate_str[val]);
|
validate_to_str(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *inc_sci, *es, *replay;
|
const char *inc_sci, *es, *replay;
|
||||||
|
Loading…
Reference in New Issue
Block a user