diff options
author | zvfvrv <franclombardo@gmail.com> | 2021-06-24 17:17:01 +0200 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2021-06-30 07:38:00 +0900 |
commit | 35ec732d85890c9039192ffa38943135d12b7bcb (patch) | |
tree | 40b66a5673fb104ee2c72368b198afbbc8e11431 /internal | |
parent | 4f29fd7785b89d7b7c7b77d2e8c7e57b958bf79a (diff) |
added check on data length for SRv6EndpointBehaviorStructure and SegmentTypeB, others minor fix
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/apiutil/attribute.go | 26 |
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 |