summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2023-10-09 16:36:00 +0200
committerGitHub <noreply@github.com>2023-10-09 16:36:00 +0200
commitb9668023622328468a30fe530bab86afdc914878 (patch)
tree40bd788f53bd3d0b9fa7448976649fc5b57e3216
parentMerge pull request #10733 from anlancs/zebra-remove-update (diff)
parentzebra: add zclient to iprules key (diff)
downloadfrr-b9668023622328468a30fe530bab86afdc914878.tar.xz
frr-b9668023622328468a30fe530bab86afdc914878.zip
Merge pull request #14543 from mjstapp/fix_pbr_rule_unique
zebra: add zclient to iprules key
-rw-r--r--zebra/zebra_pbr.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 5124768a7..c04c5f558 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -172,10 +172,13 @@ uint32_t zebra_pbr_rules_hash_key(const void *arg)
key = jhash_3words(rule->rule.filter.pcp, rule->rule.filter.vlan_id,
rule->rule.filter.vlan_flags, key);
- return jhash_3words(rule->rule.filter.src_port,
- rule->rule.filter.dst_port,
- prefix_hash_key(&rule->rule.filter.dst_ip),
- jhash_1word(rule->rule.unique, key));
+ key = jhash_3words(rule->rule.filter.src_port,
+ rule->rule.filter.dst_port,
+ prefix_hash_key(&rule->rule.filter.dst_ip), key);
+
+ key = jhash_2words(rule->rule.unique, rule->sock, key);
+
+ return key;
}
bool zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
@@ -191,6 +194,9 @@ bool zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
if (r1->rule.priority != r2->rule.priority)
return false;
+ if (r1->sock != r2->sock)
+ return false;
+
if (r1->rule.unique != r2->rule.unique)
return false;
@@ -226,6 +232,7 @@ bool zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
struct pbr_rule_unique_lookup {
struct zebra_pbr_rule *rule;
+ int sock;
uint32_t unique;
char ifname[INTERFACE_NAMSIZ + 1];
vrf_id_t vrf_id;
@@ -236,9 +243,9 @@ static int pbr_rule_lookup_unique_walker(struct hash_bucket *b, void *data)
struct pbr_rule_unique_lookup *pul = data;
struct zebra_pbr_rule *rule = b->data;
- if (pul->unique == rule->rule.unique
- && strncmp(pul->ifname, rule->rule.ifname, INTERFACE_NAMSIZ) == 0
- && pul->vrf_id == rule->vrf_id) {
+ if (pul->sock == rule->sock && pul->unique == rule->rule.unique &&
+ strmatch(pul->ifname, rule->rule.ifname) &&
+ pul->vrf_id == rule->vrf_id) {
pul->rule = rule;
return HASHWALK_ABORT;
}
@@ -255,6 +262,7 @@ pbr_rule_lookup_unique(struct zebra_pbr_rule *zrule)
strlcpy(pul.ifname, zrule->rule.ifname, INTERFACE_NAMSIZ);
pul.rule = NULL;
pul.vrf_id = zrule->vrf_id;
+ pul.sock = zrule->sock;
hash_walk(zrouter.rules_hash, &pbr_rule_lookup_unique_walker, &pul);
return pul.rule;