Re: [PATCH virt-viewer] Use socat instead of nc if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
> On 09/03/2014 07:39 AM, Cole Robinson wrote:
> > I'd really recommend that virt-viewer just use the same shell code that
> > libvirt and virt-manager have used for years now, it's a crazy hack but it
> > should be battle hardened by now.
> > 
> 
> For reference, it is in
> src/rpc/virnetsocket.c:virNetSocketNewConnectSSH(), as:
> 
>     virBufferEscapeShell(&buf, netcat);
>     if (virBufferCheckError(&buf) < 0) {
>         virCommandFree(cmd);
>         return -1;
>     }
>     quoted = virBufferContentAndReset(&buf);
>     /*
>      * This ugly thing is a shell script to detect availability of
>      * the -q option for 'nc': debian and suse based distros need this
>      * flag to ensure the remote nc will exit on EOF, so it will go away
>      * when we close the connection tunnel. If it doesn't go away,
> subsequent
>      * connection attempts will hang.
>      *
>      * Fedora's 'nc' doesn't have this option, and defaults to the desired
>      * behavior.
>      */
>     virCommandAddArgFormat(cmd,
>          "'if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null
> 2>&1; then "
>              "ARG=-q0;"
>          "else "
>              "ARG=;"
>          "fi;"
>          "'%s' $ARG -U %s'",
>          quoted, quoted, path);

I think that's not the same check.

We need nc to exits from the 2 ends of the pipe whenever EOF is reached. But nc
does only leave on dest EOF when it is used with --recv-only.

Ex:
local server: nc -l localhost 9900
ssh pipe: nc localhost 9900

Ctrl-C the server, nc will not quit. Then try again with --recv-only.

socat quits on both end EOF, and solve our bug with Spice server end/disconnection.

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux