]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib,zebra,sharpd: clang format
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 28 Jul 2020 21:36:51 +0000 (17:36 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Mon, 28 Sep 2020 16:41:00 +0000 (12:41 -0400)
Clang format for NHG API and sharpd patches.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
lib/zclient.c
lib/zclient.h
sharpd/sharp_nht.c
sharpd/sharp_vty.c
sharpd/sharp_zebra.c
zebra/rt_netlink.c
zebra/zapi_msg.c
zebra/zebra_vty.c

index 2e65e3c9f78e992ae422ba4435164ded458362b8..dfb409426db2881fef549d5b7e611c6ec870da8f 100644 (file)
@@ -1053,8 +1053,8 @@ static void zclient_nhg_writer(struct stream *s, uint16_t proto, int cmd,
        stream_putw_at(s, 0, stream_get_endp(s));
 }
 
-extern void zclient_nhg_add(struct zclient *zclient, uint32_t id,
-                           size_t nhops, struct zapi_nexthop *znh)
+extern void zclient_nhg_add(struct zclient *zclient, uint32_t id, size_t nhops,
+                           struct zapi_nexthop *znh)
 {
        struct stream *s = zclient->obuf;
 
index 3ac9ca945641d7704e2435d1ef3bc258010a942e..0fbe1de290e8180c214f77f1726172d0e0a31b42 100644 (file)
@@ -374,7 +374,7 @@ struct zclient {
 #define ZAPI_MESSAGE_SRCPFX   0x20
 /* Backup nexthops are present */
 #define ZAPI_MESSAGE_BACKUP_NEXTHOPS 0x40
-#define ZAPI_MESSAGE_NHG      0x80
+#define ZAPI_MESSAGE_NHG 0x80
 
 /*
  * This should only be used by a DAEMON that needs to communicate
@@ -898,8 +898,7 @@ bool zapi_ipset_notify_decode(struct stream *s,
                              uint32_t *unique,
                             enum zapi_ipset_notify_owner *note);
 
-extern void zclient_nhg_add(struct zclient *zclient,
-                           uint32_t id, size_t nhops,
+extern void zclient_nhg_add(struct zclient *zclient, uint32_t id, size_t nhops,
                            struct zapi_nexthop *znh);
 extern void zclient_nhg_del(struct zclient *zclient, uint32_t id);
 
index 4c32dc279d91b25de7f0e0ed632094543a260073..38de8f217acd5c40c23bc814c44ac45f843c584b 100644 (file)
@@ -109,7 +109,7 @@ static struct sharp_nhg *sharp_nhgroup_find_id(uint32_t id)
         * to sharpd with another RB tree for just IDs
         */
 
-       frr_each(sharp_nhg_rb, &nhg_head, lookup) {
+       frr_each (sharp_nhg_rb, &nhg_head, lookup) {
                if (lookup->id == id)
                        return lookup;
        }
index 2903588c1355b2a5670d604772f880a76bcb4ee3..d062f027ab67e26fe4eff237146f8107f29c1910 100644 (file)
@@ -299,9 +299,9 @@ DEFPY (install_routes,
        sg.r.inst = instance;
        sg.r.vrf_id = vrf->vrf_id;
        rts = routes;
-       sharp_install_routes_helper(&prefix, sg.r.vrf_id, sg.r.inst,
-                                   nhgid, &sg.r.nhop_group,
-                                   &sg.r.backup_nhop_group, rts);
+       sharp_install_routes_helper(&prefix, sg.r.vrf_id, sg.r.inst, nhgid,
+                                   &sg.r.nhop_group, &sg.r.backup_nhop_group,
+                                   rts);
 
        return CMD_SUCCESS;
 }
index 6be1176db5daa5a6c3690022f6e64fce57687b74..03def0d9bae6aa91ffe58e65af8ffbe2da4cd878 100644 (file)
@@ -288,8 +288,7 @@ static void handle_repeated(bool installed)
        if (!installed) {
                sg.r.installed_routes = 0;
                sharp_install_routes_helper(&p, sg.r.vrf_id, sg.r.inst,
-                                           sg.r.nhgid,
-                                           &sg.r.nhop_group,
+                                           sg.r.nhgid, &sg.r.nhop_group,
                                            &sg.r.backup_nhop_group,
                                            sg.r.total_routes);
        }
@@ -383,9 +382,8 @@ void nhg_del(uint32_t id)
        zclient_send_message(zclient);
 }
 
-void route_add(const struct prefix *p, vrf_id_t vrf_id,
-              uint8_t instance, uint32_t nhgid,
-              const struct nexthop_group *nhg,
+void route_add(const struct prefix *p, vrf_id_t vrf_id, uint8_t instance,
+              uint32_t nhgid, const struct nexthop_group *nhg,
               const struct nexthop_group *backup_nhg)
 {
        struct zapi_route api;
index 46de751f954d5b28846557134a326a48a9ccc8ea..1ce3c435feda5e65e10b03b4ff00d709685502c2 100644 (file)
@@ -2269,7 +2269,7 @@ nexthop_done:
                                           nh->vrf_id, label_buf);
 }
 
-               req->nhm.nh_protocol = zebra2proto(type);
+req->nhm.nh_protocol = zebra2proto(type);
 
        } else if (cmd != RTM_DELNEXTHOP) {
                flog_err(
index 5bf8fd302db14bac76fadd683cd7daf5197b7170..0e4270079c6319dc1fc970d6beddd5b737dfa311 100644 (file)
@@ -1508,8 +1508,7 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
                        memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4),
                               sizeof(struct in_addr));
                        zebra_vxlan_evpn_vrf_route_add(
-                               api_nh->vrf_id, &api_nh->rmac,
-                               &vtep_ip, p);
+                               api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p);
                }
                break;
        case NEXTHOP_TYPE_IPV6:
@@ -1542,8 +1541,7 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
                        memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6),
                               sizeof(struct in6_addr));
                        zebra_vxlan_evpn_vrf_route_add(
-                               api_nh->vrf_id, &api_nh->rmac,
-                               &vtep_ip, p);
+                               api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p);
                }
                break;
        case NEXTHOP_TYPE_BLACKHOLE:
@@ -1660,7 +1658,8 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p,
                        return false;
                }
 
-               if (bnhg && CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_HAS_BACKUP)) {
+               if (bnhg
+                   && CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_HAS_BACKUP)) {
                        if (IS_ZEBRA_DEBUG_RECV) {
                                nexthop2str(nexthop, nhbuf, sizeof(nhbuf));
                                zlog_debug("%s: backup nh %s with BACKUP flag!",
@@ -1707,18 +1706,19 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p,
 
                if (png) {
                        /* Add new nexthop to temporary list. This list is
-                        * canonicalized - sorted - so that it can be hashed later
-                        * in route processing. We expect that the sender has sent
-                        * the list sorted, and the zapi client api attempts to enforce
-                        * that, so this should be inexpensive - but it is necessary
-                        * to support shared nexthop-groups.
+                        * canonicalized - sorted - so that it can be hashed
+                        * later in route processing. We expect that the sender
+                        * has sent the list sorted, and the zapi client api
+                        * attempts to enforce that, so this should be
+                        * inexpensive - but it is necessary to support shared
+                        * nexthop-groups.
                         */
                        nexthop_group_add_sorted(ng, nexthop);
                }
                if (bnhg) {
-                       /* Note that the order of the backup nexthops is significant,
-                        * so we don't sort this list as we do the primary nexthops,
-                        * we just append.
+                       /* Note that the order of the backup nexthops is
+                        * significant, so we don't sort this list as we do the
+                        * primary nexthops, we just append.
                         */
                        if (last_nh)
                                NEXTHOP_APPEND(last_nh, nexthop);
@@ -1792,8 +1792,7 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS)
 
                if (zapi_nexthop_decode(s, znh, 0, 0) != 0) {
                        flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
-                                 "%s: Nexthop creation failed",
-                                 __func__);
+                                 "%s: Nexthop creation failed", __func__);
                        return;
                }
        }
@@ -1801,8 +1800,7 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS)
        if (!zapi_read_nexthops(client, NULL, zapi_nexthops, 0, 0, nhops, 0,
                                &nhg, NULL)) {
                flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
-                         "%s: Nexthop Group Creation failed",
-                         __func__);
+                         "%s: Nexthop Group Creation failed", __func__);
                return;
        }
 
@@ -1827,9 +1825,10 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS)
        return;
 
 stream_failure:
-       flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
-                 "%s: Nexthop Group creation failed with some sort of stream read failure",
-                 __func__);
+       flog_warn(
+               EC_ZEBRA_NEXTHOP_CREATION_FAILED,
+               "%s: Nexthop Group creation failed with some sort of stream read failure",
+               __func__);
        return;
 }
 
@@ -1881,22 +1880,24 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
        if (!CHECK_FLAG(api.message, ZAPI_MESSAGE_NHG)
            && (!CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)
                || api.nexthop_num == 0)) {
-               flog_warn(EC_ZEBRA_RX_ROUTE_NO_NEXTHOPS,
-                         "%s: received a route without nexthops for prefix %pFX from client %s",
-                         __func__, &api.prefix,
-                         zebra_route_string(client->proto));
+               flog_warn(
+                       EC_ZEBRA_RX_ROUTE_NO_NEXTHOPS,
+                       "%s: received a route without nexthops for prefix %pFX from client %s",
+                       __func__, &api.prefix,
+                       zebra_route_string(client->proto));
 
                XFREE(MTYPE_RE, re);
                return;
        }
 
        /* Report misuse of the backup flag */
-       if (CHECK_FLAG(api.message, ZAPI_MESSAGE_BACKUP_NEXTHOPS) &&
-           api.backup_nexthop_num == 0) {
+       if (CHECK_FLAG(api.message, ZAPI_MESSAGE_BACKUP_NEXTHOPS)
+           && api.backup_nexthop_num == 0) {
                if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_EVENT)
-                       zlog_debug("%s: client %s: BACKUP flag set but no backup nexthops, prefix %pFX",
-                               __func__,
-                               zebra_route_string(client->proto), &api.prefix);
+                       zlog_debug(
+                               "%s: client %s: BACKUP flag set but no backup nexthops, prefix %pFX",
+                               __func__, zebra_route_string(client->proto),
+                               &api.prefix);
        }
 
        if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NHG))
index 7e73b3f724eff9f3637156a27c1cf9e6dd1ab109..67851517058fb238f3a44543a9c2292f24110e94 100644 (file)
@@ -1566,14 +1566,12 @@ DEFPY_HIDDEN(nexthop_group_use_enable,
        return CMD_SUCCESS;
 }
 
-DEFPY_HIDDEN (proto_nexthop_group_only,
-              proto_nexthop_group_only_cmd,
-              "[no] zebra nexthop proto only",
-              NO_STR
-              ZEBRA_STR
-              "Nexthop configuration\n"
-              "Configure exclusive use of proto nexthops\n"
-              "Only use proto nexthops\n")
+DEFPY_HIDDEN(proto_nexthop_group_only, proto_nexthop_group_only_cmd,
+            "[no] zebra nexthop proto only",
+            NO_STR ZEBRA_STR
+            "Nexthop configuration\n"
+            "Configure exclusive use of proto nexthops\n"
+            "Only use proto nexthops\n")
 {
        zebra_nhg_set_proto_nexthops_only(!no);
        return CMD_SUCCESS;