Skip to content

Commit

Permalink
Add CFlag in LspObject
Browse files Browse the repository at this point in the history
  • Loading branch information
kanaya516 authored and Motok1 committed Jun 8, 2024
1 parent da7f478 commit c9852c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/packet/pcep/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ type LspObject struct {
DstAddr netip.Addr
PlspID uint32
LspID uint16
CFlag bool
OFlag uint8
AFlag bool
RFlag bool
Expand Down Expand Up @@ -535,6 +536,9 @@ func (o *LspObject) Serialize() []uint8 {

buf := make([]uint8, 4)
binary.BigEndian.PutUint32(buf, uint32(o.PlspID<<12)+uint32(o.OFlag<<4))
if o.CFlag {
buf[3] = buf[3] | 0x80
}
if o.AFlag {
buf[3] = buf[3] | 0x08
}
Expand Down Expand Up @@ -572,6 +576,7 @@ func NewLspObject(lspName string, plspID uint32) (*LspObject, error) {
ObjectType: OT_LSP_LSP,
Name: lspName,
PlspID: plspID,
CFlag: true, // (RFC8281 5.3.1)
OFlag: uint8(1), // UP (RFC8231 7.3)
AFlag: true, // desired operational state is active (RFC8231 7.3)
RFlag: false, // TODO: Allow setting from function arguments
Expand Down

0 comments on commit c9852c5

Please sign in to comment.