as = XCALLOC(MTYPE_AS_PATH, sizeof(struct aspath));
as->asnotation = asnotation;
+ as->count = 0;
+
return as;
}
}
unsigned int aspath_count_hops(const struct aspath *aspath)
+{
+ return aspath->count;
+}
+
+static unsigned int aspath_count_hops_internal(const struct aspath *aspath)
{
int count = 0;
struct assegment *seg = aspath->segments;
else
new->str[0] = '\0';
+ new->count = aspath->count;
return new;
}
new->str_len = aspath->str_len;
new->json = aspath->json;
new->asnotation = aspath->asnotation;
+ new->count = aspath->count;
return new;
}
if (assegments_parse(s, length, &as.segments, use32bit) < 0)
return NULL;
+ as.count = aspath_count_hops_internal(&as);
+
/* If already same aspath exist then return it. */
find = hash_get(ashash, &as, aspath_hash_alloc);
asset->as[asset->length - 1] = as;
}
-
+ aspath->count = aspath_count_hops_internal(aspath);
return asset;
}
assegment_normalise(aspath->segments);
aspath_str_update(aspath, false);
+ aspath->count = aspath_count_hops_internal(aspath);
+
return aspath;
}
}
aspath_str_update(new, false);
+ new->count = aspath_count_hops_internal(new);
return new;
}
}
aspath_str_update(new, false);
+ new->count = aspath_count_hops_internal(new);
+
return new;
}
}
aspath_str_update(new, false);
+ new->count = aspath_count_hops_internal(new);
+
return new;
}
}
aspath_str_update(new, false);
+ new->count = aspath_count_hops_internal(new);
+
return new;
}
if (!aspath->refcnt)
aspath_free(aspath);
aspath_str_update(new, false);
+ new->count = aspath_count_hops_internal(new);
return new;
}
last->next = as2->segments;
as2->segments = new;
aspath_str_update(as2, false);
+ as2->count = aspath_count_hops_internal(as2);
return as2;
}
if (as2->segments == NULL) {
as2->segments = assegment_dup_all(as1->segments);
aspath_str_update(as2, false);
+ as2->count = aspath_count_hops_internal(as2);
return as2;
}
if (!as2->segments) {
as2->segments = assegment_dup_all(as1->segments);
aspath_str_update(as2, false);
+ as2->count = aspath_count_hops_internal(as2);
return as2;
}
* the inbetween AS_SEQUENCE of seg2 in the process
*/
aspath_str_update(as2, false);
+ as2->count = aspath_count_hops_internal(as2);
return as2;
} else {
/* AS_SET merge code is needed at here. */
lastseg = newseg;
}
aspath_str_update(newpath, false);
+ newpath->count = aspath_count_hops_internal(newpath);
/* We are happy returning even an empty AS_PATH, because the
* administrator
* might expect this very behaviour. There's a mean to avoid this, if
newpath = aspath_new(source->asnotation);
aspath_str_update(newpath, false);
+ newpath->count = aspath_count_hops_internal(newpath);
/* We are happy returning even an empty AS_PATH, because the
* administrator
* might expect this very behaviour. There's a mean to avoid this, if
aspath_str_update(source, false);
+ source->count = aspath_count_hops_internal(source);
/* We are happy returning even an empty AS_PATH, because the
* administrator
* might expect this very behaviour. There's a mean to avoid this, if
}
aspath_str_update(aspath, false);
+ aspath->count = aspath_count_hops_internal(aspath);
return aspath;
}
if (!hops) {
newpath = aspath_dup(as4path);
aspath_str_update(newpath, false);
+ /* dup sets the count properly */
return newpath;
}
aspath_free(newpath);
mergedpath->segments = assegment_normalise(mergedpath->segments);
aspath_str_update(mergedpath, false);
+ mergedpath->count = aspath_count_hops_internal(mergedpath);
if (BGP_DEBUG(as4, AS4))
zlog_debug("[AS4] result of synthesizing is %s",
seg = next;
}
- if (removed_confed_segment)
+ if (removed_confed_segment) {
aspath_str_update(aspath, false);
+ aspath->count = aspath_count_hops_internal(aspath);
+ }
return aspath;
}