summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorzvfvrv <franclombardo@gmail.com>2021-06-23 17:40:53 +0200
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-06-30 07:38:00 +0900
commit4f29fd7785b89d7b7c7b77d2e8c7e57b958bf79a (patch)
tree541cbb2942b20ec4b109e511cdf8db9018f4c31d
parentedda6899101cca31e21a2eec079dc418d5213fd4 (diff)
fix UnmarshalSRSegments for SegmentTypeB
-rw-r--r--internal/pkg/apiutil/attribute.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go
index 1b4a73e7..9d8267a1 100644
--- a/internal/pkg/apiutil/attribute.go
+++ b/internal/pkg/apiutil/attribute.go
@@ -1871,7 +1871,6 @@ func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*any.Any {
BFlag: s.Flags&0x10 == 0x10,
},
}
- // TODO (sbezverk) Add Type B Segment when SRv6 Binding SID gets finalized.
case *bgp.SegmentTypeB:
flags := &api.SegmentFlags{
VFlag: s.Flags&0x80 == 0x80,
@@ -1960,6 +1959,16 @@ func UnmarshalSRSegments(s []*any.Any) ([]bgp.TunnelEncapSubTLVInterface, error)
if v.Flags.BFlag {
seg.Flags += 0x10
}
+ if v.EndpointBehaviorStructure != nil {
+ ebs := v.GetEndpointBehaviorStructure()
+ seg.SRv6EBS = &bgp.SRv6EndpointBehaviorStructure{
+ Behavior: bgp.SRBehavior(ebs.Behavior),
+ BlockLen: uint8(ebs.BlockLen),
+ NodeLen: uint8(ebs.NodeLen),
+ FuncLen: uint8(ebs.FuncLen),
+ ArgLen: uint8(ebs.ArgLen),
+ }
+ }
segments[i] = seg
}
}