diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-11-10 08:08:23 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-11-10 08:08:23 -0500 |
| commit | 11ec76edb225c0f0e6a57b1d667179b14aa2ac20 (patch) | |
| tree | 731f3692764c8e5f68c75ab55cda5fbb1d37edff /lib/vty.c | |
| parent | 82b4d5da4be55ffc3ffd6b0d74de99d184a23b87 (diff) | |
| parent | 9f1f8df328271d3cd47a28c74efaeeefabc680ec (diff) | |
Merge remote-tracking branch 'opensourcerouting/cmaster-next-vty2' into cmaster-next
Conflicts:
watchquagga/watchquagga.c
Diffstat (limited to 'lib/vty.c')
| -rw-r--r-- | lib/vty.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1841,6 +1841,7 @@ vty_accept (struct thread *thread) return -1; } set_nonblocking(vty_sock); + set_cloexec(vty_sock); sockunion2hostprefix (&su, &p); @@ -1939,6 +1940,7 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) sockopt_v6only (ainfo->ai_family, sock); sockopt_reuseaddr (sock); sockopt_reuseport (sock); + set_cloexec (sock); ret = bind (sock, ainfo->ai_addr, ainfo->ai_addrlen); if (ret < 0) @@ -2006,6 +2008,7 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family) /* This is server, so reuse address. */ sockopt_reuseaddr (accept_sock); sockopt_reuseport (accept_sock); + set_cloexec (accept_sock); /* Bind socket to universal address and given port. */ ret = sockunion_bind (accept_sock, &su, port, naddr); @@ -2068,6 +2071,8 @@ vty_serv_un (const char *path) len = sizeof (serv.sun_family) + strlen (serv.sun_path); #endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */ + set_cloexec (sock); + ret = bind (sock, (struct sockaddr *) &serv, len); if (ret < 0) { @@ -2135,7 +2140,8 @@ vtysh_accept (struct thread *thread) close (sock); return -1; } - + set_cloexec(sock); + #ifdef VTYSH_DEBUG printf ("VTY shell accept\n"); #endif /* VTYSH_DEBUG */ @@ -2229,6 +2235,13 @@ vtysh_read (struct thread *thread) printf ("vtysh node: %d\n", vty->node); #endif /* VTYSH_DEBUG */ + /* hack for asynchronous "write integrated" + * - other commands in "buf" will be ditched + * - input during pending config-write is "unsupported" */ + if (ret == CMD_SUSPEND) + break; + + /* warning: watchquagga hardcodes this result write */ header[3] = ret; buffer_put(vty->obuf, header, 4); |
