[quagga-dev 1416] unix vty socket and blocking

Paul Jakma paul at clubi.ie
Tue Aug 17 11:09:56 BST 2004


I'd like to make the following change to lib/vty.c. Essentially vtysh 
is dangerous at the moment. The following should undangerify the use 
of vtysh, however vtysh will instead fail to get all of long 
commands - that I intend to try fix at some later stage, either by 
making vtysh buffer, or making the current daemon-side buffering code 
used for telnet vty also deal with VTY_SHELL_SERV. (at present the 
telnet paging stuff is mixed in).

For now though, vtysh should not cause daemons to block, no?

Index: vty.c
===================================================================
RCS file: /var/cvsroot/quagga/lib/vty.c,v
retrieving revision 1.16
diff -u -r1.16 vty.c
--- vty.c	20 Jun 2004 19:54:37 -0000	1.16
+++ vty.c	17 Aug 2004 10:05:59 -0000
@@ -1856,7 +1856,7 @@
  vty_serv_un (char *path)
  {
    int ret;
-  int sock, len;
+  int sock, len, flags;
    struct sockaddr_un serv;
    mode_t old_mask;
    struct zprivs_ids_t ids;
@@ -1900,6 +1900,12 @@
        close (sock);	/* Avoid sd leak. */
        return;
      }
+
+  /* set to non-blocking*/
+  if ( ((flags = fcntl (accept_sock, F_GETFL)) == -1)
+      || (fcntl (accept_sock, F_SETFL, flags|O_NONBLOCK) == -1) )
+    zlog_warn ("vty_serv_un: could not set vty socket to non-blocking,"
+               " %s", strerror (errno));

    umask (old_mask);


regards,
-- 
Paul Jakma	paul at clubi.ie	paul at jakma.org	Key ID: 64A2FF6A
Fortune:
My opinions may have changed, but not the fact that I am right.



More information about the Quagga-dev mailing list