Skip to content

Commit

Permalink
extended communitities fix transitive check (#6900)
Browse files Browse the repository at this point in the history
- extended community is transitive when second-highest-order type bit is UNSET, not when it is set
- see https://tools.ietf.org/html/rfc4360 Page 3
  • Loading branch information
arifogel committed Apr 12, 2021
1 parent bd5a1ab commit fd37fbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public <T> T accept(CommunityVisitor<T> visitor) {
@Override
public boolean isTransitive() {
// Second most significant bit is set
return (_type & (byte) 0x40) != 0;
return (_type & (byte) 0x40) == 0;
}

/** Check whether this community is of type route-origin / site-of-origin */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public void testParseLargeGlobalAdminBecauseLsuffix() {

@Test
public void testIsTransitive() {
assertFalse(ExtendedCommunity.parse("1:1:1").isTransitive());
assertTrue(ExtendedCommunity.parse("16384:1:1").isTransitive());
assertTrue(ExtendedCommunity.parse("1:1:1").isTransitive());
assertFalse(ExtendedCommunity.parse("16384:1:1").isTransitive());
}

@Test
Expand Down

0 comments on commit fd37fbf

Please sign in to comment.