On 01/06 07:07, Ted Unangst wrote:
> On Thu, Jan 6, 2011 at 6:32 PM, Jeremy Evans <[email protected]> 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.
> 
> Why is the socket name specified via -p for datagrams or possibly
> random?  Shouldn't this be just like the stream unix code?

I believe that for unix stream sockets, you don't need to have a sending
socket file created, while you do for datagram sockets, as otherwise you
can't have a bidirectional connection.

I have no problem with always using a random sending socket file, and
ignoring -p in the unix datagram case, if you think that is best.
Thinking more about it, -s would be more appropriate than -p anyway if
you did want to specify the source socket.

Jeremy

> 
> > + ? ? ? /* Get name of temporary socket for unix datagram client */
> > + ? ? ? if ((family == AF_UNIX) && uflag && !lflag) {
> > + ? ? ? ? ? ? ? if(pflag) {
> > + ? ? ? ? ? ? ? ? ? ? ? unix_dg_tmp_socket = pflag;
> > + ? ? ? ? ? ? ? } else {
> > + ? ? ? ? ? ? ? ? ? ? ? if((unix_dg_tmp_socket = (char *)malloc(19)) == 
> > NULL)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? errx(1, "not enough memory");
> > + ? ? ? ? ? ? ? ? ? ? ? strlcpy(unix_dg_tmp_socket, "/tmp/nc.XXXXXXXXXX", 
> > 19);
> > + ? ? ? ? ? ? ? ? ? ? ? mktemp(unix_dg_tmp_socket);
> > + ? ? ? ? ? ? ? }
> > + ? ? ? }
> > +

Reply via email to