summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg')
-rw-r--r--internal/pkg/apiutil/attribute.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go
index 9d8267a1..19060932 100644
--- a/internal/pkg/apiutil/attribute.go
+++ b/internal/pkg/apiutil/attribute.go
@@ -1878,24 +1878,20 @@ func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*any.Any {
SFlag: s.Flags&0x20 == 0x20,
BFlag: s.Flags&0x10 == 0x10,
}
+ segment := &api.SegmentTypeB{
+ Flags: flags,
+ Sid: s.SID,
+ }
if s.SRv6EBS != nil {
- r = &api.SegmentTypeB{
- Flags: flags,
- Sid: s.SID,
- EndpointBehaviorStructure: &api.SRv6EndPointBehavior{
- Behavior: api.SRv6Behavior(s.SRv6EBS.Behavior),
- BlockLen: uint32(s.SRv6EBS.BlockLen),
- NodeLen: uint32(s.SRv6EBS.NodeLen),
- FuncLen: uint32(s.SRv6EBS.FuncLen),
- ArgLen: uint32(s.SRv6EBS.ArgLen),
- },
- }
- } else {
- r = &api.SegmentTypeB{
- Flags: flags,
- Sid: s.SID,
+ segment.EndpointBehaviorStructure = &api.SRv6EndPointBehavior{
+ Behavior: api.SRv6Behavior(s.SRv6EBS.Behavior),
+ BlockLen: uint32(s.SRv6EBS.BlockLen),
+ NodeLen: uint32(s.SRv6EBS.NodeLen),
+ FuncLen: uint32(s.SRv6EBS.FuncLen),
+ ArgLen: uint32(s.SRv6EBS.ArgLen),
}
}
+ r = segment
default:
// Unrecognize Segment type, skip it
continue