[nft PATCH 2/7] netlink: Do not allocate a bogus flowtable priority expr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code accidentally treats missing NFTNL_FLOWTABLE_PRIO attribute as zero
prio value which may not be correct.

Fixes: db0697ce7f602 ("src: support for flowtable listing")
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 src/netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/netlink.c b/src/netlink.c
index 0e0d32b846d6a..be1fefc068bfd 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1862,14 +1862,16 @@ netlink_delinearize_flowtable(struct netlink_ctx *ctx,
 		      sizeof(char *), qsort_device_cmp);
 	}
 
-	priority = nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_PRIO);
-	flowtable->priority.expr =
+	if (nftnl_flowtable_is_set(nlo, NFTNL_FLOWTABLE_PRIO)) {
+		priority = nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_PRIO);
+		flowtable->priority.expr =
 				constant_expr_alloc(&netlink_location,
 						    &integer_type,
 						    BYTEORDER_HOST_ENDIAN,
 						    sizeof(int) *
 						    BITS_PER_BYTE,
 						    &priority);
+	}
 	flowtable->hook.num =
 		nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_HOOKNUM);
 	flowtable->flags =
-- 
2.49.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux