]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: remove warnings related to line too longs in bgp code
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 2 Jul 2020 06:14:41 +0000 (08:14 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 21 Aug 2020 11:37:08 +0000 (13:37 +0200)
remove warnings related to line too long in bgp code.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_ecommunity.c
bgpd/bgp_evpn.c
bgpd/bgp_pbr.c
bgpd/bgp_route.c

index ce67abd36410827e7317e0395eb19d2d914ef5f0..79fb7e55e9161bdd940a5cd9a6f6f71638471974 100644 (file)
@@ -88,12 +88,15 @@ static void ecommunity_hash_free(struct ecommunity *ecom)
    once and whether the new value should replace what is existing or
    not.
 */
-static bool ecommunity_add_val_internal(struct ecommunity *ecom, const void *eval,
-                                       bool unique, bool overwrite, uint8_t ecom_size)
+static bool ecommunity_add_val_internal(struct ecommunity *ecom,
+                                       const void *eval,
+                                       bool unique, bool overwrite,
+                                       uint8_t ecom_size)
 {
        int c, ins_idx;
        const struct ecommunity_val *eval4 = (struct ecommunity_val *)eval;
-       const struct ecommunity_val_ipv6 *eval6 = (struct ecommunity_val_ipv6 *)eval;
+       const struct ecommunity_val_ipv6 *eval6 =
+               (struct ecommunity_val_ipv6 *)eval;
 
        /* When this is fist value, just add it. */
        if (ecom->val == NULL) {
@@ -116,7 +119,8 @@ static bool ecommunity_add_val_internal(struct ecommunity *ecom, const void *eva
                                if (p[0] == eval4->val[0] &&
                                    p[1] == eval4->val[1]) {
                                        if (overwrite) {
-                                               memcpy(p, eval4->val, ecom_size);
+                                               memcpy(p, eval4->val,
+                                                      ecom_size);
                                                return true;
                                        }
                                        return false;
@@ -125,7 +129,8 @@ static bool ecommunity_add_val_internal(struct ecommunity *ecom, const void *eva
                                if (p[0] == eval6->val[0] &&
                                    p[1] == eval6->val[1]) {
                                        if (overwrite) {
-                                               memcpy(p, eval6->val, ecom_size);
+                                               memcpy(p, eval6->val,
+                                                      ecom_size);
                                                return true;
                                        }
                                        return false;
@@ -162,10 +167,11 @@ static bool ecommunity_add_val_internal(struct ecommunity *ecom, const void *eva
 }
 
 /* Add a new Extended Communities value to Extended Communities
-   Attribute structure.  When the value is already exists in the
-   structure, we don't add the value.  Newly added value is sorted by
-   numerical order.  When the value is added to the structure return 1
-   else return 0.  */
+ * Attribute structure.  When the value is already exists in the
+ * structure, we don't add the value.  Newly added value is sorted by
+ * numerical order.  When the value is added to the structure return 1
+ * else return 0.
+ */
 bool ecommunity_add_val(struct ecommunity *ecom, struct ecommunity_val *eval,
                       bool unique, bool overwrite)
 {
@@ -173,8 +179,9 @@ bool ecommunity_add_val(struct ecommunity *ecom, struct ecommunity_val *eval,
                                           overwrite, ECOMMUNITY_SIZE);
 }
 
-bool ecommunity_add_val_ipv6(struct ecommunity *ecom, struct ecommunity_val_ipv6 *eval,
-                           bool unique, bool overwrite)
+bool ecommunity_add_val_ipv6(struct ecommunity *ecom,
+                            struct ecommunity_val_ipv6 *eval,
+                            bool unique, bool overwrite)
 {
        return ecommunity_add_val_internal(ecom, (const void *)eval, unique,
                                           overwrite, IPV6_ECOMMUNITY_SIZE);
@@ -202,8 +209,9 @@ ecommunity_uniq_sort_internal(struct ecommunity *ecom,
 }
 
 /* This function takes pointer to Extended Communites strucutre then
-   create a new Extended Communities structure by uniq and sort each
-   Extended Communities value.  */
+ * create a new Extended Communities structure by uniq and sort each
+ * Extended Communities value.
+ */
 struct ecommunity *ecommunity_uniq_sort(struct ecommunity *ecom)
 {
        return ecommunity_uniq_sort_internal(ecom, ECOMMUNITY_SIZE);
@@ -678,7 +686,8 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type,
                        if (ecom == NULL)
                                ecom = ecommunity_new();
                        eval.val[1] = type;
-                       ecommunity_add_val_internal(ecom, (void *)&eval, false, false,
+                       ecommunity_add_val_internal(ecom, (void *)&eval,
+                                                   false, false,
                                                    ecom->unit_size);
                        break;
                case ecommunity_token_val6:
@@ -707,31 +716,31 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type,
 }
 
 /* Convert string to extended community attribute.
-
  When type is already known, please specify both str and type.  str
  should not include keyword such as "rt" and "soo".  Type is
  ECOMMUNITY_ROUTE_TARGET or ECOMMUNITY_SITE_ORIGIN.
  keyword_included should be zero.
-
  For example route-map's "set extcommunity" command case:
-
  "rt 100:1 100:2 100:3"        -> str = "100:1 100:2 100:3"
                                  type = ECOMMUNITY_ROUTE_TARGET
                                  keyword_included = 0
-
  "soo 100:1"                   -> str = "100:1"
                                  type = ECOMMUNITY_SITE_ORIGIN
                                  keyword_included = 0
-
  When string includes keyword for each extended community value.
  Please specify keyword_included as non-zero value.
-
  For example standard extcommunity-list case:
-
  "rt 100:1 rt 100:2 soo 100:1" -> str = "rt 100:1 rt 100:2 soo 100:1"
                                  type = 0
                                  keyword_include = 1
-*/
+ *
* When type is already known, please specify both str and type.  str
* should not include keyword such as "rt" and "soo".  Type is
* ECOMMUNITY_ROUTE_TARGET or ECOMMUNITY_SITE_ORIGIN.
* keyword_included should be zero.
+ *
* For example route-map's "set extcommunity" command case:
+ *
* "rt 100:1 100:2 100:3"        -> str = "100:1 100:2 100:3"
*                                 type = ECOMMUNITY_ROUTE_TARGET
*                                 keyword_included = 0
+ *
* "soo 100:1"                   -> str = "100:1"
*                                 type = ECOMMUNITY_SITE_ORIGIN
*                                 keyword_included = 0
+ *
* When string includes keyword for each extended community value.
* Please specify keyword_included as non-zero value.
+ *
* For example standard extcommunity-list case:
+ *
* "rt 100:1 rt 100:2 soo 100:1" -> str = "rt 100:1 rt 100:2 soo 100:1"
*                                 type = 0
*                                 keyword_include = 1
+ */
 struct ecommunity *ecommunity_str2com(const char *str, int type,
                                      int keyword_included)
 {
@@ -789,7 +798,8 @@ static int ecommunity_rt_soo_str_internal(char *buf, size_t bufsz,
                        eas.as |= (*pnt++);
                        pnt = ptr_get_be32(pnt, &eas.val);
 
-                       len = snprintf(buf, bufsz, "%s%u:%u", prefix, eas.as, eas.val);
+                       len = snprintf(buf, bufsz, "%s%u:%u", prefix, eas.as,
+                                      eas.val);
                } else {
                        /* this is an IPv6 ext community
                         * first 16 bytes stands for IPv6 addres
@@ -799,7 +809,8 @@ static int ecommunity_rt_soo_str_internal(char *buf, size_t bufsz,
                        eip6.val = (*pnt++ << 8);
                        eip6.val |= (*pnt++);
 
-                       inet_ntop(AF_INET6, &eip6.ip, buf_local, sizeof(buf_local));
+                       inet_ntop(AF_INET6, &eip6.ip, buf_local,
+                                 sizeof(buf_local));
                        len = snprintf(buf, bufsz, "%s%s:%u", prefix,
                                       buf_local, eip6.val);
                }
@@ -1052,7 +1063,8 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
                                                format,
                                                ecom->unit_size);
                                snprintf(encbuf, sizeof(encbuf), "%s", buf);
-                       } else if (sub_type == ECOMMUNITY_FLOWSPEC_REDIRECT_IPV6) {
+                       } else if (sub_type ==
+                                  ECOMMUNITY_FLOWSPEC_REDIRECT_IPV6) {
                                char buf[64];
 
                                memset(buf, 0, sizeof(buf));
@@ -1063,19 +1075,22 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
                                                ECOMMUNITY_ROUTE_TARGET,
                                                ECOMMUNITY_FORMAT_DISPLAY,
                                                ecom->unit_size);
-                               snprintf(encbuf, sizeof(encbuf), "FS:redirect VRF %s", buf);
+                               snprintf(encbuf, sizeof(encbuf),
+                                        "FS:redirect VRF %s", buf);
                        } else if (sub_type == ECOMMUNITY_REDIRECT_VRF) {
                                char buf[16];
 
                                memset(buf, 0, sizeof(buf));
-                               ecommunity_rt_soo_str(buf, sizeof(buf), (const uint8_t *)pnt,
-                                                     type &
-                                                     ~ECOMMUNITY_ENCODE_TRANS_EXP,
-                                                     ECOMMUNITY_ROUTE_TARGET,
-                                                     ECOMMUNITY_FORMAT_DISPLAY);
+                               ecommunity_rt_soo_str(buf, sizeof(buf),
+                                               (const uint8_t *)pnt,
+                                               type &
+                                               ~ECOMMUNITY_ENCODE_TRANS_EXP,
+                                               ECOMMUNITY_ROUTE_TARGET,
+                                               ECOMMUNITY_FORMAT_DISPLAY);
+                               snprintf(encbuf, sizeof(encbuf),
+                                        "FS:redirect VRF %s", buf);
                                snprintf(encbuf, sizeof(encbuf),
                                         "FS:redirect VRF %s", buf);
-                               snprintf(encbuf, sizeof(encbuf), "FS:redirect VRF %s", buf);
                        } else if (type != ECOMMUNITY_ENCODE_TRANS_EXP)
                                unk_ecom = 1;
                        else if (sub_type == ECOMMUNITY_TRAFFIC_ACTION) {
index e552866f38ccee9ad2f321d3b325ae20d89c9fe2..8c3e54566e44f8d090ba97a9c9cb23c2875e6697 100644 (file)
@@ -876,7 +876,8 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
 
        if (attr->ecommunity) {
                for (i = 0; i < attr->ecommunity->size; i++) {
-                       pnt = attr->ecommunity->val + (i * attr->ecommunity->unit_size);
+                       pnt = attr->ecommunity->val +
+                               (i * attr->ecommunity->unit_size);
                        type = *pnt++;
                        sub_type = *pnt++;
 
@@ -884,7 +885,8 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
                            && sub_type
                                       == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) {
                                ecom_val_ptr =
-                                       (attr->ecommunity->val + (i * attr->ecommunity->unit_size));
+                                       (attr->ecommunity->val +
+                                        (i * attr->ecommunity->unit_size));
                                break;
                        }
                }
@@ -892,7 +894,8 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
 
        /* Update the existing MM ecommunity */
        if (ecom_val_ptr) {
-               memcpy(ecom_val_ptr, eval.val, sizeof(char) * attr->ecommunity->unit_size);
+               memcpy(ecom_val_ptr, eval.val, sizeof(char)
+                      * attr->ecommunity->unit_size);
        }
        /* Add MM to existing */
        else {
index 0c36f138f1ebe1b2e9d1a6d5adffb1a1d86a7a89..f6e5c196cacb39aa15f43ec60bcdcd7ca03b5b09 100644 (file)
@@ -172,7 +172,8 @@ static int bgp_pbr_match_walkcb(struct hash_bucket *bucket, void *arg)
        return HASHWALK_CONTINUE;
 }
 
-static int snprintf_bgp_pbr_match_val(char *str, int len, struct bgp_pbr_match_val *mval,
+static int snprintf_bgp_pbr_match_val(char *str, int len,
+                                     struct bgp_pbr_match_val *mval,
                                      const char *prepend)
 {
        char *ptr = str;
@@ -852,14 +853,16 @@ int bgp_pbr_build_and_validate_entry(const struct prefix *p,
                                        api_action_redirect_ip->u.zr.duplicate
                                                = ecom_eval->val[7];
                                        continue;
-                               } else if (p->u.prefix_flowspec.family == AF_INET) {
+                               } else if (p->u.prefix_flowspec.family ==
+                                          AF_INET) {
                                        api_action->action = ACTION_REDIRECT_IP;
                                        api_action->u.zr.redirect_ip_v4.s_addr =
                                                path->attr->nexthop.s_addr;
                                        api_action->u.zr.duplicate =
                                                ecom_eval->val[7];
                                        api_action_redirect_ip = api_action;
-                               } else if (p->u.prefix_flowspec.family == AF_INET6) {
+                               } else if (p->u.prefix_flowspec.family ==
+                                          AF_INET6) {
                                        api_action->action = ACTION_REDIRECT_IP;
                                        memcpy(&api_action->u
                                               .zr.redirect_ip_v6,
@@ -903,8 +906,8 @@ int bgp_pbr_build_and_validate_entry(const struct prefix *p,
                                                                 afi);
                                if (ret != 0)
                                        continue;
-                               if ((api_action->action == ACTION_TRAFFICRATE) &&
-                                   api->actions[i].u.r.rate == 0)
+                               if ((api_action->action == ACTION_TRAFFICRATE)
+                                   && api->actions[i].u.r.rate == 0)
                                        discard_action_found = true;
                        }
                        api->action_num++;
@@ -1465,7 +1468,8 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
                                       prefix2str(p, buff, 64),
                                       api->dst_prefix_offset);
                else
-                       delta = snprintf(ptr, len, "@dst %s", prefix2str(p, buff, 64));
+                       delta = snprintf(ptr, len, "@dst %s",
+                                        prefix2str(p, buff, 64));
                len -= delta;
                ptr += delta;
        }
@@ -1527,7 +1531,8 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
        if (api->match_packet_length_num)
                INCREMENT_DISPLAY(ptr, nb_items, len);
        for (i = 0; i < api->match_packet_length_num; i++) {
-               delta = snprintf_bgp_pbr_match_val(ptr, len, &api->packet_length[i],
+               delta = snprintf_bgp_pbr_match_val(ptr, len,
+                                                  &api->packet_length[i],
                                                   i > 0 ? NULL : "@plen ");
                len -= delta;
                ptr += delta;
@@ -1545,7 +1550,8 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
        if (api->match_flowlabel_num)
                INCREMENT_DISPLAY(ptr, nb_items, len);
        for (i = 0; i < api->match_flowlabel_num; i++) {
-               delta = snprintf_bgp_pbr_match_val(ptr, len, &api->flow_label[i],
+               delta = snprintf_bgp_pbr_match_val(ptr, len,
+                                                 &api->flow_label[i],
                                                  i > 0 ? NULL : "@flowlabel ");
                len -= delta;
                ptr += delta;
@@ -2474,7 +2480,8 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
        if (bpm->unique == 0) {
                bpm->unique = ++bgp_pbr_match_counter_unique;
                /* 0 value is forbidden */
-               snprintf(bpm->ipset_name, sizeof(bpm->ipset_name), "match%p", bpm);
+               snprintf(bpm->ipset_name, sizeof(bpm->ipset_name),
+                        "match%p", bpm);
                bpm->entry_hash = hash_create_size(8,
                                   bgp_pbr_match_entry_hash_key,
                                   bgp_pbr_match_entry_hash_equal,
index eefff4bef8e85736356d388cd0f3e15ba8ad4ffa..e8baac2c32c27de72943439e299cbdf8fae71da3 100644 (file)
@@ -10014,7 +10014,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
                                                dest_p->u.prefix_flowspec.ptr,
                                        dest_p->u.prefix_flowspec.prefixlen,
                                        retstr, NLRI_STRING_FORMAT_MIN, NULL,
-                                       family2afi(dest_p->u.prefix_flowspec.family));
+                                       family2afi(dest_p->u
+                                                  .prefix_flowspec.family));
                                if (first)
                                        vty_out(vty, "\"%s/%d\": ", retstr,
                                                dest_p->u.prefix_flowspec