mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
Fixed a bug where a community was missing when parsing multiline communities.
Also added a test case for the multiline community parsing.
This commit is contained in:
parent
49fb6882fa
commit
12be0f9de3
6 changed files with 135 additions and 35 deletions
|
@ -323,7 +323,7 @@ func parseRouteLines(lines []string, position int, ch chan<- blockParsed) {
|
|||
joinLines := func() {
|
||||
for c := i+1; c < len(lines); c++ {
|
||||
if strings.HasPrefix(lines[c], "\x09\x09") {
|
||||
line += lines[c][3:]
|
||||
line += lines[c][2:]
|
||||
i++
|
||||
} else {
|
||||
break
|
||||
|
|
|
@ -93,8 +93,56 @@ func runTestForIpv4WithFile(file string, t *testing.T) {
|
|||
gateway: "1.2.3.16",
|
||||
asPath: []string{"1340"},
|
||||
community: [][]int64{
|
||||
{65011, 3},
|
||||
{9033, 3251},
|
||||
{0, 5464},
|
||||
{0, 8339},
|
||||
{0, 8741},
|
||||
{0, 8823},
|
||||
{0, 12387},
|
||||
{0, 13101},
|
||||
{0, 16097},
|
||||
{0, 16316},
|
||||
{0, 20546},
|
||||
{0, 20686},
|
||||
{0, 20723},
|
||||
{0, 21083},
|
||||
{0, 21385},
|
||||
{0, 24940},
|
||||
{0, 25504},
|
||||
{0, 28876},
|
||||
{0, 29545},
|
||||
{0, 30058},
|
||||
{0, 31103},
|
||||
{0, 31400},
|
||||
{0, 39090},
|
||||
{0, 39392},
|
||||
{0, 39912},
|
||||
{0, 42473},
|
||||
{0, 43957},
|
||||
{0, 44453},
|
||||
{0, 47297},
|
||||
{0, 47692},
|
||||
{0, 48200},
|
||||
{0, 50629},
|
||||
{0, 51191},
|
||||
{0, 51839},
|
||||
{0, 51852},
|
||||
{0, 54113},
|
||||
{0, 56719},
|
||||
{0, 57957},
|
||||
{0, 60517},
|
||||
{0, 60574},
|
||||
{0, 61303},
|
||||
{0, 62297},
|
||||
{0, 62336},
|
||||
{0, 62359},
|
||||
{33891, 33892},
|
||||
{33891, 50673},
|
||||
{48793, 48793},
|
||||
{50673, 500},
|
||||
{65101, 11077},
|
||||
{65102, 11000},
|
||||
{65103, 724},
|
||||
{65104, 150},
|
||||
},
|
||||
largeCommunities: [][]int64{
|
||||
{9033, 65666, 12},
|
||||
|
@ -208,8 +256,56 @@ func runTestForIpv6WithFile(file string, t *testing.T) {
|
|||
gateway: "fe80:ffff:ffff::1",
|
||||
asPath: []string{"15169"},
|
||||
community: [][]int64{
|
||||
{9033, 3001},
|
||||
{65000, 680},
|
||||
{0, 5464},
|
||||
{0, 8339},
|
||||
{0, 8741},
|
||||
{0, 8823},
|
||||
{0, 12387},
|
||||
{0, 13101},
|
||||
{0, 16097},
|
||||
{0, 16316},
|
||||
{0, 20546},
|
||||
{0, 20686},
|
||||
{0, 20723},
|
||||
{0, 21083},
|
||||
{0, 21385},
|
||||
{0, 24940},
|
||||
{0, 25504},
|
||||
{0, 28876},
|
||||
{0, 29545},
|
||||
{0, 30058},
|
||||
{0, 31103},
|
||||
{0, 31400},
|
||||
{0, 39090},
|
||||
{0, 39392},
|
||||
{0, 39912},
|
||||
{0, 42473},
|
||||
{0, 43957},
|
||||
{0, 44453},
|
||||
{0, 47297},
|
||||
{0, 47692},
|
||||
{0, 48200},
|
||||
{0, 50629},
|
||||
{0, 51191},
|
||||
{0, 51839},
|
||||
{0, 51852},
|
||||
{0, 54113},
|
||||
{0, 56719},
|
||||
{0, 57957},
|
||||
{0, 60517},
|
||||
{0, 60574},
|
||||
{0, 61303},
|
||||
{0, 62297},
|
||||
{0, 62336},
|
||||
{0, 62359},
|
||||
{33891, 33892},
|
||||
{33891, 50673},
|
||||
{48793, 48793},
|
||||
{50673, 500},
|
||||
{65101, 11077},
|
||||
{65102, 11000},
|
||||
{65103, 724},
|
||||
{65104, 150},
|
||||
},
|
||||
largeCommunities: [][]int64{
|
||||
{48821, 0, 2000},
|
||||
|
|
|
@ -5,7 +5,8 @@ BIRD 1.6.3 ready.
|
|||
BGP.as_path: 1340
|
||||
BGP.next_hop: 1.2.3.16
|
||||
BGP.local_pref: 100
|
||||
BGP.community: (65011,3) (9033,3251)
|
||||
BGP.community: (0,5464) (0,8339) (0,8741) (0,8823) (0,12387) (0,13101) (0,16097) (0,16316) (0,20546) (0,20686) (0,20723) (0,21083) (0,21385) (0,24940) (0,25504) (0,28876) (0,29545) (0,30058) (0,31103) (0,31400) (0,39090) (0,39392) (0,39912) (0,42473) (0,43957) (0,44453) (0,47297) (0,47692) (0,48200) (0,50629) (0,51191) (0,51839) (0,51852) (0,54113) (0,56719) (0,57957) (0,60517) (0,60574) (0,61303) (0,62297) (0,62336) (0,62359) (33891,33892) (33891,50673) (48793,48793) (50673,500)
|
||||
(65101,11077) (65102,11000) (65103,724) (65104,150)
|
||||
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
|
||||
BGP.ext_community: (rt, 48858, 50)
|
||||
200.0.0.0/24 via 1.2.3.15 on eno7 [ID8497_AS1339 2017-06-21 08:17:31] * (100) [AS1339i]
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
BIRD 1.6.3 ready.
|
||||
2001:4860::/32 via fe80:ffff:ffff::1 on eth2 [upstream1 2018-01-14 14:32:47 from fe80:ffff:ffff::1] * (100) [AS15169i]
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 15169
|
||||
BGP.next_hop: fe80:ffff:ffff::1
|
||||
BGP.med: 0
|
||||
BGP.local_pref: 500
|
||||
BGP.community: (9033,3001) (65000,680)
|
||||
BGP.large_community: (48821, 0, 2000) (48821, 0, 2100)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
via fe80:ffff:ffff::2 on eth3 [upstream2 2018-01-14 14:33:52] (100) [AS15169i]
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 50629 15169
|
||||
BGP.next_hop: fe80:ffff:ffff::2
|
||||
BGP.med: 71
|
||||
BGP.local_pref: 100
|
||||
BGP.community: (50629,200) (50629,201)
|
||||
BGP.large_community: (48821, 0, 3000) (48821, 0, 3100)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 15169
|
||||
BGP.next_hop: fe80:ffff:ffff::1
|
||||
BGP.med: 0
|
||||
BGP.local_pref: 500
|
||||
BGP.community: (0,5464) (0,8339) (0,8741) (0,8823) (0,12387) (0,13101) (0,16097) (0,16316) (0,20546) (0,20686) (0,20723) (0,21083) (0,21385) (0,24940) (0,25504) (0,28876) (0,29545) (0,30058) (0,31103) (0,31400) (0,39090) (0,39392) (0,39912) (0,42473) (0,43957) (0,44453) (0,47297) (0,47692) (0,48200) (0,50629) (0,51191) (0,51839) (0,51852) (0,54113) (0,56719) (0,57957) (0,60517) (0,60574) (0,61303) (0,62297) (0,62336) (0,62359) (33891,33892) (33891,50673) (48793,48793) (50673,500)
|
||||
(65101,11077) (65102,11000) (65103,724) (65104,150)
|
||||
BGP.large_community: (48821, 0, 2000) (48821, 0, 2100)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
via fe80:ffff:ffff::2 on eth3 [upstream2 2018-01-14 14:33:52] (100) [AS15169i]
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 50629 15169
|
||||
BGP.next_hop: fe80:ffff:ffff::2
|
||||
BGP.med: 71
|
||||
BGP.local_pref: 100
|
||||
BGP.community: (50629,200) (50629,201)
|
||||
BGP.large_community: (48821, 0, 3000) (48821, 0, 3100)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
2001:678:1e0::/48 via fe80:ffff:ffff::2 on eth2 [upstream2 2018-01-14 15:04:17 from 2001:678:1e0::2] * (100) [AS202739i]
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 202739
|
||||
BGP.next_hop: 2001:678:1e0::2
|
||||
BGP.local_pref: 5000
|
||||
BGP.community: (48821,2000) (48821,2100)
|
||||
BGP.large_community: (48821, 0, 2000) (48821, 0, 2100)
|
||||
BGP.ext_community: (unknown 0x4300, 0, 1)
|
||||
Type: BGP unicast univ
|
||||
BGP.origin: IGP
|
||||
BGP.as_path: 202739
|
||||
BGP.next_hop: 2001:678:1e0::2
|
||||
BGP.local_pref: 5000
|
||||
BGP.community: (48821,2000) (48821,2100)
|
||||
BGP.large_community: (48821, 0, 2000) (48821, 0, 2100)
|
||||
BGP.ext_community: (unknown 0x4300, 0, 1)
|
||||
|
|
|
@ -6,7 +6,8 @@ BIRD 1.6.3 ready.
|
|||
BGP.as_path: 1340
|
||||
BGP.next_hop: 1.2.3.16
|
||||
BGP.local_pref: 100
|
||||
BGP.community: (65011,3) (9033,3251)
|
||||
BGP.community: (0,5464) (0,8339) (0,8741) (0,8823) (0,12387) (0,13101) (0,16097) (0,16316) (0,20546) (0,20686) (0,20723) (0,21083) (0,21385) (0,24940) (0,25504) (0,28876) (0,29545) (0,30058) (0,31103) (0,31400) (0,39090) (0,39392) (0,39912) (0,42473) (0,43957) (0,44453) (0,47297) (0,47692) (0,48200) (0,50629) (0,51191) (0,51839) (0,51852) (0,54113) (0,56719) (0,57957) (0,60517) (0,60574) (0,61303) (0,62297) (0,62336) (0,62359) (33891,33892) (33891,50673) (48793,48793) (50673,500)
|
||||
(65101,11077) (65102,11000) (65103,724) (65104,150)
|
||||
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
|
||||
BGP.ext_community: (rt, 48858, 50)
|
||||
200.0.0.0/24 unicast [ID8497_AS1339 2017-06-21 08:17:31] * (100) [AS1339i]
|
||||
|
|
|
@ -7,7 +7,8 @@ BIRD 2.0.0 ready.
|
|||
BGP.next_hop: fe80:ffff:ffff::1
|
||||
BGP.med: 0
|
||||
BGP.local_pref: 500
|
||||
BGP.community: (9033,3001) (65000,680)
|
||||
BGP.community: (0,5464) (0,8339) (0,8741) (0,8823) (0,12387) (0,13101) (0,16097) (0,16316) (0,20546) (0,20686) (0,20723) (0,21083) (0,21385) (0,24940) (0,25504) (0,28876) (0,29545) (0,30058) (0,31103) (0,31400) (0,39090) (0,39392) (0,39912) (0,42473) (0,43957) (0,44453) (0,47297) (0,47692) (0,48200) (0,50629) (0,51191) (0,51839) (0,51852) (0,54113) (0,56719) (0,57957) (0,60517) (0,60574) (0,61303) (0,62297) (0,62336) (0,62359) (33891,33892) (33891,50673) (48793,48793) (50673,500)
|
||||
(65101,11077) (65102,11000) (65103,724) (65104,150)
|
||||
BGP.large_community: (48821, 0, 2000) (48821, 0, 2100)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
unicast [upstream2 2018-01-14 13:07:26 from fe80:ffff:ffff::2] (100/?) [AS15169i]
|
||||
|
|
Loading…
Add table
Reference in a new issue