if (!attr)
return 0;
+ buf[0] = '\0';
+
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)))
snprintf(buf, size, "nexthop %s", inet_ntoa(attr->nexthop));
if (bgp_nexthop_self(bgp, pi->attr->nexthop)) {
- char attr_str[BUFSIZ];
+ char attr_str[BUFSIZ] = {0};
char pbuf[PREFIX_STRLEN];
bgp_dump_attr(pi->attr, attr_str,
/* Update MPLS label */
if (has_valid_label) {
extra = bgp_path_info_extra_get(pi);
- memcpy(&extra->label, label,
- num_labels * sizeof(mpls_label_t));
- extra->num_labels = num_labels;
+ if (extra->label != label) {
+ memcpy(&extra->label, label,
+ num_labels * sizeof(mpls_label_t));
+ extra->num_labels = num_labels;
+ }
if (!(afi == AFI_L2VPN && safi == SAFI_EVPN))
bgp_set_valid_label(&extra->label[0]);
}
/* Update MPLS label */
if (has_valid_label) {
extra = bgp_path_info_extra_get(new);
- memcpy(&extra->label, label, num_labels * sizeof(mpls_label_t));
- extra->num_labels = num_labels;
+ if (extra->label != label) {
+ memcpy(&extra->label, label, num_labels * sizeof(mpls_label_t));
+ extra->num_labels = num_labels;
+ }
if (!(afi == AFI_L2VPN && safi == SAFI_EVPN))
bgp_set_valid_label(&extra->label[0]);
}