diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-06-28 12:26:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-06-28 12:26:47 +0900 |
commit | c5b7496d0bd0ec98360044dfda21ab864df0b9cb (patch) | |
tree | d55b9da0e8c9f8d83d4fd403a0e9311b22c71146 | |
parent | 6f644ee1ca1be81e6ec96c8504e34c26b3d1f8a8 (diff) |
fix support AGGREGATOR and AS4_AGGREGATOR conversion
Fix the following commit:
commit de58be441150daf8943a5a66ced6703b8201303e
Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Sun Jun 26 23:18:23 2016 +0900
support AGGREGATOR and AS4_AGGREGATOR conversion
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | table/message.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/table/message.go b/table/message.go index 68801e73..9a25d98c 100644 --- a/table/message.go +++ b/table/message.go @@ -202,15 +202,16 @@ func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error { func UpdatePathAggregator2ByteAs(msg *bgp.BGPUpdate) { as := uint32(0) var addr string - for _, attr := range msg.PathAttributes { + for i, attr := range msg.PathAttributes { switch attr.(type) { case *bgp.PathAttributeAggregator: agg := attr.(*bgp.PathAttributeAggregator) - agg.Value.Askind = reflect.Uint16 + addr = agg.Value.Address.String() if agg.Value.AS > (1<<16)-1 { as = agg.Value.AS - addr = agg.Value.Address.String() - agg.Value.AS = bgp.AS_TRANS + msg.PathAttributes[i] = bgp.NewPathAttributeAggregator(uint16(bgp.AS_TRANS), addr) + } else { + msg.PathAttributes[i] = bgp.NewPathAttributeAggregator(uint16(agg.Value.AS), addr) } } } |