]> git.proxmox.com Git - mirror_frr.git/blobdiff - pbrd/pbr_nht.c
Merge pull request #4765 from opensourcerouting/defaults-v2
[mirror_frr.git] / pbrd / pbr_nht.c
index ae04402f49351cc9b01724906b9b1d91b3e2fbf4..5ab714e617d458cd131a53516af1b62ec9ebaae6 100644 (file)
@@ -267,7 +267,9 @@ void pbr_nhgroup_add_nexthop_cb(const struct nexthop_group_cmd *nhgc,
        pbr_nht_install_nexthop_group(pnhgc, nhgc->nhg);
        pbr_map_check_nh_group_change(nhgc->name);
 
-       if (nhop->type == NEXTHOP_TYPE_IFINDEX) {
+       if (nhop->type == NEXTHOP_TYPE_IFINDEX
+           || (nhop->type == NEXTHOP_TYPE_IPV6_IFINDEX
+               && IN6_IS_ADDR_LINKLOCAL(&nhop->gate.ipv6))) {
                struct interface *ifp;
 
                ifp = if_lookup_by_index(nhop->ifindex, nhop->vrf_id);
@@ -546,20 +548,10 @@ void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence *pbrms)
        struct pbr_nexthop_group_cache find;
        struct pbr_nexthop_cache *pnhc;
        struct pbr_nexthop_cache lup;
-       struct pbr_map *pbrm = pbrms->parent;
-       struct listnode *node;
-       struct pbr_map_interface *pmi;
        struct nexthop *nh;
        enum nexthop_types_t nh_type = 0;
 
-       if (pbrm->valid && pbrms->nhs_installed && pbrm->incoming->count) {
-               for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, node, pmi))
-                       pbr_send_pbr_map(pbrms, pmi, false);
-       }
-
-       pbrm->valid = false;
-       pbrms->nhs_installed = false;
-       pbrms->reason |= PBR_MAP_INVALID_NO_NEXTHOPS;
+       pbr_map_delete_nexthops(pbrms);
 
        memset(&find, 0, sizeof(find));
        snprintf(find.name, sizeof(find.name), "%s", pbrms->internal_nhg_name);
@@ -576,8 +568,6 @@ void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence *pbrms)
 
        hash_release(pbr_nhg_hash, pnhgc);
 
-       _nexthop_del(pbrms->nhg, nh);
-       nexthop_free(nh);
        nexthop_group_delete(&pbrms->nhg);
        XFREE(MTYPE_TMP, pbrms->internal_nhg_name);
 }
@@ -637,7 +627,6 @@ void pbr_nht_delete_group(const char *name)
                        if (pbrms->nhgrp_name
                            && strmatch(pbrms->nhgrp_name, name)) {
                                pbrms->reason |= PBR_MAP_INVALID_NO_NEXTHOPS;
-                               nexthop_group_delete(&pbrms->nhg);
                                pbrms->nhg = NULL;
                                pbrms->internal_nhg_name = NULL;
                                pbrm->valid = false;
@@ -772,10 +761,15 @@ pbr_nht_individual_nexthop_update(struct pbr_nexthop_cache *pnhc,
        case NEXTHOP_TYPE_IFINDEX:
                pbr_nht_individual_nexthop_interface_update(pnhc, pnhi);
                break;
+       case NEXTHOP_TYPE_IPV6_IFINDEX:
+               if (IN6_IS_ADDR_LINKLOCAL(&pnhc->nexthop->gate.ipv6)) {
+                       pbr_nht_individual_nexthop_interface_update(pnhc, pnhi);
+                       break;
+               }
+               /* Intentional fall thru */
+       case NEXTHOP_TYPE_IPV4_IFINDEX:
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV6:
-       case NEXTHOP_TYPE_IPV4_IFINDEX:
-       case NEXTHOP_TYPE_IPV6_IFINDEX:
                pbr_nht_individual_nexthop_gw_update(pnhc, pnhi);
                break;
        case NEXTHOP_TYPE_BLACKHOLE: