[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140513201340.GB12817@ws>
Date: Tue, 13 May 2014 17:13:40 -0300
From: Werner Almesberger <werner@...esberger.net>
To: Phoebe Buckheister <phoebe.buckheister@...m.fraunhofer.de>
Cc: 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
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.
- 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