Skip to content

Commit a487e95

Browse files
authored
Merge pull request #27 from napoleonwxu/master
fix: length of NewActionSetQueue is 8 bytes
2 parents 27e68f0 + 1457396 commit a487e95

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

openflow13/action.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ type ActionSetqueue struct {
195195
func NewActionSetQueue(queue uint32) *ActionSetqueue {
196196
a := new(ActionSetqueue)
197197
a.Type = ActionType_SetQueue
198-
a.Length = 8
198+
a.Length = a.Len()
199199
a.QueueId = queue
200200
return a
201201
}
202202

203203
func (a *ActionSetqueue) Len() (n uint16) {
204-
return a.ActionHeader.Len() + 12
204+
return a.ActionHeader.Len() + 4
205205
}
206206

207207
func (a *ActionSetqueue) MarshalBinary() (data []byte, err error) {
@@ -232,7 +232,7 @@ type ActionGroup struct {
232232
func NewActionGroup(group uint32) *ActionGroup {
233233
a := new(ActionGroup)
234234
a.Type = ActionType_Group
235-
a.Length = 8
235+
a.Length = a.Len()
236236
a.GroupId = group
237237
return a
238238
}
@@ -283,7 +283,7 @@ type ActionDecNwTtl struct {
283283
func NewActionDecNwTtl() *ActionDecNwTtl {
284284
act := new(ActionDecNwTtl)
285285
act.Type = ActionType_DecNwTtl
286-
act.Length = 8
286+
act.Length = act.Len()
287287
act.pad = make([]byte, 4)
288288
return act
289289
}
@@ -323,15 +323,15 @@ type ActionPush struct {
323323
func NewActionPushVlan(etherType uint16) *ActionPush {
324324
a := new(ActionPush)
325325
a.Type = ActionType_PushVlan
326-
a.Length = 8
326+
a.Length = a.Len()
327327
a.EtherType = etherType
328328
return a
329329
}
330330

331331
func NewActionPushMpls(etherType uint16) *ActionPush {
332332
a := new(ActionPush)
333333
a.Type = ActionType_PushMpls
334-
a.Length = 8
334+
a.Length = a.Len()
335335
a.EtherType = etherType
336336
return a
337337
}
@@ -364,7 +364,7 @@ type ActionPopVlan struct {
364364
func NewActionPopVlan() *ActionPopVlan {
365365
act := new(ActionPopVlan)
366366
act.Type = ActionType_PopVlan
367-
act.Length = 8
367+
act.Length = act.Len()
368368

369369
return act
370370
}
@@ -398,7 +398,7 @@ func NewActionPopMpls(etherType uint16) *ActionPopMpls {
398398
act := new(ActionPopMpls)
399399
act.Type = ActionType_PopMpls
400400
act.EtherType = etherType
401-
act.Length = 8
401+
act.Length = act.Len()
402402

403403
return act
404404
}

0 commit comments

Comments
 (0)