From d07858d050f657060bd96d1cc248259fbb62ede6 Mon Sep 17 00:00:00 2001 From: Andy Huang <76430473+andytzuen@users.noreply.github.com> Date: Thu, 2 Nov 2023 08:27:53 +0000 Subject: [PATCH] Support AF_BRIDGE familiy frames from ebtables checkHeader() should return 4 for AF_BRIDGE familiy frames as well. Signed-off-by: Andy Huang <76430473+andytzuen@users.noreply.github.com> --- attribute.go | 2 +- internal/unix/types_linux.go | 1 + internal/unix/types_other.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/attribute.go b/attribute.go index 91d856e..f666d3c 100644 --- a/attribute.go +++ b/attribute.go @@ -137,7 +137,7 @@ func extractAttribute(a *Attribute, logger *log.Logger, data []byte) error { } func checkHeader(data []byte) int { - if (data[0] == unix.AF_INET || data[0] == unix.AF_INET6) && data[1] == unix.NFNETLINK_V0 { + if (data[0] == unix.AF_INET || data[0] == unix.AF_INET6 || data[0] == unix.AF_BRIDGE) && data[1] == unix.NFNETLINK_V0 { return 4 } return 0 diff --git a/internal/unix/types_linux.go b/internal/unix/types_linux.go index 616a407..c21399c 100644 --- a/internal/unix/types_linux.go +++ b/internal/unix/types_linux.go @@ -12,4 +12,5 @@ const ( AF_UNSPEC = linux.AF_UNSPEC AF_INET = linux.AF_INET AF_INET6 = linux.AF_INET6 + AF_BRIDGE = linux.AF_BRIDGE ) diff --git a/internal/unix/types_other.go b/internal/unix/types_other.go index 9618019..7f11e99 100644 --- a/internal/unix/types_other.go +++ b/internal/unix/types_other.go @@ -10,4 +10,5 @@ const ( AF_UNSPEC = 0x0 AF_INET = 0x2 AF_INET6 = 0xa + AF_BRIDGE = 0x7 )