summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorzvfvrv <franclombardo@gmail.com>2021-06-14 21:44:53 +0200
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-06-30 07:38:00 +0900
commit8aaeb6d33902c725e2980256c0e83a9edd853124 (patch)
tree4bcd7f20fb5a49fa633f3012ba4dc00e3a31b1ec /pkg
parent7f7a3c570b8b053cd323073a30455630bd983a56 (diff)
fix marshal and unmarshal
Diffstat (limited to 'pkg')
-rw-r--r--pkg/packet/bgp/sr_policy.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/packet/bgp/sr_policy.go b/pkg/packet/bgp/sr_policy.go
index 56a7b2ba..39015c37 100644
--- a/pkg/packet/bgp/sr_policy.go
+++ b/pkg/packet/bgp/sr_policy.go
@@ -707,32 +707,31 @@ func (s *SegmentTypeB) DecodeFromBytes(data []byte) error {
return nil
}
func (s *SegmentTypeB) Serialize() ([]byte, error) {
- fmt.Printf("TypeB - SERIALIZE\n")
buf := make([]byte, 18)
buf[0] = s.Flags
copy(buf[2:], s.SID)
return s.TunnelEncapSubTLV.Serialize(buf)
}
func (s *SegmentTypeB) String() string {
- fmt.Printf("%v\n", s.SID)
return fmt.Sprintf("{V-flag: %t, A-flag:, %t S-flag: %t, B-flag: %t, Sid: %s}",
s.Flags&0x80 == 0x80, s.Flags&0x40 == 0x40, s.Flags&0x20 == 0x20, s.Flags&0x10 == 0x10, net.IP(s.SID).To16().String())
}
func (s *SegmentTypeB) MarshalJSON() ([]byte, error) {
- fmt.Printf("TypeB - MarshalJSON\n")
return json.Marshal(struct {
Type EncapSubTLVType `json:"type"`
VFlag bool `json:"v_flag"`
AFlag bool `json:"a_flag"`
SFlag bool `json:"s_flag"`
BFlag bool `json:"b_flag"`
+ Sid string `json:"sid"`
}{
Type: s.Type,
VFlag: s.Flags&0x80 == 0x80,
AFlag: s.Flags&0x40 == 0x40,
SFlag: s.Flags&0x20 == 0x20,
BFlag: s.Flags&0x10 == 0x10,
+ Sid: net.IP(s.SID).To16().String(),
})
}