]> git.proxmox.com Git - mirror_frr.git/commitdiff
*: fix code format accourding to checkpatch
authorHiroki Shirokura <slank.dev@gmail.com>
Wed, 24 Feb 2021 10:10:06 +0000 (10:10 +0000)
committerMark Stapp <mjs@voltanet.io>
Wed, 2 Jun 2021 14:24:48 +0000 (10:24 -0400)
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
bgpd/bgp_mplsvpn.c
bgpd/bgp_mplsvpn.h
bgpd/bgp_nb_config.c
bgpd/bgp_vty.c
bgpd/bgp_zebra.c

index 2d0c9ec0179a33f583f107714092d20327d29b84..33266ef511b37c658936bf22aa83698cea9bfb98 100644 (file)
@@ -366,7 +366,7 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi)
 {
        int debug = BGP_DEBUG(vpn, VPN_LEAK_LABEL);
        enum seg6local_action_t act;
-       struct seg6local_context ctx = {{0}};
+       struct seg6local_context ctx = { {0} };
        struct in6_addr *tovpn_sid = NULL;
        struct in6_addr *tovpn_sid_ls = NULL;
        struct vrf *vrf;
@@ -374,8 +374,7 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi)
 
        if (bgp->vrf_id == VRF_UNKNOWN) {
                if (debug)
-                       zlog_debug("%s: vrf %s: afi %s: vrf_id not set, "
-                                  "can't set zebra vrf label",
+                       zlog_debug("%s: vrf %s: afi %s: vrf_id not set, can't set zebra vrf label",
                                   __func__, bgp->name_pretty, afi2str(afi));
                return;
        }
@@ -419,8 +418,7 @@ void vpn_leak_zebra_vrf_sid_withdraw(struct bgp *bgp, afi_t afi)
 
        if (bgp->vrf_id == VRF_UNKNOWN) {
                if (debug)
-                       zlog_debug("%s: vrf %s: afi %s: vrf_id not set, "
-                                  "can't set zebra vrf label",
+                       zlog_debug("%s: vrf %s: afi %s: vrf_id not set, can't set zebra vrf label",
                                   __func__, bgp->name_pretty, afi2str(afi));
                return;
        }
@@ -513,14 +511,17 @@ static bool sid_exist(struct bgp *bgp, const struct in6_addr *sid)
 {
        struct listnode *node;
        struct bgp_srv6_function *func;
+
        for (ALL_LIST_ELEMENTS_RO(bgp->srv6_functions, node, func))
                if (sid_same(&func->sid, sid))
                        return true;
        return false;
 }
 
-/* if index != 0: try to allocate as index-mode
- * else: try to allocate as auto-mode */
+/*
+ * if index != 0: try to allocate as index-mode
+ * else: try to allocate as auto-mode
+ */
 static bool alloc_new_sid(struct bgp *bgp, uint32_t index,
                          struct in6_addr *sid)
 {
@@ -540,14 +541,14 @@ static bool alloc_new_sid(struct bgp *bgp, uint32_t index,
                                return false;
                        alloced = true;
                        break;
-               } else {
-                       for (size_t i=1; i<255; i++) {
-                               sid_buf.s6_addr16[7] = i;
-                               if (sid_exist(bgp, &sid_buf))
-                                       continue;
-                               alloced = true;
-                               break;
-                       }
+               }
+
+               for (size_t i = 1; i < 255; i++) {
+                       sid_buf.s6_addr16[7] = i;
+                       if (sid_exist(bgp, &sid_buf))
+                               continue;
+                       alloced = true;
+                       break;
                }
        }
 
@@ -576,8 +577,10 @@ void ensure_vrf_tovpn_sid(struct bgp *bgp_vpn, struct bgp *bgp_vrf, afi_t afi)
        if (bgp_vrf->vpn_policy[afi].tovpn_sid)
                return;
 
-       /* skip when bgp vpn instance ins't allocated
-        * or srv6 locator chunk isn't allocated */
+       /*
+        * skip when bgp vpn instance ins't allocated
+        * or srv6 locator chunk isn't allocated
+        */
        if (!bgp_vpn || !bgp_vpn->srv6_locator_chunks || !bgp_vrf)
                return;
 
@@ -611,7 +614,6 @@ void ensure_vrf_tovpn_sid(struct bgp *bgp_vpn, struct bgp *bgp_vrf, afi_t afi)
                           afi2str(afi));
        }
        bgp_vrf->vpn_policy[afi].tovpn_sid = sid;
-       return;
 }
 
 static bool ecom_intersect(struct ecommunity *e1, struct ecommunity *e2)
@@ -705,9 +707,8 @@ static void setsids(struct bgp_path_info *bpi,
        }
 
        extra = bgp_path_info_extra_get(bpi);
-       for (i = 0; i < num_sids; i++) {
+       for (i = 0; i < num_sids; i++)
                memcpy(&extra->sid[i], &sid[i], sizeof(struct in6_addr));
-       }
        extra->num_sids = num_sids;
 }
 
@@ -726,8 +727,8 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
        struct bgp_path_info *bpi;
        struct bgp_path_info *bpi_ultimate;
        struct bgp_path_info *new;
-
        uint32_t num_sids = 0;
+
        if (new_attr->srv6_l3vpn || new_attr->srv6_vpn)
                num_sids = 1;
 
@@ -813,9 +814,11 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
                 */
                if (num_sids) {
                        if (new_attr->srv6_l3vpn)
-                               setsids(bpi, &new_attr->srv6_l3vpn->sid, num_sids);
+                               setsids(bpi, &new_attr->srv6_l3vpn->sid,
+                                       num_sids);
                        else if (new_attr->srv6_vpn)
-                               setsids(bpi, &new_attr->srv6_vpn->sid, num_sids);
+                               setsids(bpi, &new_attr->srv6_vpn->sid,
+                                       num_sids);
                }
 
                if (nexthop_self_flag)
@@ -1149,7 +1152,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn,            /* to */
        /* Set SID for SRv6 VPN */
        if (!sid_zero(bgp_vrf->vpn_policy[afi].tovpn_sid)) {
                static_attr.srv6_l3vpn = XCALLOC(MTYPE_BGP_SRV6_L3VPN,
-                               sizeof(struct bgp_attr_srv6_l3vpn)* 100);
+                               sizeof(struct bgp_attr_srv6_l3vpn) * 100);
                static_attr.srv6_l3vpn->sid_flags = 0x00;
                static_attr.srv6_l3vpn->endpoint_behavior = 0xffff;
                memcpy(&static_attr.srv6_l3vpn->sid,
index 172372bdf0bfa59b3a1982403ac901b1286620d7..38193721b3e04344f3ee667b13fd1e374e559390 100644 (file)
@@ -244,8 +244,8 @@ static inline void vpn_leak_postchange(vpn_policy_direction_t direction,
                        ensure_vrf_tovpn_sid(bgp_vpn, bgp_vrf, afi);
 
                if (sid_diff(bgp_vrf->vpn_policy[afi].tovpn_sid,
-                            bgp_vrf->vpn_policy[afi].
-                            tovpn_zebra_vrf_sid_last_sent)) {
+                            bgp_vrf->vpn_policy[afi]
+                                    .tovpn_zebra_vrf_sid_last_sent)) {
                        vpn_leak_zebra_vrf_sid_update(bgp_vrf, afi);
                }
 
index e83b9e20a84b34d9ea9ae0b96090b2dd089e27e3..5189d7ba8ff9243b5f8be0d7b9a3cba98e45b38e 100644 (file)
@@ -11451,8 +11451,8 @@ int bgp_global_afi_safis_afi_safi_ipv6_unicast_vpn_config_import_vpn_modify(
                if (!bgp)
                        return NB_OK;
 
-               if (BGP_INSTANCE_TYPE_VRF != bgp->inst_type
-                   && BGP_INSTANCE_TYPE_DEFAULT != bgp->inst_type) {
+               if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF
+                   && bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT) {
                        snprintf(
                                args->errmsg, args->errmsg_len,
                                "import|export vpn valid only for bgp vrf or default instance");
@@ -11491,8 +11491,8 @@ int bgp_global_afi_safis_afi_safi_ipv6_unicast_vpn_config_export_vpn_modify(
                if (!bgp)
                        return NB_OK;
 
-               if (BGP_INSTANCE_TYPE_VRF != bgp->inst_type
-                   && BGP_INSTANCE_TYPE_DEFAULT != bgp->inst_type) {
+               if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF
+                   && bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT) {
                        snprintf(
                                args->errmsg, args->errmsg_len,
                                "import|export vpn valid only for bgp vrf or default instance");
index 03c4e69591bf0dd0b8756957f3beb7ed7a01d850..db3a15d481596143cf4fe11bf1f15bcb4684fb71 100644 (file)
@@ -9269,9 +9269,10 @@ DEFPY (af_sid_vpn_export,
                                       BGP_VPN_POLICY_TOVPN_SID_AUTO)))
                return CMD_SUCCESS;
 
-       /* mode change between sid_idx and sid_auto isn't supported.
-        * user must negate sid vpn export when they want to change
-        * the mode */
+       /*
+        * mode change between sid_idx and sid_auto isn't supported.
+        * user must negate sid vpn export when they want to change the mode
+        */
        if ((sid_auto && bgp->vpn_policy[afi].tovpn_sid_index != 0)
            || (sid_idx != 0 && CHECK_FLAG(bgp->vpn_policy[afi].flags,
                                           BGP_VPN_POLICY_TOVPN_SID_AUTO))) {
@@ -9948,16 +9949,18 @@ DEFPY (bgp_srv6_locator,
        "Specify SRv6 locator\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
+       int ret;
 
        if (strlen(bgp->srv6_locator_name) > 0
            && strcmp(name, bgp->srv6_locator_name) != 0) {
                vty_out(vty, "srv6 locator is already configured\n");
                return CMD_WARNING_CONFIG_FAILED;
-       } else
-               snprintf(bgp->srv6_locator_name,
-                        sizeof(bgp->srv6_locator_name), "%s", name);
+       }
+
+       snprintf(bgp->srv6_locator_name,
+                sizeof(bgp->srv6_locator_name), "%s", name);
 
-       int ret = bgp_zebra_srv6_manager_get_locator_chunk(name);
+       ret = bgp_zebra_srv6_manager_get_locator_chunk(name);
        if (ret < 0)
                return CMD_WARNING_CONFIG_FAILED;
 
index 8349358da4e4c57fcae87d42c2c2b5f073893e2a..7e2dfed64da2cae982bec3769d2444be86517bac 100644 (file)
@@ -3004,8 +3004,10 @@ static void bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
        uint16_t instance;
        uint16_t len;
        char name[256] = {0};
-       struct prefix_ipv6 *chunk = NULL;
-       chunk = prefix_ipv6_new();
+       struct bgp *bgp = bgp_get_default();
+       struct listnode *node;
+       struct prefix_ipv6 *c;
+       struct prefix_ipv6 *chunk = prefix_ipv6_new();
 
        s = zclient->ibuf;
        STREAM_GETC(s, proto);
@@ -3026,15 +3028,12 @@ static void bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
                return;
        }
 
-       struct bgp *bgp = bgp_get_default();
        if (strcmp(bgp->srv6_locator_name, name) != 0) {
                zlog_info("name unmatch %s:%s",
                          bgp->srv6_locator_name, name);
                return;
        }
 
-       struct listnode *node;
-       struct prefix_ipv6 *c;
        for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, c)) {
                if (!prefix_cmp(c, chunk))
                        return;
@@ -3048,7 +3047,6 @@ stream_failure:
        free(chunk);
 
        zlog_err("%s: can't get locator_chunk!!", __func__);
-       return;
 }
 
 void bgp_zebra_init(struct thread_master *master, unsigned short instance)
@@ -3093,7 +3091,8 @@ void bgp_zebra_init(struct thread_master *master, unsigned short instance)
        zclient->iptable_notify_owner = iptable_notify_owner;
        zclient->route_notify_owner = bgp_zebra_route_notify_owner;
        zclient->instance = instance;
-       zclient->process_srv6_locator_chunk = bgp_zebra_process_srv6_locator_chunk;
+       zclient->process_srv6_locator_chunk =
+               bgp_zebra_process_srv6_locator_chunk;
 }
 
 void bgp_zebra_destroy(void)