Re: Bind to protocol with AF_PACKET doesn't work for outgoing packets

Andi Kleen (ak@suse.de)
Thu, 1 Nov 2001 18:45:11 +0100


On Thu, Nov 01, 2001 at 08:33:15PM +0300, A.N.Kuznetsov wrote:
> Generally packet sockets MUST NOT tap on output packets. No differences

First if you really meant this dev_xmit_nit() (which you added) could be
removed. But I see no reason for this MUST NOT; IMHO it is a valid use
case to tap outgoing packets.

> of socket of another protocols. UDP does not tap output right?
> What the hell packet socket should do this?

Packet sockets are a little bit more 'raw' than UDP sockets; and for
sniffing it makes sense and people expect it.

It's also kind of promised by having a PACKET_OUTGOING type.

Now of course if you would be serious with this dev_queue_xmit would
need to be removed, making it impossible to debug/sniff local protocols
without an external sniffer. That would be of course very broken.
So it has to be kept. But then allowing it for ETH_P_ALL only is really
ugly imho; if the feature exists it should be implemented for the full
packet functionality which includes binding to protocols.

> Snapping on output is feature which must be regulated by a separate option.

When dev_xmit_nit is already there it is easy enough to do it, so no reason
to add such complications.

> And to be honest I see no tragedy, if this option will not exist for sockets
> bound to specific protocols.

I think the patch should be added.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/