Subject: PF_PACKET + bind() to proto + outbound packets

From: Paul LeoNerd Evans <[email-masked]>
Date: Fri, 14 May 2010 02:14:35 +0100

I'm writing a small traffic watching program, to capture IPv4 packets.

If I have a PF_PACKET socket bound to no particular protocol it sees
both inbound and outbound packets; I can then apply a BPF filter for
just one protocol (i.e. IPv4).

But if instead I bind the socket to the IPv4 protocol specifically, it
no longer sees any outbound packets created by the machine, only inbound
ones.

Is there perhaps some ioctl or sockopt I could enable, to see these
outbound packets too?

Further, would there actually be much difference in practice, in terms
of performance, abilities, etc... even if this were an option turned on?
What's the preferred method of snooping on all of the machine's, for
example, IPv4 traffic?

-- 
Paul "LeoNerd" Evans

[email-masked]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/