On Fri, Jan 07, 2011 at 10:52:18AM -0800, Jeremy Evans wrote: > On 01/07 06:21, Nicholas Marriott wrote: > > On Fri, Jan 07, 2011 at 08:48:20AM -0800, Jeremy Evans wrote: > > > On 01/07 09:31, Nicholas Marriott wrote: > > > > On Thu, Jan 06, 2011 at 03:32:17PM -0800, Jeremy Evans wrote: > > > > > This patch adds unix datagram socket support to nc(1). It's basically > > > > > the same patch I sent last June (see > > > > > http://marc.info/?l=openbsd-tech&m=127627296925965&w=2), but updated > > > > > for -current. > > > > > > > > > > Tested on amd64. Doesn't appear to cause any regressions to existing > > > > > support, tested with unix stream and IP stream and datagram sockets. > > > > > Looking for OKs. > > > > > > > > > > Jeremy > > > > > > > > Hmm, ISTR I meant to look at this ages ago but it got lost, sorry. > > > > > > > > So you are overloading -u to mean UDP without -l and datagram with -l? > > > > I guess this makes sense, but we need man page changes? > > > > > > If you mean -U instead of -l, yes. -u without -U is IP UDP, -u with -U > > > is unix datagram. The man page doesn't say you can't use -u and -U > > > together, and it doesn't say that -U means unix stream sockets, though > > > that is currently all that -U supports. However, I think that making > > > some clarifications to the man page would helpful. > > > > Yes, sorry, I meant -U. > > > > This mostly looks fine to me, a few comments: > > > > I don't much like using mktemp at all. How about just plain requiring -s > > with -Uu? > > It's annoying to the user to have to specify it when they won't usually > care. If you are worried about security, guenther@ thought this usage > was secure: http://marc.info/?l=openbsd-tech&m=120299257422367&w=2
Well, I'm less worried about security and also about the fact mktemp is deprecated so I don't think adding new uses of it is not ideal. I can't think of a better way though. Two further minor comments: - Can the mktemp buffer be on the stack rather than malloc()d? - I think the man page should mention it creates a file in /tmp (or mktemp). > > I'd prefer we always use a random socket over forcing the user to > specify one, but I thinking giving the user choice is best, just like > we give them choice of sending address in the IP case. > Fair point, although this is obviously not a feature much in demand ;-). > > Do you actually hit the ENOBUFS condition in atomicio.c? > > Yes. That's the only reason I knew to add it. Fine. I note that the various atomicio.c are not really in sync anyway so this can't hurt. > > Jeremy