summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
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{