]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/ldp_zebra.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / ldpd / ldp_zebra.c
index 02cd1678e9b6d56dd4cabaa682b4da13b5ecb0ed..2010829035a181b6747f3e4cac902024246c3450 100644 (file)
@@ -22,8 +22,7 @@
 #include "ldp_debug.h"
 
 static void     ifp2kif(struct interface *, struct kif *);
-static void     ifc2kaddr(struct interface *, struct connected *,
-                   struct kaddr *);
+static void     ifc2kaddr(struct interface *, struct connected *, struct kaddr *);
 static int      ldp_zebra_send_mpls_labels(int, struct kroute *);
 static int      ldp_router_id_update(ZAPI_CALLBACK_ARGS);
 static int      ldp_interface_address_add(ZAPI_CALLBACK_ARGS);
@@ -89,7 +88,7 @@ pw2zpw(struct l2vpn_pw *pw, struct zapi_pw *zpw)
        zpw->nexthop.ipv6 = pw->addr.v6;
        zpw->local_label = NO_LABEL;
        zpw->remote_label = NO_LABEL;
-       if (pw->flags & F_PW_CWORD)
+       if (CHECK_FLAG(pw->flags, F_PW_CWORD))
                zpw->flags = F_PSEUDOWIRE_CWORD;
        zpw->data.ldp.lsr_id = pw->lsr_id;
        zpw->data.ldp.pwid = pw->pwid;
@@ -162,10 +161,10 @@ ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
        struct zapi_rlfa_igp igp;
        struct zapi_rlfa_request rlfa;
 
-        s = zclient->ibuf;
+       s = zclient->ibuf;
 
-        if (zclient_opaque_decode(s, &info) != 0)
-                return -1;
+       if(zclient_opaque_decode(s, &info) != 0)
+               return -1;
 
        switch (info.type) {
        case LDP_IGP_SYNC_IF_STATE_REQUEST:
@@ -239,7 +238,7 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr)
         * dropping them).
         */
        if (kr->remote_label == NO_LABEL
-           && !(ldpd_conf->flags & F_LDPD_ALLOW_BROKEN_LSP)
+           && !CHECK_FLAG(ldpd_conf->flags, F_LDPD_ALLOW_BROKEN_LSP)
            && cmd == ZEBRA_MPLS_LABELS_ADD)
                return 0;
 
@@ -295,8 +294,7 @@ kmpw_add(struct zapi_pw *zpw)
        debug_zebra_out("pseudowire %s nexthop %s (add)",
            zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
 
-       return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw)
-              == ZCLIENT_SEND_FAILURE;
+       return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw) == ZCLIENT_SEND_FAILURE;
 }
 
 int
@@ -305,8 +303,7 @@ kmpw_del(struct zapi_pw *zpw)
        debug_zebra_out("pseudowire %s nexthop %s (del)",
            zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
 
-       return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw)
-              == ZCLIENT_SEND_FAILURE;
+       return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw) == ZCLIENT_SEND_FAILURE;
 }
 
 int
@@ -316,8 +313,7 @@ kmpw_set(struct zapi_pw *zpw)
            zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop),
            zpw->local_label, zpw->remote_label);
 
-       return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw)
-              == ZCLIENT_SEND_FAILURE;
+       return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw) == ZCLIENT_SEND_FAILURE;
 }
 
 int
@@ -326,8 +322,7 @@ kmpw_unset(struct zapi_pw *zpw)
        debug_zebra_out("pseudowire %s nexthop %s (unset)",
            zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
 
-       return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw)
-              == ZCLIENT_SEND_FAILURE;
+       return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw) == ZCLIENT_SEND_FAILURE;
 }
 
 void
@@ -349,8 +344,7 @@ kif_redistribute(const char *ifname)
 
                for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, ifc)) {
                        ifc2kaddr(ifp, ifc, &ka);
-                       main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,
-                           sizeof(ka));
+                       main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
                }
        }
 }
@@ -418,14 +412,12 @@ ldp_interface_status_change(struct interface *ifp)
        if (if_is_operative(ifp)) {
                for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
                        ifc2kaddr(ifp, ifc, &ka);
-                       main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,
-                           sizeof(ka));
+                       main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
                }
        } else {
                for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
                        ifc2kaddr(ifp, ifc, &ka);
-                       main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka,
-                           sizeof(ka));
+                       main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka, sizeof(ka));
                }
        }
 
@@ -530,7 +522,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
 
        switch (api.type) {
        case ZEBRA_ROUTE_CONNECT:
-               kr.flags |= F_CONNECTED;
+               SET_FLAG(kr.flags, F_CONNECTED);
                break;
        case ZEBRA_ROUTE_BGP:
                /* LDP should follow the IGP and ignore BGP routes */
@@ -580,7 +572,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
                        kr.ifindex = api_nh->ifindex;
                        break;
                case NEXTHOP_TYPE_IFINDEX:
-                       if (!(kr.flags & F_CONNECTED))
+                       if (!CHECK_FLAG(kr.flags, F_CONNECTED))
                                continue;
                        break;
                case NEXTHOP_TYPE_BLACKHOLE:
@@ -593,8 +585,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
                    zebra_route_string(api.type));
 
                if (add)
-                       main_imsg_compose_lde(IMSG_NETWORK_ADD, 0, &kr,
-                           sizeof(kr));
+                       main_imsg_compose_lde(IMSG_NETWORK_ADD, 0, &kr, sizeof(kr));
        }
 
        main_imsg_compose_lde(IMSG_NETWORK_UPDATE, 0, &kr, sizeof(kr));
@@ -655,7 +646,7 @@ ldp_zebra_connected(struct zclient *zclient)
 
        /* if MPLS was already enabled and we are re-connecting, register again
         */
-       if (vty_conf->flags & F_LDPD_ENABLED)
+       if (CHECK_FLAG(vty_conf->flags, F_LDPD_ENABLED))
                ldp_zebra_regdereg_zebra_info(true);
 
        ldp_zebra_opaque_register();
@@ -670,11 +661,9 @@ ldp_zebra_filter_update(struct access_list *access)
 
        if (access && access->name[0] != '\0') {
                strlcpy(laccess.name, access->name, sizeof(laccess.name));
-               debug_evt("%s ACL update filter name %s", __func__,
-                         access->name);
+               debug_evt("%s ACL update filter name %s", __func__, access->name);
 
-               main_imsg_compose_both(IMSG_FILTER_UPDATE, &laccess,
-                       sizeof(laccess));
+               main_imsg_compose_both(IMSG_FILTER_UPDATE, &laccess, sizeof(laccess));
        }
 }
 
@@ -692,8 +681,7 @@ static zclient_handler *const ldp_handlers[] = {
 
 void ldp_zebra_init(struct event_loop *master)
 {
-       if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up,
-                         ldp_ifp_down, ldp_ifp_destroy);
+       if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up, ldp_ifp_down, ldp_ifp_destroy);
 
        /* Set default values. */
        zclient = zclient_new(master, &zclient_options_default, ldp_handlers,