]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_zebra.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / ospf6d / ospf6_zebra.c
index 4fb959b952e63dbf64c0741878e9a7c1058e8587..5db9b529efe3cdbb73427c0679fa2c50110d2c39 100644 (file)
@@ -28,6 +28,7 @@
 #include "zclient.h"
 #include "memory.h"
 #include "lib/bfd.h"
+#include "lib_errors.h"
 
 #include "ospf6_proto.h"
 #include "ospf6_top.h"
@@ -55,13 +56,22 @@ static int ospf6_router_id_update_zebra(int command, struct zclient *zclient,
 
        zebra_router_id_update_read(zclient->ibuf, &router_id);
 
+       om6->zebra_router_id = router_id.u.prefix4.s_addr;
+
        if (o == NULL)
                return 0;
 
        o->router_id_zebra = router_id.u.prefix4;
+       if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
+               char buf[INET_ADDRSTRLEN];
 
-       if (o->router_id == 0)
-               o->router_id = (uint32_t)o->router_id_zebra.s_addr;
+               zlog_debug("%s: zebra router-id %s update",
+                          __PRETTY_FUNCTION__,
+                          inet_ntop(AF_INET, &router_id.u.prefix4,
+                                    buf, INET_ADDRSTRLEN));
+       }
+
+       ospf6_router_id_update();
 
        return 0;
 }
@@ -118,13 +128,6 @@ static int ospf6_zebra_if_del(int command, struct zclient *zclient,
                zlog_debug("Zebra Interface delete: %s index %d mtu %d",
                           ifp->name, ifp->ifindex, ifp->mtu6);
 
-#if 0
-  /* XXX: ospf6_interface_if_del is not the right way to handle this,
-   * because among other thinkable issues, it will also clear all
-   * settings as they are contained in the struct ospf6_interface. */
-  ospf6_interface_if_del (ifp);
-#endif /*0*/
-
        if_set_index(ifp, IFINDEX_INTERNAL);
        return 0;
 }
@@ -360,7 +363,8 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
                ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
 
        if (ret < 0)
-               zlog_err("zclient_route_send() %s failed: %s",
+               flog_err(EC_LIB_ZAPI_SOCKET,
+                        "zclient_route_send() %s failed: %s",
                         (type == REM ? "delete" : "add"),
                         safe_strerror(errno));
 
@@ -459,7 +463,7 @@ int ospf6_distance_set(struct vty *vty, struct ospf6 *o,
 {
        int ret;
        struct prefix_ipv6 p;
-       u_char distance;
+       uint8_t distance;
        struct route_node *rn;
        struct ospf6_distance *odistance;
 
@@ -544,7 +548,7 @@ void ospf6_distance_reset(struct ospf6 *o)
                }
 }
 
-u_char ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or)
+uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or)
 {
        struct ospf6 *o;
 
@@ -582,7 +586,7 @@ static void ospf6_zebra_connected(struct zclient *zclient)
 void ospf6_zebra_init(struct thread_master *master)
 {
        /* Allocate zebra structure. */
-       zclient = zclient_new_notify(master, &zclient_options_default);
+       zclient = zclient_new(master, &zclient_options_default);
        zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
        zclient->zebra_connected = ospf6_zebra_connected;
        zclient->router_id_update = ospf6_router_id_update_zebra;