From 4bd5611c10bd668622f2dd1f7ad7cd72e889fcf4 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 7 Jan 2015 01:02:52 -0800 Subject: table: fix UpdatePathAttrs2ByteAS Fix the bug that UpdatePathAttrs2ByteAS modifies the _ORIGINAL_ path attributes in rib. Signed-off-by: FUJITA Tomonori --- packet/bgp.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packet/bgp.go') diff --git a/packet/bgp.go b/packet/bgp.go index 32690745..2d84d6a3 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -1954,6 +1954,20 @@ func (p *PathAttributeAs4Path) Serialize() ([]byte, error) { return p.PathAttribute.Serialize() } +func (p *PathAttributeAs4Path) MarshalJSON() ([]byte, error) { + aslist := make([]uint32, 0) + for _, a := range p.Value { + aslist = append(aslist, a.AS...) + } + return json.Marshal(struct { + Type string + AsPath []uint32 + }{ + Type: p.Type.String(), + AsPath: aslist, + }) +} + func NewPathAttributeAs4Path(value []*As4PathParam) *PathAttributeAs4Path { return &PathAttributeAs4Path{ PathAttribute: PathAttribute{ -- cgit v1.2.3