Skip to content

Commit

Permalink
Change default max_len to 65535 for controller action (contiv#69)
Browse files Browse the repository at this point in the history
Instead of 128.
65535 means that there is no buffering and that the full packet is sent
to the controller. This is actually the only value supported by OVS,
even though OVS will not reject other values. This can create confusion
as the flows will show `max_len=128`, but the controller will always
receive the full packet.
Another value for max_len can be explicitly provided using the new
`MaxLen` field in the `NXController` struct, but there should be no
reason to do so when using OVS.

See openvswitch/ovs-issues#295

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas authored Aug 16, 2023
1 parent 988fe7f commit a9c0ea7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.9.0
v0.10.0
12 changes: 10 additions & 2 deletions ofctrl/ofAction.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,29 @@ type NXController struct {
UserData []byte
MeterID uint32
Pause bool
MaxLen *uint16
}

func (a *NXController) GetActionMessage() openflow15.Action {
// By default, do not buffer, i.e., send the full packet to the controller.
// Note that OVS does not support buffering and always sends the full
// packet; it will ignore other values of max_len.
maxLen := uint16(openflow15.OFPCML_NO_BUFFER)
if a.MaxLen != nil {
maxLen = *a.MaxLen
}
if a.Version2 {
action := openflow15.NewNXActionController2()
action.AddControllerID(a.ControllerID)
action.AddReason(a.Reason)
action.AddUserdata(a.UserData)
action.AddMaxLen(128)
action.AddMaxLen(maxLen)
action.AddMeterID(a.MeterID)
action.AddPause(a.Pause)
return action
}
action := openflow15.NewNXActionController(a.ControllerID)
action.MaxLen = 128
action.MaxLen = maxLen
action.Reason = a.Reason
return action
}
Expand Down
2 changes: 1 addition & 1 deletion ofctrl/ofpacket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestNxOutputAndSendController(t *testing.T) {
flow1.Send(openflow15.FC_ADD)
verifyFlowInstallAndDelete(t, flow1, NewEmptyElem(), brName, table0.TableId,
"priority=100,ip,dl_src=11:22:33:44:55:66",
fmt.Sprintf("output:NXM_NX_REG0[],controller(max_len=128,id=%d)", app.Switch.ctrlID))
fmt.Sprintf("output:NXM_NX_REG0[],controller(id=%d)", app.Switch.ctrlID))
}

func testPacketInOut(t *testing.T, ofApp *packetApp, ipv6 bool, reason uint8, controllerV2 bool, dstPort uint16, userData []byte, pause bool) {
Expand Down

0 comments on commit a9c0ea7

Please sign in to comment.