summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgpd.c1
-rw-r--r--pimd/pim_igmp_mtrace.c15
-rw-r--r--zebra/zebra_pbr.c46
-rw-r--r--zebra/zebra_vty.c5
4 files changed, 59 insertions, 8 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index c178727b54..d103584594 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2863,6 +2863,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
}
bgp_lock(bgp);
+ bgp->heuristic_coalesce = true;
bgp->inst_type = inst_type;
bgp->vrf_id = (inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? VRF_DEFAULT
: VRF_UNKNOWN;
diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c
index 5167aa0495..b183492e3e 100644
--- a/pimd/pim_igmp_mtrace.c
+++ b/pimd/pim_igmp_mtrace.c
@@ -101,6 +101,13 @@ static void mtrace_debug(struct pim_interface *pim_ifp,
char dst_str[INET_ADDRSTRLEN];
char rsp_str[INET_ADDRSTRLEN];
+ struct in_addr ga, sa, da, ra;
+
+ ga = mtracep->grp_addr;
+ sa = mtracep->src_addr;
+ da = mtracep->dst_addr;
+ ra = mtracep->rsp_addr;
+
zlog_debug(
"Rx mtrace packet incoming on %s: "
"hops=%d type=%d size=%d, grp=%s, src=%s,"
@@ -108,13 +115,13 @@ static void mtrace_debug(struct pim_interface *pim_ifp,
inet_ntop(AF_INET, &(pim_ifp->primary_address), inc_str,
sizeof(inc_str)),
mtracep->hops, mtracep->type, mtrace_len,
- inet_ntop(AF_INET, &(mtracep->grp_addr), grp_str,
+ inet_ntop(AF_INET, &ga, grp_str,
sizeof(grp_str)),
- inet_ntop(AF_INET, &(mtracep->src_addr), src_str,
+ inet_ntop(AF_INET, &sa, src_str,
sizeof(src_str)),
- inet_ntop(AF_INET, &(mtracep->dst_addr), dst_str,
+ inet_ntop(AF_INET, &da, dst_str,
sizeof(dst_str)),
- inet_ntop(AF_INET, &(mtracep->rsp_addr), rsp_str,
+ inet_ntop(AF_INET, &ra, rsp_str,
sizeof(rsp_str)),
mtracep->rsp_ttl, ntohl(mtracep->qry_id));
if (mtrace_len > (int)sizeof(struct igmp_mtrace)) {
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 090ec2c502..4b93168846 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -99,6 +99,36 @@ int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
return 1;
}
+struct pbr_unique_lookup {
+ struct zebra_pbr_rule *rule;
+ uint32_t unique;
+};
+
+static int pbr_rule_lookup_unique_walker(struct hash_backet *b, void *data)
+{
+ struct pbr_unique_lookup *pul = data;
+ struct zebra_pbr_rule *rule = b->data;
+
+ if (pul->unique == rule->unique) {
+ pul->rule = rule;
+ return HASHWALK_ABORT;
+ }
+
+ return HASHWALK_CONTINUE;
+}
+
+static struct zebra_pbr_rule *pbr_rule_lookup_unique(struct zebra_ns *zns,
+ uint32_t unique)
+{
+ struct pbr_unique_lookup pul;
+
+ pul.unique = unique;
+ pul.rule = NULL;
+ hash_walk(zns->rules_hash, &pbr_rule_lookup_unique_walker, &pul);
+
+ return pul.rule;
+}
+
static void *pbr_rule_alloc_intern(void *arg)
{
struct zebra_pbr_rule *zpr;
@@ -115,8 +145,18 @@ static void *pbr_rule_alloc_intern(void *arg)
void zebra_pbr_add_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule)
{
+ struct zebra_pbr_rule *unique =
+ pbr_rule_lookup_unique(zns, rule->unique);
+
(void)hash_get(zns->rules_hash, rule, pbr_rule_alloc_intern);
kernel_add_pbr_rule(rule);
+
+ /*
+ * Rule Replace semantics, if we have an old, install the
+ * new rule, look above, and then delete the old
+ */
+ if (unique)
+ zebra_pbr_del_rule(zns, unique);
}
void zebra_pbr_del_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule)
@@ -126,9 +166,10 @@ void zebra_pbr_del_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule)
lookup = hash_lookup(zns->rules_hash, rule);
kernel_del_pbr_rule(rule);
- if (lookup)
+ if (lookup) {
+ hash_release(zns->rules_hash, lookup);
XFREE(MTYPE_TMP, lookup);
- else
+ } else
zlog_warn("%s: Rule being deleted we know nothing about",
__PRETTY_FUNCTION__);
}
@@ -142,6 +183,7 @@ static void zebra_pbr_cleanup_rules(struct hash_backet *b, void *data)
if (rule->sock == *sock) {
kernel_del_pbr_rule(rule);
hash_release(zns->rules_hash, rule);
+ XFREE(MTYPE_TMP, rule);
}
}
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index b65f4b8eb5..3285176103 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -156,7 +156,7 @@ static int static_list_compare(void *arg1, void *arg2)
if (ret)
return ret;
- ret = shr1->safi - shr2->afi;
+ ret = shr1->safi - shr2->safi;
if (ret)
return ret;
@@ -259,7 +259,8 @@ static int zebra_static_route_holdem(struct zebra_vrf *zvrf,
return CMD_SUCCESS;
}
- listnode_add_sort(static_list, shr);
+ if (!negate)
+ listnode_add_sort(static_list, shr);
return CMD_SUCCESS;
}