From: "Michael S. Tsirkin" <mst@redhat.com>
To: Chris Friesen <cfriesen@nortel.com>
Cc: David Miller <davem@davemloft.net>,
eric.dumazet@gmail.com, nhorman@tuxdriver.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: packet: option to only pass skb protocol
Date: Wed, 6 Jan 2010 00:27:48 +0200 [thread overview]
Message-ID: <20100105222748.GG30921@redhat.com> (raw)
In-Reply-To: <4B43B989.4010004@nortel.com>
On Tue, Jan 05, 2010 at 04:13:29PM -0600, Chris Friesen wrote:
> On 01/05/2010 03:42 PM, David Miller wrote:
> > From: "Chris Friesen" <cfriesen@nortel.com>
> > Date: Tue, 05 Jan 2010 15:28:22 -0600
> >
> >> On 01/05/2010 12:57 PM, Michael S. Tsirkin wrote:
> >>> 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.
> >>
> >> What about automatically detecting the protocol from the data being sent
> >> to avoid the necessity of specifying it in the first place?
> >
> > This limits packet socket usage to only protocols the kernel is aware
> > of, defeating part of the usefulness of the packet socket facility.
>
> I don't follow.
>
> If SOCK_RAW packets are being sent, the protocol number is embedded in
> the packet data and the kernel should be able to extract it regardless
> of whether the kernel actually supports it or not. I see that Michael
> just posted a patch for this.
>
> If SOCK_DGRAM packets are being sent, then I agree that the app needs to
> pass it down at send time or at bind() time to support protocols of
> which the kernel is not aware.
>
> While looking at the code I noticed that while the protocol number is
> validated at socket creation time it does not appear to be validated for
> calls to bind() for packet sockets. Is this intentional?
>
> As a further question, does it actually make sense to check the protocol
> number at packet socket creation? It seems like we should be able to
> allow a packet socket to specify arbitrary protocol numbers since the
> kernel doesn't really need to do anything with them.
>
> Chris
I wouldn't say kernel doesn't really need to do anything with them.
In fact I think currently protocol number affects whether other packet
sockets see the packet in question. There may be other cases, e.g. if
the device in question is a bridge, the packet gets reinjected in host
stack, so using a silly value for protocol field might interfere with
GRO etc.
--
MST
next prev parent reply other threads:[~2010-01-05 22:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-05 18:57 [PATCH] net: packet: option to only pass skb protocol Michael S. Tsirkin
2010-01-05 19:27 ` Eric Dumazet
2010-01-05 20:50 ` Michael S. Tsirkin
2010-01-05 21:40 ` David Miller
2010-01-05 21:50 ` Michael S. Tsirkin
2010-01-05 21:28 ` Chris Friesen
2010-01-05 21:42 ` David Miller
2010-01-05 21:45 ` Michael S. Tsirkin
2010-01-05 22:05 ` Michael S. Tsirkin
2010-01-05 22:13 ` Chris Friesen
2010-01-05 22:27 ` Michael S. Tsirkin [this message]
2010-01-05 23:51 ` David Miller
2010-01-06 9:12 ` Michael S. Tsirkin
2010-01-06 19:24 ` Michael S. Tsirkin
2010-01-07 8:27 ` Michał Mirosław
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100105222748.GG30921@redhat.com \
--to=mst@redhat.com \
--cc=cfriesen@nortel.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).