lkml.org 
[lkml]   [2010]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: packet: option to only pass skb protocol
On Tue, Jan 05, 2010 at 08:27:21PM +0100, Eric Dumazet wrote:
> Le 05/01/2010 19:57, Michael S. Tsirkin a écrit :
> > When sending packets with a packet socket it is often necessary to set
> > protocol in msg_name: otherwise the protocol field in the skb will not
> > be set correctly. However, currently doing this also requires
> > supplying the interface index.
> >
> > The following patch makes it possible to avoid supplying the interface
> > index by interpreting index 0 as "use device this socket is bound to".
> >
>
> Patch is correct, but I dont understand why zero initialization by caller
> is any better then supplying ifindex (known when socket was bound to device ?)
>
> To avoid one syscall at socket setup (to get ifindex from dev name),
> you prefer to add a test/branch at each send() syscall...
>
> Am I missing something ?

binding socket to device might be done by a separate process
from the one doing sendmsg, and IMO the device socket is bound
to might change at any time.

So the sending process would need to get socket name before
each sendmsg.

Makes sense?

--
MST
--
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/

\
 
 \ /
  Last update: 2010-01-05 21:57    [W:0.159 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site