diff --git a/ovs/vswitch.go b/ovs/vswitch.go index 181ced2..8632f7d 100644 --- a/ovs/vswitch.go +++ b/ovs/vswitch.go @@ -274,6 +274,11 @@ type InterfaceOptions struct { // tunneled traffic leaving this interface. Optionally it could be set to // "flow" which expects the flow to set tunnel ID. Key string + + // Optionally compute encapsulation header (either GRE or UDP) checksums on + // outgoing packets. Default is false, set to true to enable. Checksums present + // on incoming packets will be validated regardless of this setting. + Csum string } // slice creates a string slice containing any non-zero option values from the @@ -315,5 +320,9 @@ func (i InterfaceOptions) slice() []string { s = append(s, fmt.Sprintf("options:key=%s", i.Key)) } + if i.Csum != "" { + s = append(s, fmt.Sprintf("options:csum=%s", i.Csum)) + } + return s } diff --git a/ovs/vswitch_test.go b/ovs/vswitch_test.go index 8298537..5dd5fc3 100644 --- a/ovs/vswitch_test.go +++ b/ovs/vswitch_test.go @@ -857,6 +857,21 @@ func TestInterfaceOptions_slice(t *testing.T) { "options:key=flow", }, }, + { + desc: "flow based VXLAN tunnel", + i: InterfaceOptions{ + Type: InterfaceTypeVXLAN, + RemoteIP: "flow", + Key: "flow", + Csum: "true", + }, + out: []string{ + "type=vxlan", + "options:remote_ip=flow", + "options:key=flow", + "options:csum=true", + }, + }, { desc: "all options", i: InterfaceOptions{