From: Stas Sergeev <stsp@aknet.ru>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, linux-net@vger.kernel.org
Subject: Re: [patch] allow write() on SOCK_PACKET sockets
Date: Tue, 12 Oct 2004 07:33:25 +0400 [thread overview]
Message-ID: <416B5085.6070907@aknet.ru> (raw)
In-Reply-To: <E1CH7o3-0004M4-00@gondolin.me.apana.org.au>
Hi Herbert.
Herbert Xu wrote:
>> sendto(). SOCK_RAW code, in comparison, allows
>> write() after bind().
> It is counter-intuitive to allow write after bind(). AFAIK RAW
> only allows write after connect(), not bind().
I claim that SOCK_RAW allows write() after bind()
because a few days ago I changed dosemu code
to use SOCK_RAW instead of SOCK_PACKET and write()
instead of sendto(). See here:
http://cvs.sourceforge.net/viewcvs.py/dosemu/dosemu/src/dosext/net/net/libpacket.c?r1=1.4&r2=1.5&diff_format=u
http://cvs.sourceforge.net/viewcvs.py/dosemu/dosemu/src/dosext/net/net/pktnew.c?r1=1.7&r2=1.8&diff_format=u
Of course the fact that I did that for dosemu,
doesn't mean that I was doing the right thing
(so if you know it is wrong - I'll redo it)
but at least it was tested and works.
And since that works for SOCK_RAW, I don't
see any reasons for it to not work for
SOCK_PACKET. And btw, I can use read() quite
happily even with SOCK_PACKET, so why not
write()...
My patch is simply an adoption of the code
SOCK_RAW has. See af_packet.c:packet_sendmsg(),
you'll see under "if (saddr == NULL)" just the
same code as I was doing for SOCK_PACKET.
next prev parent reply other threads:[~2004-10-12 4:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-11 17:18 [patch] allow write() on SOCK_PACKET sockets Stas Sergeev
2004-10-11 21:34 ` Herbert Xu
2004-10-12 3:33 ` Stas Sergeev [this message]
2004-10-14 2:12 ` Herbert Xu
2004-10-14 3:45 ` Stas Sergeev
2004-10-14 8:26 ` Herbert Xu
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=416B5085.6070907@aknet.ru \
--to=stsp@aknet.ru \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@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