]> git.proxmox.com Git - mirror_frr.git/blobdiff - pbrd/pbr_zebra.c
Merge pull request #5257 from ton31337/fix/update_rib_on_bgp_distance_changes
[mirror_frr.git] / pbrd / pbr_zebra.c
index d74d0fcd23d35e5acf4eb69e105a5e65164015f2..719374e3b9e0c20e86f6c43d5188174a8c9e0373 100644 (file)
@@ -59,15 +59,8 @@ struct pbr_interface *pbr_if_new(struct interface *ifp)
 }
 
 /* Inteface addition message from zebra. */
-static int interface_add(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_create(struct interface *ifp)
 {
-       struct interface *ifp;
-
-       ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
-       if (!ifp)
-               return 0;
-
        DEBUGD(&pbr_dbg_zebra,
               "%s: %s", __PRETTY_FUNCTION__, ifp->name);
 
@@ -79,24 +72,11 @@ static int interface_add(ZAPI_CALLBACK_ARGS)
        return 0;
 }
 
-static int interface_delete(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_destroy(struct interface *ifp)
 {
-       struct interface *ifp;
-       struct stream *s;
-
-       s = zclient->ibuf;
-       /* zebra_interface_state_read () updates interface structure in iflist
-        */
-       ifp = zebra_interface_state_read(s, vrf_id);
-
-       if (ifp == NULL)
-               return 0;
-
        DEBUGD(&pbr_dbg_zebra,
               "%s: %s", __PRETTY_FUNCTION__, ifp->name);
 
-       if_set_index(ifp, IFINDEX_INTERNAL);
-
        return 0;
 }
 
@@ -129,16 +109,12 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS)
               "%s: %s deleted %s", __PRETTY_FUNCTION__, c->ifp->name,
               prefix2str(c->address, buf, sizeof(buf)));
 
-       connected_free(c);
+       connected_free(&c);
        return 0;
 }
 
-static int interface_state_up(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_up(struct interface *ifp)
 {
-       struct interface *ifp;
-
-       ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
        DEBUGD(&pbr_dbg_zebra,
               "%s: %s is up", __PRETTY_FUNCTION__, ifp->name);
 
@@ -147,12 +123,8 @@ static int interface_state_up(ZAPI_CALLBACK_ARGS)
        return 0;
 }
 
-static int interface_state_down(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_down(struct interface *ifp)
 {
-       struct interface *ifp;
-
-       ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
        DEBUGD(&pbr_dbg_zebra,
               "%s: %s is down", __PRETTY_FUNCTION__, ifp->name);
 
@@ -447,10 +419,6 @@ void pbr_zebra_init(void)
 
        zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
        zclient->zebra_connected = zebra_connected;
-       zclient->interface_add = interface_add;
-       zclient->interface_delete = interface_delete;
-       zclient->interface_up = interface_state_up;
-       zclient->interface_down = interface_state_down;
        zclient->interface_address_add = interface_address_add;
        zclient->interface_address_delete = interface_address_delete;
        zclient->route_notify_owner = route_notify_owner;
@@ -482,6 +450,12 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg)
                p.family = AF_INET6;
                memcpy(&p.u.prefix6, &nhop->gate.ipv6, 16);
                p.prefixlen = 128;
+               if (IN6_IS_ADDR_LINKLOCAL(&nhop->gate.ipv6))
+                       /*
+                        * Don't bother tracking link locals, just track their
+                        * interface state.
+                        */
+                       return;
                break;
        }