[ovs-dev] [PATCH] lib/netlink.c: return the min/max payload size for NL_A_BE* types explicitly
Wang Sheng-Hui
shhuiw at gmail.com
Tue Oct 7 12:36:44 UTC 2014
In min_attr_len and max_attr_len, it assumes the value equality between
NL_A_U* and NL_A_BE* types. Here return the attr len for NL_A_BE* types
explicitly.
Signed-off-by: Wang Sheng-Hui <shhuiw at gmail.com>
---
lib/netlink.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/netlink.c b/lib/netlink.c
index 24b2168..155f998 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -638,9 +638,12 @@ min_attr_len(enum nl_attr_type type)
case NL_A_NO_ATTR: return 0;
case NL_A_UNSPEC: return 0;
case NL_A_U8: return 1;
- case NL_A_U16: return 2;
- case NL_A_U32: return 4;
- case NL_A_U64: return 8;
+ case NL_A_U16:
+ case NL_A_BE16: return 2;
+ case NL_A_U32:
+ case NL_A_BE32: return 4;
+ case NL_A_U64:
+ case NL_A_BE64: return 8;
case NL_A_STRING: return 1;
case NL_A_FLAG: return 0;
case NL_A_NESTED: return 0;
@@ -656,9 +659,12 @@ max_attr_len(enum nl_attr_type type)
case NL_A_NO_ATTR: return SIZE_MAX;
case NL_A_UNSPEC: return SIZE_MAX;
case NL_A_U8: return 1;
- case NL_A_U16: return 2;
- case NL_A_U32: return 4;
- case NL_A_U64: return 8;
+ case NL_A_U16:
+ case NL_A_BE16: return 2;
+ case NL_A_U32:
+ case NL_A_BE32: return 4;
+ case NL_A_U64:
+ case NL_A_BE64: return 8;
case NL_A_STRING: return SIZE_MAX;
case NL_A_FLAG: return SIZE_MAX;
case NL_A_NESTED: return SIZE_MAX;
--
1.8.3.2
More information about the dev
mailing list