Skip to content

Commit 84148cd

Browse files
committed
[BPF] disable frag tests with vxlan on ubuntu 22.04
1 parent fe90ebe commit 84148cd

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

felix/fv/bpf_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,10 @@ func describeBPFTests(opts ...bpfTestOpt) bool {
17391739

17401740
_ = !testOpts.ipv6 && !testOpts.dsr &&
17411741
It("should handle fragmented UDP", func() {
1742+
if testOpts.tunnel == "vxlan" && !utils.UbuntuReleaseGreater("22.04") {
1743+
Skip("Ubuntu too old to handle frag on vxlan dev properly")
1744+
}
1745+
17421746
dev := "eth0"
17431747
switch testOpts.tunnel {
17441748
case "vxlan":

felix/fv/utils/utils.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"os"
2323
"os/exec"
24+
"strconv"
2425
"strings"
2526
"syscall"
2627
"time"
@@ -295,3 +296,50 @@ func GetSysArch() string {
295296
}
296297
return arch
297298
}
299+
300+
func GetUbuntuRelease() string {
301+
// The full shell command pipeline
302+
cmdString := "lsb_release -r | awk '{print $2}'"
303+
304+
// Execute the command using /bin/sh -c to interpret the pipe
305+
cmd := exec.Command("/bin/sh", "-c", cmdString)
306+
307+
// Run the command and capture its standard output
308+
output, err := cmd.Output()
309+
if err != nil {
310+
// Handle potential errors, e.g., command not found, permission issues, non-zero exit code
311+
if exitErr, ok := err.(*exec.ExitError); ok {
312+
fmt.Printf("Error: Command exited with non-zero status: %d\n", exitErr.ExitCode())
313+
fmt.Printf("Stderr: %s\n", exitErr.Stderr)
314+
} else {
315+
fmt.Printf("Error: Failed to execute command: %v\n", err)
316+
}
317+
return "" // Return an empty string on error
318+
}
319+
320+
// Convert the output (byte slice) to a string and trim whitespace
321+
versionString := strings.TrimSpace(string(output))
322+
return versionString
323+
}
324+
325+
func UbuntuReleaseGreater(release string) bool {
326+
currentReleaseStr := GetUbuntuRelease()
327+
if currentReleaseStr == "" {
328+
fmt.Println("Could not get current Ubuntu release for comparison.")
329+
return false
330+
}
331+
332+
currentRelease, err := strconv.ParseFloat(currentReleaseStr, 64)
333+
if err != nil {
334+
fmt.Printf("Error parsing current Ubuntu release '%s' to float: %v\n", currentReleaseStr, err)
335+
return false
336+
}
337+
338+
compareRelease, err := strconv.ParseFloat(release, 64)
339+
if err != nil {
340+
fmt.Printf("Error parsing provided release '%s' to float: %v\n", release, err)
341+
return false
342+
}
343+
344+
return currentRelease > compareRelease
345+
}

0 commit comments

Comments
 (0)