AS_HELP_STRING([--enable-snmp=ARG], [enable SNMP support (smux or agentx)]))
AC_ARG_WITH(libpam,
AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
-AC_ARG_ENABLE(tcp-zebra,
- AS_HELP_STRING([--enable-tcp-zebra], [enable TCP/IP socket connection between zebra and protocol daemon]))
AC_ARG_ENABLE(ospfapi,
AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
AC_ARG_ENABLE(ospfclient,
# End of logic for protobuf support.
#
-if test "${enable_tcp_zebra}" = "yes"; then
- AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
-fi
-
if test "${enable_linux24_tcp_md5}" = "yes"; then
AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
fi
--enable-rtadv \
--disable-exampledir \
--enable-watchfrr \
- --enable-tcp-zebra \
--disable-ldpd \
--enable-fpm \
--enable-nhrpd \
--enable-rtadv \
--disable-exampledir \
--enable-watchfrr \
- --enable-tcp-zebra \
--disable-ldpd \
--enable-fpm \
--enable-nhrpd \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--enable-ldpd \
--with-pkg-git-version \
--enable-rtadv \
--disable-exampledir \
--enable-watchfrr \
- --enable-tcp-zebra \
--enable-ldpd \
--enable-fpm \
--enable-nhrpd \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--enable-ldpd \
--with-pkg-git-version \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
- --enable-tcp-zebra \
--enable-fpm \
--enable-systemd=yes \
--with-pkg-git-version \
.TP
\fB\-z\fR, \fB\-\-socket \fR\fIpath\fR
Specify the socket path for contacting the zebra daemon.
-The default is \fB\fI@CFG_STATE@/zserv.api\fR.
+The default is \fB\fI@CFG_STATE@/zserv.api\fR. The value of this option
+must be the same as the one given when starting zebra. Refer to the \fBzebra
+(8)\fR man page for more information.
.TP
\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR
Specify the port that the pimd VTY will listen on. This defaults to
] [
.B \-M
.I module:options
+] [
+.B \-z
+.I socketpath
]
.SH DESCRIPTION
.B zebra
argument specifying the encapsulation, either \fBnetlink\fR or \fBprotobuf\fR.
It should thus be loaded with \fB-M fpm:netlink\fR or \fB-M fpm:protobuf\fR.
.TP
+\fB\-z\fR, \fB\-\-socket \fR\fIsocketpath\fR
+Use the specified path to open the zebra API socket on.
+The default is \fB\fI@CFG_STATE@/zserv.api\fR. This option must be given with
+the same value to all FRR protocol daemons.
+
+For debugging purposes (using tcpdump or wireshark to trace cross-daemon
+communication), a TCP socket can be used by specifying \fI@tcp[46][:port]\fR.
+It is intentionally not possible to bind this to anything other than localhost
+since zebra and the other daemons need to be running on the same host. Using
+this feature \fBCREATES A SECURITY ISSUE\fR since nothing prevents other users
+on the local system from connecting to zebra and injecting bogus routing
+information.
+.TP
\fB\-v\fR, \fB\-\-version\fR
Print the version and exit.
.SH FILES
#include "zclient.h"
#include "stream.h"
#include "network.h"
+#include "libfrr.h"
static void lde_shutdown(void);
static int lde_dispatch_imsg(struct thread *);
lde_gc_start_timer();
/* Init synchronous zclient and label list */
- zclient_serv_path_set(init->zclient_serv_path);
+ frr_zclient_addr(&zclient_addr, &zclient_addr_len,
+ init->zclient_serv_path);
zclient_sync_init(init->instance);
lde_label_list_init();
}
strlcpy(init.user, ldpd_privs.user, sizeof(init.user));
strlcpy(init.group, ldpd_privs.group, sizeof(init.group));
strlcpy(init.ctl_sock_path, ctl_sock_path, sizeof(init.ctl_sock_path));
- strlcpy(init.zclient_serv_path, zclient_serv_path_get(),
+ strlcpy(init.zclient_serv_path, frr_zclientpath,
sizeof(init.zclient_serv_path));
argc -= optind;
*/
#include <zebra.h>
+#include <sys/un.h>
#include "libfrr.h"
#include "getopt.h"
char frr_protonameinst[256] = "NONE";
char config_default[256];
+char frr_zclientpath[256];
static char pidfile_default[256];
static char vtypath_default[256];
lo_user};
+bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len,
+ const char *path)
+{
+ memset(sa, 0, sizeof(*sa));
+
+ if (!path)
+ path = ZEBRA_SERV_PATH;
+
+ if (!strncmp(path, ZAPI_TCP_PATHNAME, strlen(ZAPI_TCP_PATHNAME))) {
+ int af;
+ int port = ZEBRA_PORT;
+ char *err = NULL;
+ struct sockaddr_in *sin = NULL;
+ struct sockaddr_in6 *sin6 = NULL;
+
+ path += strlen(ZAPI_TCP_PATHNAME);
+
+ switch (path[0]) {
+ case '4':
+ path++;
+ af = AF_INET;
+ break;
+ case '6':
+ path++;
+ /* fallthrough */
+ default:
+ af = AF_INET6;
+ break;
+ }
+
+ switch (path[0]) {
+ case '\0':
+ break;
+ case ':':
+ path++;
+ port = strtoul(path, &err, 10);
+ if (*err || !*path)
+ return false;
+ break;
+ default:
+ return false;
+ }
+
+ sa->ss_family = af;
+ switch (af) {
+ case AF_INET:
+ sin = (struct sockaddr_in *)sa;
+ sin->sin_port = htons(port);
+ sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ *sa_len = sizeof(struct sockaddr_in);
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ sin->sin_len = *sa_len;
+#endif
+ break;
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *)sa;
+ sin6->sin6_port = htons(port);
+ inet_pton(AF_INET6, "::1", &sin6->sin6_addr);
+ *sa_len = sizeof(struct sockaddr_in6);
+#ifdef SIN6_LEN
+ sin6->sin6_len = *sa_len;
+#endif
+ break;
+ }
+ } else {
+ /* "sun" is a #define on solaris */
+ struct sockaddr_un *suna = (struct sockaddr_un *)sa;
+
+ suna->sun_family = AF_UNIX;
+ strlcpy(suna->sun_path, path, sizeof(suna->sun_path));
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
+ *sa_len = suna->sun_len = SUN_LEN(suna);
+#else
+ *sa_len = sizeof(suna->sun_family) + strlen(suna->sun_path);
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
+#if 0
+ /* this is left here for future reference; Linux abstract
+ * socket namespace support can be enabled by replacing
+ * above #if 0 with #ifdef GNU_LINUX.
+ *
+ * THIS IS A SECURITY ISSUE, the abstract socket namespace
+ * does not have user/group permission control on sockets.
+ * we'd need to implement SCM_CREDENTIALS support first to
+ * check that only proper users can connect to abstract
+ * sockets. (same problem as tcp-zebra, except there is a
+ * fix with SCM_CREDENTIALS. tcp-zebra has no such fix.)
+ */
+ if (suna->sun_path[0] == '@')
+ suna->sun_path[0] = '\0';
+#endif
+ }
+ return true;
+}
+
static struct frr_daemon_info *di = NULL;
void frr_preinit(struct frr_daemon_info *daemon, int argc, char **argv)
strlcpy(frr_protoname, di->logname, sizeof(frr_protoname));
strlcpy(frr_protonameinst, di->logname, sizeof(frr_protonameinst));
+
+ strlcpy(frr_zclientpath, ZEBRA_SERV_PATH, sizeof(frr_zclientpath));
}
void frr_opt_add(const char *optstr, const struct option *longopts,
case 'z':
if (di->flags & FRR_NO_ZCLIENT)
return 1;
- zclient_serv_path_set(optarg);
+ strlcpy(frr_zclientpath, optarg, sizeof(frr_zclientpath));
break;
case 'A':
if (di->flags & FRR_NO_TCPVTY)
zlog_set_level(ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
#endif
+ if (!frr_zclient_addr(&zclient_addr, &zclient_addr_len,
+ frr_zclientpath)) {
+ fprintf(stderr, "Invalid zserv socket path: %s\n",
+ frr_zclientpath);
+ exit(1);
+ }
+
frrmod_init(di->module);
while (modules) {
modules = (oc = modules)->next;
/* note: contains call to frr_vty_serv() */
extern void frr_run(struct thread_master *master);
+extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len,
+ const char *path);
+
extern char config_default[256];
+extern char frr_zclientpath[256];
extern const char frr_sysconfdir[];
extern const char frr_vtydir[];
extern const char frr_moduledir[];
/* Prototype for event manager. */
static void zclient_event(enum event, struct zclient *);
-const char *zclient_serv_path = NULL;
+struct sockaddr_storage zclient_addr;
+socklen_t zclient_addr_len;
/* This file local debug flag. */
int zclient_debug = 0;
zclient_init(zclient, zclient->redist_default, zclient->instance);
}
-#ifdef HAVE_TCP_ZEBRA
-
-/* Make socket to zebra daemon. Return zebra socket. */
-static int zclient_socket(void)
+/**
+ * Connect to zebra daemon.
+ * @param zclient a pointer to zclient structure
+ * @return socket fd just to make sure that connection established
+ * @see zclient_init
+ * @see zclient_new
+ */
+int zclient_socket_connect(struct zclient *zclient)
{
int sock;
int ret;
- struct sockaddr_in serv;
/* We should think about IPv6 connection. */
- sock = socket(AF_INET, SOCK_STREAM, 0);
+ sock = socket(zclient_addr.ss_family, SOCK_STREAM, 0);
if (sock < 0)
return -1;
- /* Make server socket. */
- memset(&serv, 0, sizeof(struct sockaddr_in));
- serv.sin_family = AF_INET;
- serv.sin_port = htons(ZEBRA_PORT);
-#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
- serv.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
- serv.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ set_cloexec(sock);
/* Connect to zebra. */
- ret = connect(sock, (struct sockaddr *)&serv, sizeof(serv));
+ ret = connect(sock, (struct sockaddr *)&zclient_addr,
+ zclient_addr_len);
if (ret < 0) {
if (zclient_debug)
zlog_warn("%s connect failure: %d(%s)",
close(sock);
return -1;
}
- return sock;
-}
-#else
-
-/* For sockaddr_un. */
-#include <sys/un.h>
-
-static int zclient_socket_un(const char *path)
-{
- int ret;
- int sock, len;
- struct sockaddr_un addr;
-
- sock = socket(AF_UNIX, SOCK_STREAM, 0);
- if (sock < 0)
- return -1;
-
- /* Make server socket. */
- memset(&addr, 0, sizeof(struct sockaddr_un));
- addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, path, strlen(path));
-#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
- len = addr.sun_len = SUN_LEN(&addr);
-#else
- len = sizeof(addr.sun_family) + strlen(addr.sun_path);
-#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
-
- ret = connect(sock, (struct sockaddr *)&addr, len);
- if (ret < 0) {
- if (zclient_debug)
- zlog_warn("%s connect failure: %d(%s)",
- __PRETTY_FUNCTION__, errno,
- safe_strerror(errno));
- close(sock);
- return -1;
- }
+ zclient->sock = sock;
return sock;
}
-#endif /* HAVE_TCP_ZEBRA */
-
-/**
- * Connect to zebra daemon.
- * @param zclient a pointer to zclient structure
- * @return socket fd just to make sure that connection established
- * @see zclient_init
- * @see zclient_new
- */
-int zclient_socket_connect(struct zclient *zclient)
-{
-#ifdef HAVE_TCP_ZEBRA
- zclient->sock = zclient_socket();
-#else
- zclient->sock = zclient_socket_un(zclient_serv_path_get());
-#endif
- return zclient->sock;
-}
-
static int zclient_failed(struct zclient *zclient)
{
zclient->fail++;
}
}
-const char *zclient_serv_path_get()
-{
- return zclient_serv_path ? zclient_serv_path : ZEBRA_SERV_PATH;
-}
-
-void zclient_serv_path_set(char *path)
-{
- struct stat sb;
-
- /* reset */
- zclient_serv_path = NULL;
-
- /* test if `path' is socket. don't set it otherwise. */
- if (stat(path, &sb) == -1) {
- zlog_warn("%s: zebra socket `%s' does not exist", __func__,
- path);
- return;
- }
-
- if ((sb.st_mode & S_IFMT) != S_IFSOCK) {
- zlog_warn("%s: `%s' is not unix socket, sir", __func__, path);
- return;
- }
-
- /* it seems that path is unix socket */
- zclient_serv_path = path;
-}
-
void zclient_interface_set_master(struct zclient *client,
struct interface *master,
struct interface *slave)
/* Zebra header size. */
#define ZEBRA_HEADER_SIZE 8
+/* special socket path name to use TCP
+ * @ is used as first character because that's abstract socket names on Linux
+ */
+#define ZAPI_TCP_PATHNAME "@tcp"
+
+extern struct sockaddr_storage zclient_addr;
+extern socklen_t zclient_addr_len;
+
/* Zebra message types. */
typedef enum {
ZEBRA_INTERFACE_ADD,
extern void zclient_free(struct zclient *);
extern int zclient_socket_connect(struct zclient *);
-extern void zclient_serv_path_set(char *path);
-extern const char *zclient_serv_path_get(void);
extern u_short *redist_check_instance(struct redist_proto *, u_short);
extern void redist_add_instance(struct redist_proto *, u_short);
############### FRRouting (FRR) configure options #################
# with-feature options
- %{!?with_tcp_zebra: %global with_tcp_zebra 0 }
%{!?with_pam: %global with_pam 0 }
%{!?with_ospfclient: %global with_ospfclient 1 }
%{!?with_ospfapi: %global with_ospfapi 1 }
#################### FRRouting (FRR) configure options #####################
# with-feature options
-%{!?with_tcp_zebra: %global with_tcp_zebra 0 }
%{!?with_pam: %global with_pam 0 }
%{!?with_ospfclient: %global with_ospfclient 1 }
%{!?with_ospfapi: %global with_ospfapi 1 }
%global with_pimd 0
%endif
-# if FPM is enabled, then enable tcp_zebra as well
-#
-%if %{with_fpm}
- %global with_tcp_zebra 1
-%endif
-
# misc internal defines
%{!?frr_uid: %global frr_uid 92 }
%{!?frr_gid: %global frr_gid 92 }
%endif
%if %{with_multipath}
--enable-multipath=%{with_multipath} \
-%endif
-%if %{with_tcp_zebra}
- --enable-tcp-zebra \
%endif
--enable-vtysh \
%if %{with_ospfclient}
void init_zclient(struct thread_master *master, char *lm_zserv_path)
{
- if (lm_zserv_path)
- zclient_serv_path_set(lm_zserv_path);
+ frr_zclient_addr(&zclient_addr, &zclient_addr_len, lm_zserv_path);
zclient = zclient_new(master);
/* zclient_init(zclient, ZEBRA_LABEL_MANAGER, 0); */
/* Establish connection to zebra. */
zclient = zclient_new(master);
zclient->enable = 1;
-#ifdef HAVE_TCP_ZEBRA
- zclient->sock = zclient_socket();
-#else
- zclient->sock = zclient_socket_un(ZEBRA_SERV_PATH);
-#endif /* HAVE_TCP_ZEBRA */
+ zclient_socket_connect(zclient);
/* Open simulation file. */
fp = fopen(argv[1], "r");
#include "lib/network.h"
#include "lib/stream.h"
#include "lib/zclient.h"
+#include "lib/libfrr.h"
#include "label_manager.h"
static void lm_zclient_init(char *lm_zserv_path)
{
if (lm_zserv_path)
- zclient_serv_path_set(lm_zserv_path);
+ frr_zclient_addr(&zclient_addr, &zclient_addr_len,
+ lm_zserv_path);
/* Set default values. */
zclient = zclient_new(zebrad.master);
char *zserv_path = NULL;
/* Socket to external label manager */
char *lblmgr_path = NULL;
+ struct sockaddr_storage dummy;
+ socklen_t dummylen;
frr_preinit(&zebra_di, argc, argv);
break;
case 'z':
zserv_path = optarg;
+ if (!frr_zclient_addr(&dummy, &dummylen, optarg)) {
+ fprintf(stderr,
+ "Invalid zserv socket path: %s\n",
+ optarg);
+ exit(1);
+ }
break;
case 'l':
lblmgr_path = optarg;
*/
#include <zebra.h>
+#include <sys/un.h>
#include "prefix.h"
#include "command.h"
#include "buffer.h"
#include "nexthop.h"
#include "vrf.h"
+#include "libfrr.h"
#include "zebra/zserv.h"
#include "zebra/zebra_ns.h"
return 0;
}
-#ifdef HAVE_TCP_ZEBRA
-/* Make zebra's server socket. */
-static void zebra_serv()
-{
- int ret;
- int accept_sock;
- struct sockaddr_in addr;
-
- accept_sock = socket(AF_INET, SOCK_STREAM, 0);
-
- if (accept_sock < 0) {
- zlog_warn("Can't create zserv stream socket: %s",
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provice full functionality due to above error");
- return;
- }
-
- memset(&addr, 0, sizeof(struct sockaddr_in));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(ZEBRA_PORT);
-#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
- addr.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- sockopt_reuseaddr(accept_sock);
- sockopt_reuseport(accept_sock);
-
- if (zserv_privs.change(ZPRIVS_RAISE))
- zlog_err("Can't raise privileges");
-
- ret = bind(accept_sock, (struct sockaddr *)&addr,
- sizeof(struct sockaddr_in));
- if (ret < 0) {
- zlog_warn("Can't bind to stream socket: %s",
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provice full functionality due to above error");
- close(accept_sock); /* Avoid sd leak. */
- return;
- }
-
- if (zserv_privs.change(ZPRIVS_LOWER))
- zlog_err("Can't lower privileges");
-
- ret = listen(accept_sock, 1);
- if (ret < 0) {
- zlog_warn("Can't listen to stream socket: %s",
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provice full functionality due to above error");
- close(accept_sock); /* Avoid sd leak. */
- return;
- }
-
- zebra_event(ZEBRA_SERV, accept_sock, NULL);
-}
-#else /* HAVE_TCP_ZEBRA */
-
-/* For sockaddr_un. */
-#include <sys/un.h>
-
-/* zebra server UNIX domain socket. */
-static void zebra_serv_un(const char *path)
+/* Make zebra server socket, wiping any existing one (see bug #403). */
+void zebra_zserv_socket_init(char *path)
{
int ret;
- int sock, len;
- struct sockaddr_un serv;
+ int sock;
mode_t old_mask;
+ struct sockaddr_storage sa;
+ socklen_t sa_len;
- /* First of all, unlink existing socket */
- unlink(path);
+ if (!frr_zclient_addr(&sa, &sa_len, path))
+ /* should be caught in zebra main() */
+ return;
/* Set umask */
old_mask = umask(0077);
/* Make UNIX domain socket. */
- sock = socket(AF_UNIX, SOCK_STREAM, 0);
+ sock = socket(sa.ss_family, SOCK_STREAM, 0);
if (sock < 0) {
- zlog_warn("Can't create zserv unix socket: %s",
+ zlog_warn("Can't create zserv socket: %s",
safe_strerror(errno));
zlog_warn(
"zebra can't provide full functionality due to above error");
return;
}
- /* Make server socket. */
- memset(&serv, 0, sizeof(struct sockaddr_un));
- serv.sun_family = AF_UNIX;
- strncpy(serv.sun_path, path, strlen(path));
-#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
- len = serv.sun_len = SUN_LEN(&serv);
-#else
- len = sizeof(serv.sun_family) + strlen(serv.sun_path);
-#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
-
- ret = bind(sock, (struct sockaddr *)&serv, len);
+ if (sa.ss_family != AF_UNIX) {
+ sockopt_reuseaddr(sock);
+ sockopt_reuseport(sock);
+ } else {
+ struct sockaddr_un *suna = (struct sockaddr_un *)&sa;
+ if (suna->sun_path[0])
+ unlink(suna->sun_path);
+ }
+
+ if (zserv_privs.change(ZPRIVS_RAISE))
+ zlog_err("Can't raise privileges");
+
+ ret = bind(sock, (struct sockaddr *)&sa, sa_len);
if (ret < 0) {
- zlog_warn("Can't bind to unix socket %s: %s", path,
+ zlog_warn("Can't bind zserv socket on %s: %s", path,
safe_strerror(errno));
zlog_warn(
"zebra can't provide full functionality due to above error");
close(sock);
return;
}
+ if (zserv_privs.change(ZPRIVS_LOWER))
+ zlog_err("Can't lower privileges");
ret = listen(sock, 5);
if (ret < 0) {
- zlog_warn("Can't listen to unix socket %s: %s", path,
+ zlog_warn("Can't listen to zserv socket %s: %s", path,
safe_strerror(errno));
zlog_warn(
"zebra can't provide full functionality due to above error");
zebra_event(ZEBRA_SERV, sock, NULL);
}
-#endif /* HAVE_TCP_ZEBRA */
static void zebra_event(enum event event, int sock, struct zserv *client)
/* Route-map */
zebra_route_map_init();
}
-
-/* Make zebra server socket, wiping any existing one (see bug #403). */
-void zebra_zserv_socket_init(char *path)
-{
-#ifdef HAVE_TCP_ZEBRA
- zebra_serv();
-#else
- zebra_serv_un(path ? path : ZEBRA_SERV_PATH);
-#endif /* HAVE_TCP_ZEBRA */
-}