Skip to content

Invalid order of BGP attributes in update message #705

Closed

Description

@pavel-odintsov

Hello, folks!

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 (int path_attribute_number = 0; path_attribute_number < path_c_struct->path_attributes_len; path_attribute_number++) {
        // We store attribute type in second byte of attribute
        std::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;
    }   

I could share output of this piece of code:

./gobgp_native_api_client_test 
GoBGP's serialize_path output
Attribute number 0 attribute length 7 attribute type 3
Attribute number 1 attribute length 4 attribute type 1

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).

What do you think about this?

Activity

  1. pavel-odintsov commented on Feb 20, 2016

    @pavel-odintsov
    ContributorAuthor

    Actually, it's not critical and well written BGP clients could handle unordered attributes. But I prefer do everything according to standard rules :)

  2. pavel-odintsov commented on Feb 20, 2016

    @pavel-odintsov
    ContributorAuthor

    I have checked BGP message's attribute sequence for Juniper (srx240):
    juniper announce to bird

    And Bird:
    intel announce to juniper

    They both uses ascending attribute order.

  3. fujita commented on Feb 26, 2016

    @fujita
    Member

    Fixed by ae41a9f

  4. pavel-odintsov commented on Feb 26, 2016

    @pavel-odintsov
    ContributorAuthor

    Perfect! Thanks!

  5. pavel-odintsov commented on Feb 26, 2016

    @pavel-odintsov
    ContributorAuthor

    Looks like when I encode arguments with C exported code:

    serialize_path(ipv4_unicast_route_family, (char*)"11.22.33.44/22 nexthop 11.22.33.44");

    It's not working yet:

    GoBGP's serialize_path output
    Attribute number 0 attribute length 7 attribute type 3
    Attribute number 1 attribute length 4 attribute type 1

    Could you check?

  6. fujita commented on Feb 27, 2016

    @fujita
    Member

    Fixed by b334dd4

  7. pavel-odintsov commented on Feb 28, 2016

    @pavel-odintsov
    ContributorAuthor

    Perfect:

    GoBGP's serialize_path output
    Attribute number 0 attribute length 4 attribute type 1
    Attribute number 1 attribute length 7 attribute type 3

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions