From: Alex Gartrell <agartrell@fb.com>
To: Jason Wang <jasowang@redhat.com>, <davem@davemloft.net>,
<herbert@gondor.apana.org.au>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>
Subject: Re: [PATCH net-next 2/2] tun: enable socket system calls
Date: Fri, 26 Dec 2014 14:16:32 -0500 [thread overview]
Message-ID: <549DB410.8000002@fb.com> (raw)
In-Reply-To: <549D2DBE.5040301@redhat.com>
Hello Jason,
Thanks for commenting.
On 12/26/14 4:43 AM, Jason Wang wrote:
>
> On 12/26/2014 02:50 PM, Alex Gartrell wrote:
>> By setting private_data to a socket and private_data_is_socket to true, we
>> can use the socket syscalls. We also can't just blindly use private_data
>> anymore, so there's a __tun_file_get function that returns the container_of
>> private_data appropriately.
>
> So this in fact expose other socket syscalls to userspace. But some of
> proto_ops was not supported. E.g consider what happens if a bind() was
> called for tun socket?
Yeah, I erroneously assumed that NULL => sock_no_*, but a quick glance
assures me that that's not the case. In this case, I'd need to
introduce another patch that sets all of the additional ops to sock_no_*.
>> +static struct tun_file *tun_file_from_file(struct file *file)
>> +{
>> + struct socket *s = (struct socket *)file->private_data;
>> +
>> + if (!s)
>
> Can s be NULL here? If yes, why tun_get() didn't check for NULL?
This check is just to ensure that tun_get_socket continues to work in
the right way when passed a file with private_data set to NULL.
Thanks,
--
Alex Gartrell <agartrell@fb.com>
prev parent reply other threads:[~2014-12-26 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 6:50 [PATCH net-next 0/2] tun: support socket system calls Alex Gartrell
2014-12-26 6:50 ` [PATCH net-next 1/2] socket: Allow external sockets to use socket syscalls Alex Gartrell
2014-12-26 9:45 ` Jason Wang
2014-12-26 19:26 ` Alex Gartrell
2014-12-26 19:56 ` Al Viro
2014-12-26 19:59 ` Alex Gartrell
2014-12-26 6:50 ` [PATCH net-next 2/2] tun: enable socket system calls Alex Gartrell
2014-12-26 9:43 ` Jason Wang
2014-12-26 19:16 ` Alex Gartrell [this message]
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=549DB410.8000002@fb.com \
--to=agartrell@fb.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jasowang@redhat.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).