]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_zebra.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / isisd / isis_zebra.c
index ac640c5e4909c4b0ce4f729d4c44adcb858ebc44..101bd57cc932f0049b7b462141d56510a57e1cc6 100644 (file)
@@ -87,12 +87,6 @@ static int isis_zebra_if_add(int command, struct zclient *zclient,
 
        ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
 
-       if (isis->debugs & DEBUG_ZEBRA)
-               zlog_debug(
-                       "Zebra I/F add: %s index %d flags %ld metric %d mtu %d",
-                       ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
-                       ifp->mtu);
-
        if (if_is_operative(ifp))
                isis_csm_state_change(IF_UP_FROM_Z, circuit_scan_by_ifp(ifp),
                                      ifp);
@@ -116,12 +110,6 @@ static int isis_zebra_if_del(int command, struct zclient *zclient,
                zlog_warn("Zebra: got delete of %s, but interface is still up",
                          ifp->name);
 
-       if (isis->debugs & DEBUG_ZEBRA)
-               zlog_debug(
-                       "Zebra I/F delete: %s index %d flags %ld metric %d mtu %d",
-                       ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
-                       ifp->mtu);
-
        isis_csm_state_change(IF_DOWN_FROM_Z, circuit_scan_by_ifp(ifp), ifp);
 
        /* Cannot call if_delete because we should retain the pseudo interface
@@ -247,6 +235,7 @@ static int isis_zebra_link_params(int command, struct zclient *zclient,
 }
 
 static void isis_zebra_route_add_route(struct prefix *prefix,
+                                      struct prefix_ipv6 *src_p,
                                       struct isis_route_info *route_info)
 {
        struct zapi_route api;
@@ -260,10 +249,16 @@ static void isis_zebra_route_add_route(struct prefix *prefix,
                return;
 
        memset(&api, 0, sizeof(api));
+       if (fabricd)
+               api.flags |= ZEBRA_FLAG_ONLINK;
        api.vrf_id = VRF_DEFAULT;
-       api.type = ZEBRA_ROUTE_ISIS;
+       api.type = PROTO_TYPE;
        api.safi = SAFI_UNICAST;
        api.prefix = *prefix;
+       if (src_p && src_p->prefixlen) {
+               api.src_prefix = *src_p;
+               SET_FLAG(api.message, ZAPI_MESSAGE_SRCPFX);
+       }
        SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
        SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
        api.metric = route_info->cost;
@@ -322,6 +317,7 @@ static void isis_zebra_route_add_route(struct prefix *prefix,
 }
 
 static void isis_zebra_route_del_route(struct prefix *prefix,
+                                      struct prefix_ipv6 *src_p,
                                       struct isis_route_info *route_info)
 {
        struct zapi_route api;
@@ -331,24 +327,29 @@ static void isis_zebra_route_del_route(struct prefix *prefix,
 
        memset(&api, 0, sizeof(api));
        api.vrf_id = VRF_DEFAULT;
-       api.type = ZEBRA_ROUTE_ISIS;
+       api.type = PROTO_TYPE;
        api.safi = SAFI_UNICAST;
        api.prefix = *prefix;
+       if (src_p && src_p->prefixlen) {
+               api.src_prefix = *src_p;
+               SET_FLAG(api.message, ZAPI_MESSAGE_SRCPFX);
+       }
 
        zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
        UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
 }
 
 void isis_zebra_route_update(struct prefix *prefix,
+                            struct prefix_ipv6 *src_p,
                             struct isis_route_info *route_info)
 {
        if (zclient->sock < 0)
                return;
 
        if (CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ACTIVE))
-               isis_zebra_route_add_route(prefix, route_info);
+               isis_zebra_route_add_route(prefix, src_p, route_info);
        else
-               isis_zebra_route_del_route(prefix, route_info);
+               isis_zebra_route_del_route(prefix, src_p, route_info);
 }
 
 static int isis_zebra_read(int command, struct zclient *zclient,
@@ -359,24 +360,23 @@ static int isis_zebra_read(int command, struct zclient *zclient,
        if (zapi_route_decode(zclient->ibuf, &api) < 0)
                return -1;
 
-       /* we completely ignore srcdest routes for now. */
-       if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
-               return 0;
-
        /*
         * Avoid advertising a false default reachability. (A default
         * route installed by IS-IS gets redistributed from zebra back
         * into IS-IS causing us to start advertising default reachabity
         * without this check)
         */
-       if (api.prefix.prefixlen == 0 && api.type == ZEBRA_ROUTE_ISIS)
+       if (api.prefix.prefixlen == 0
+           && api.src_prefix.prefixlen == 0
+           && api.type == PROTO_TYPE) {
                command = ZEBRA_REDISTRIBUTE_ROUTE_DEL;
+       }
 
        if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
-               isis_redist_add(api.type, &api.prefix, api.distance,
-                               api.metric);
+               isis_redist_add(api.type, &api.prefix, &api.src_prefix,
+                               api.distance, api.metric);
        else
-               isis_redist_delete(api.type, &api.prefix);
+               isis_redist_delete(api.type, &api.prefix, &api.src_prefix);
 
        return 0;
 }
@@ -413,8 +413,8 @@ static void isis_zebra_connected(struct zclient *zclient)
 
 void isis_zebra_init(struct thread_master *master)
 {
-       zclient = zclient_new_notify(master, &zclient_options_default);
-       zclient_init(zclient, ZEBRA_ROUTE_ISIS, 0, &isisd_privs);
+       zclient = zclient_new(master, &zclient_options_default);
+       zclient_init(zclient, PROTO_TYPE, 0, &isisd_privs);
        zclient->zebra_connected = isis_zebra_connected;
        zclient->router_id_update = isis_router_id_update_zebra;
        zclient->interface_add = isis_zebra_if_add;