summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-07 01:02:52 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-07 01:02:52 -0800
commit4bd5611c10bd668622f2dd1f7ad7cd72e889fcf4 (patch)
tree1386ed0775fb8d76d3a52455dbfc2e6202b9dd0d /packet
parentbdbb80e9a6eb2928f4942b432dba0fb0595fc658 (diff)
table: fix UpdatePathAttrs2ByteAS
Fix the bug that UpdatePathAttrs2ByteAS modifies the _ORIGINAL_ path attributes in rib. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go14
1 files changed, 14 insertions, 0 deletions
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{