summaryrefslogtreecommitdiff
path: root/pbrd/pbr_nht.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbrd/pbr_nht.c')
-rw-r--r--pbrd/pbr_nht.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c
index 405a2d6588..ff252f8505 100644
--- a/pbrd/pbr_nht.c
+++ b/pbrd/pbr_nht.c
@@ -534,6 +534,7 @@ void pbr_nht_set_seq_nhg_data(struct pbr_map_sequence *pbrms,
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
pbrms->family = AF_INET;
+ break;
case NEXTHOP_TYPE_IFINDEX:
case NEXTHOP_TYPE_BLACKHOLE:
break;
@@ -549,6 +550,7 @@ void pbr_nht_set_seq_nhg(struct pbr_map_sequence *pbrms, const char *name)
return;
pbrms->nhgrp_name = XSTRDUP(MTYPE_TMP, name);
+ pbrms->forwarding_type = PBR_FT_NEXTHOP_GROUP;
nhgc = nhgc_find(name);
if (!nhgc)
@@ -572,6 +574,7 @@ void pbr_nht_add_individual_nexthop(struct pbr_map_sequence *pbrms,
MTYPE_TMP,
pbr_nht_nexthop_make_name(pbrms->parent->name, PBR_NHC_NAMELEN,
pbrms->seqno, buf));
+ pbrms->forwarding_type = PBR_FT_NEXTHOP_SINGLE;
nh = nexthop_new();
memcpy(nh, nhop, sizeof(*nh));
@@ -647,7 +650,15 @@ static void pbr_nht_release_individual_nexthop(struct pbr_map_sequence *pbrms)
void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence *pbrms)
{
- pbr_map_delete_nexthops(pbrms);
+ struct pbr_map *pbrm = pbrms->parent;
+
+ /* The idea here is to send a delete command to zebra only once,
+ * and set 'valid' and 'installed' to false only when the last
+ * rule is being deleted. In other words, the pbr common should be
+ * updated only when the last rule is being updated or deleted.
+ */
+ if (pbrm->seqnumbers->count == 1)
+ pbr_map_delete_nexthops(pbrms);
pbr_nht_release_individual_nexthop(pbrms);
}
@@ -887,7 +898,7 @@ static void pbr_nht_individual_nexthop_update(struct pbr_nexthop_cache *pnhc,
pbr_nht_individual_nexthop_interface_update(pnhc, pnhi);
break;
}
- /* Intentional fall thru */
+ fallthrough;
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV6: