From 75fb816d9f73b1f217bc740200d69c113e10a896 Mon Sep 17 00:00:00 2001 From: Eli Britstein Date: Wed, 20 Nov 2019 14:42:44 +0200 Subject: [PATCH] tc_util: add functions for big endian masked numbers Add functions for big endian masked numbers as a pre-step towards masked port numbers. Signed-off-by: Eli Britstein Reviewed-by: Roi Dayan Acked-by: Jiri Pirko Signed-off-by: David Ahern --- tc/tc_util.c | 12 ++++++++++++ tc/tc_util.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/tc/tc_util.c b/tc/tc_util.c index 393721e3..afdfc78f 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -985,3 +985,15 @@ void print_masked_u8(const char *name, struct rtattr *attr, print_masked_type(UINT8_MAX, __rta_getattr_u8_u32, name, attr, mask_attr, newline); } + +static __u32 __rta_getattr_be16_u32(const struct rtattr *attr) +{ + return rta_getattr_be16(attr); +} + +void print_masked_be16(const char *name, struct rtattr *attr, + struct rtattr *mask_attr, bool newline) +{ + print_masked_type(UINT16_MAX, __rta_getattr_be16_u32, name, attr, + mask_attr, newline); +} diff --git a/tc/tc_util.h b/tc/tc_util.h index 9adf2ab4..edc39138 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -133,4 +133,6 @@ void print_masked_u16(const char *name, struct rtattr *attr, struct rtattr *mask_attr, bool newline); void print_masked_u8(const char *name, struct rtattr *attr, struct rtattr *mask_attr, bool newline); +void print_masked_be16(const char *name, struct rtattr *attr, + struct rtattr *mask_attr, bool newline); #endif