Will Linux still receive AF_PACKET if it's not bound to an interface?

Viewed 64

I'm trying to receive a particular type of packet irrespective of the interface it arrives on.

fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_RAW, int(htons(0x88cc)))
for {
  len, sa, err := syscall.Recvfrom(fd, buf, 0)
  <process packet>
}

Whilst this works, it only works when something else binds to an interface it seems. I.e if the application is running and I start a tcpdump filtered to the desired data only then will my application receive the desired traffic.

Is this due to interfaces filtering on undirected traffic? How can AF_PACKET listen for a particular ether type on all interfaces on a System?

0 Answers
Related