Skip to contentSkip to conversation

netfilter: nft_set_rbtree: incorrect assumption on lower interval lookups

PATCH New Pablo Neira Ayuso 1 participant 2 messages Mar 1, 2017

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/2 netfilter: nft_set_rbtree: incorrect assumption on lower interval lookups

In case of adjacent ranges, we may indeed see either the high part of the range in first place or the low part of it. Remove this incorrect assumption, let's make sure we annotate the low part of the interval in case of we have adjacent interva intervals so we hit a matching in lookups.

---
 net/netfilter/nft_set_rbtree.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
net/netfilter/nft_set_rbtree.c +4 -5
index 71e8fb886a73..78dfbf9588b3 100644
@@ -60,11 +60,10 @@ static bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
 		d = memcmp(this, key, set->klen);
 		if (d < 0) {
 			parent = parent->rb_left;
-			/* In case of adjacent ranges, we always see the high
-			 * part of the range in first place, before the low one.
-			 * So don't update interval if the keys are equal.
-			 */
-			if (interval && nft_rbtree_equal(set, this, interval))
+			if (interval &&
+			    nft_rbtree_equal(set, this, interval) &&
+			    nft_rbtree_interval_end(this) &&
+			    !nft_rbtree_interval_end(interval))
 				continue;
 			interval = rbe;
 		} else if (d > 0)
Signature · 1 line
2.1.4
author maintainer
#1 lore raw

PATCH 2/2 netfilter: nf_tables: netlink listener hits ESRCH on socket overrun

Netlink listeners are currently hitting ESRCH on socket buffer overruns via nf_tables, this error is misleading and inconsistent with regards to other existing netlink subsystems. Netlink semantics mandate that listeners hit ENOBUFS if the socket buffer overruns.

---
 include/net/netfilter/nf_tables.h |   6 +-
 net/netfilter/nf_tables_api.c     | 128 +++++++++++++++++++-------------------
 2 files changed, 66 insertions(+), 68 deletions(-)
include/net/netfilter/nf_tables.h +3 -3
index ac84686aaafb..2aa8a9d80fbe 100644
@@ -988,9 +988,9 @@ struct nft_object *nf_tables_obj_lookup(const struct nft_table *table,
 					const struct nlattr *nla, u32 objtype,
 					u8 genmask);
 
-int nft_obj_notify(struct net *net, struct nft_table *table,
-		   struct nft_object *obj, u32 portid, u32 seq,
-		   int event, int family, int report, gfp_t gfp);
+void nft_obj_notify(struct net *net, struct nft_table *table,
+		    struct nft_object *obj, u32 portid, u32 seq,
+		    int event, int family, int report, gfp_t gfp);
 
 /**
  *	struct nft_object_type - stateful object type
net/netfilter/nf_tables_api.c +63 -65

272 lines not on this page · raw message

Signature · 1 line
2.1.4