Give each stream its own ethertype steered to its own rx queue

This commit is contained in:
flamingcow
2026-07-25 19:08:11 -07:00
parent 0af94219a7
commit 7e77d22f36
4 changed files with 232 additions and 96 deletions
+1 -8
View File
@@ -56,7 +56,7 @@ func openTxSocket(ifindex int) (int, error) {
return fd, nil
}
func openRxSocket(ifindex, fanoutID, fanoutMode int) (int, error) {
func openRxSocket(ifindex int, etherType uint16) (int, error) {
proto := int(htons(etherType))
fd, err := unix.Socket(unix.AF_PACKET, unix.SOCK_RAW, proto)
if err != nil {
@@ -82,13 +82,6 @@ func openRxSocket(ifindex, fanoutID, fanoutMode int) (int, error) {
unix.Close(fd)
return -1, fmt.Errorf("rcvtimeo: %w", err)
}
if fanoutMode >= 0 {
arg := (fanoutMode << 16) | (fanoutID & 0xffff)
if err := unix.SetsockoptInt(fd, unix.SOL_PACKET, unix.PACKET_FANOUT, arg); err != nil {
unix.Close(fd)
return -1, fmt.Errorf("fanout: %w", err)
}
}
return fd, nil
}