[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1cd7e87ad545c6f4c724b93051341ad.squirrel@webmail.itwm.fhg.de>
Date: Tue, 13 May 2014 22:25:06 +0200
From: "Phoebe Buckheister" <phoebe.buckheister@...m.fraunhofer.de>
To: "Werner Almesberger" <werner@...esberger.net>
Cc: "Phoebe Buckheister" <phoebe.buckheister@...m.fraunhofer.de>,
netdev@...r.kernel.org, davem@...emloft.net,
linux-zigbee-devel@...ts.sourceforge.net
Subject: Re: [Linux-zigbee-devel] [PATCH net-next 4/5] ieee802154: don't
ignore "to" argument in unbound dgram sendmsg
On Tue, May 13, 2014 10:13 pm, Werner Almesberger wrote:
> Phoebe Buckheister wrote:
>> For some reason, unconnected 802.15.4 dgram sockets ignore the
>> destination
>> argument of sendmsg(), while bound sockets use it. Instead, send packets
>> to the destination given by the user, and default to the connected
>> destination only if no explicit target is given.
>
> We discussed this a bit on IRC. Here's what I think happened and what
> happens with your patch. Before:
>
> conn'ed msg_nam action
> ------- ------- ------------------------------------------
> no no send to initialization value (= broadcast)
> no yes idem
> yes no send to connected address
> yes yes idem
>
> After your patch:
>
> conn'ed msg_nam action
> ------- ------- ------------------------------------------
> no no send to initialization value (= broadcast)
> no yes send to msg_name
> yes no send to connected address
> yes yes send to msg_name
>
> This is certainly more correct. Blurting out a broadcast in the
> no/no case isn't nice, though. It would be better to return either
> ENOTCONN (POSIX [1]) or (even better, according to GNU libc [2])
> EDESTADDRREQ.
>
> POSIX [1] says we may get EISCONN in the yes/yes case and the Linux
> man page [3] says we either get EISCONN or the msg_name argument is
> ignored. So that also doesn't look quite right yet.
You're completely right. I left the ENOTCONN case out on purpose and
forgot EISCONN, but as you listed, sendmsg() really never worked except in
one special case, and there's a bit of other nastiness going on in those
sockets. I'll revise this patch and add another to fix the rest.
>
> - Werner
>
> [1] http://pubs.opengroup.org/onlinepubs/007904975/
> [2] http://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
> [3] man sendmsg
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists