Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-29

Re: [PATCH v3] fib_rules: Added NLM_F_EXCL support to fib_nl_newrule

From: David Ahern <hidden>
Date: 2016-06-29 01:11:12

On 6/28/16 6:03 AM, Mateusz Bajorski wrote:
quoted hunk ↗ jump to hunk
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 98298b1..fa0c3ff 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -269,6 +269,46 @@ errout:
 	return err;
 }

+static int rule_exists(struct fib_rules_ops *ops, struct fib_rule_hdr *frh,
+		       struct nlattr **tb, struct fib_rule *rule)
+{
+	struct fib_rule *r;
+
+	list_for_each_entry(r, &ops->rules_list, list) {
+		if (r->action != rule->action)
+			continue;
+
+		if (r->table != rule->table)
+			continue;
+
+		if (r->pref != rule->pref)
+			continue;
+
+		if (memcmp(r->iifname, rule->iifname, IFNAMSIZ))
+			continue;
+
+		if (memcmp(r->oifname, rule->oifname, IFNAMSIZ))
+			continue;
+
+		if (r->mark != rule->mark)
+			continue;
+
+		if (r->mark_mask != rule->mark_mask)
+			continue;
+
+		if (r->tun_id != rule->tun_id)
+			continue;
+
+		if (r->fr_net != rule->fr_net)
+			continue;
+
+		if (!ops->compare(r, frh, tb))
+			continue;
l3mdev attribute snuck in a couple of weeks ago. You need to compare 
r->l3mdev != rule->l3mdev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help