diff --git a/backend/app/agent_assets/nexafabric-ebpf.go b/backend/app/agent_assets/nexafabric-ebpf.go index f28e519..1c244eb 100644 --- a/backend/app/agent_assets/nexafabric-ebpf.go +++ b/backend/app/agent_assets/nexafabric-ebpf.go @@ -69,8 +69,12 @@ type payload struct { Diagnostics diagnostics `json:"diagnostics"` } -func htons(value uint16) int { - return int((value<<8)&0xff00 | value>>8) +func htons(value uint16) uint16 { + return (value<<8)&0xff00 | value>>8 +} + +func htonsInt(value uint16) int { + return int(htons(value)) } func intPtr(value int) *int { @@ -167,7 +171,7 @@ func openSocket(interfaceName string) (int, error) { if err != nil { return -1, err } - fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_RAW, htons(ethPAll)) + fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_RAW, htonsInt(ethPAll)) if err != nil { return -1, err }