]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_aspath.c
Merge pull request #5686 from qlyoung/fix-bgp-fqdn-capability-leak
[mirror_frr.git] / bgpd / bgp_aspath.c
index 6caeb7ca1f71defb61ac18b52297540bbd2b56b8..a781e70d2f58798c98fa5a6a596e9b496e09def2 100644 (file)
@@ -102,8 +102,10 @@ static void assegment_data_free(as_t *asdata)
        XFREE(MTYPE_AS_SEG_DATA, asdata);
 }
 
-const char *aspath_segment_type_str[] = {"as-invalid", "as-set", "as-sequence",
-                                        "as-confed-sequence", "as-confed-set"};
+const char *const aspath_segment_type_str[] = {
+       "as-invalid", "as-set", "as-sequence", "as-confed-sequence",
+       "as-confed-set"
+};
 
 /* Get a new segment. Note that 0 is an allowed length,
  * and will result in a segment with no allocated data segment.
@@ -414,6 +416,19 @@ unsigned int aspath_count_hops(const struct aspath *aspath)
        return count;
 }
 
+/* Check if aspath has AS_SET or AS_CONFED_SET */
+bool aspath_check_as_sets(struct aspath *aspath)
+{
+       struct assegment *seg = aspath->segments;
+
+       while (seg) {
+               if (seg->type == AS_SET || seg->type == AS_CONFED_SET)
+                       return true;
+               seg = seg->next;
+       }
+       return false;
+}
+
 /* Estimate size aspath /might/ take if encoded into an
  * ASPATH attribute.
  *
@@ -576,7 +591,7 @@ static void aspath_make_str_count(struct aspath *as, bool make_json)
                        if (make_json)
                                json_object_array_add(
                                        jseg_list,
-                                       json_object_new_int(seg->as[i]));
+                                       json_object_new_int64(seg->as[i]));
 
                        len += snprintf(str_buf + len, str_size - len, "%u",
                                        seg->as[i]);