You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid order of BGP attributes in update message #705
According to RFC https://www.ietf.org/rfc/rfc4271.txt all BGP attributes in BGP message should be ordered in ascending order of attribute types:
The sender of an UPDATE message SHOULD order path attributes within
the UPDATE message in ascending order of attribute type. The
receiver of an UPDATE message MUST be prepared to handle path
attributes within UPDATE messages that are out of order.
But actually you've order they other way.
I've GoBGP dynamic library and call it from C++.
path*path_c_struct=serialize_path(ipv4_unicast_route_family, (char*)"11.22.33.44/22 nexthop 11.22.33.44");
std::cout << "GoBGP's serialize_path output" << std::endl;
for (intpath_attribute_number=0; path_attribute_number<path_c_struct->path_attributes_len; path_attribute_number++) {
// We store attribute type in second byte of attributestd::cout
<< "Attribute number " << path_attribute_number
<< " attribute length " << path_c_struct->path_attributes[path_attribute_number]->len
<< " attribute type " << uint32_t(path_c_struct->path_attributes[path_attribute_number]->value[1]) << std::endl;
}
As you can see attributes ordered in wrong order. Attribute with type 1 (BGP_ATTRIBUTE_ORIGIN) should be placed before BGP attribute with type 3 (BGP_ATTRIBUTE_NEXT_HOP).
Activity
pavel-odintsov commentedon Feb 20, 2016
Actually, it's not critical and well written BGP clients could handle unordered attributes. But I prefer do everything according to standard rules :)
pavel-odintsov commentedon Feb 20, 2016
I have checked BGP message's attribute sequence for Juniper (srx240):

And Bird:

They both uses ascending attribute order.
fujita commentedon Feb 26, 2016
Fixed by ae41a9f
pavel-odintsov commentedon Feb 26, 2016
Perfect! Thanks!
pavel-odintsov commentedon Feb 26, 2016
Looks like when I encode arguments with C exported code:
It's not working yet:
Could you check?
fujita commentedon Feb 27, 2016
Fixed by b334dd4
pavel-odintsov commentedon Feb 28, 2016
Perfect:
Thanks!