diff options
Diffstat (limited to 'ripngd')
-rw-r--r-- | ripngd/Makefile.am | 1 | ||||
-rw-r--r-- | ripngd/ripng_interface.c | 31 | ||||
-rw-r--r-- | ripngd/ripng_main.c | 22 | ||||
-rw-r--r-- | ripngd/ripngd.c | 5 | ||||
-rw-r--r-- | ripngd/ripngd.h | 4 |
5 files changed, 33 insertions, 30 deletions
diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am index c6bd4868..ba52dba7 100644 --- a/ripngd/Makefile.am +++ b/ripngd/Makefile.am @@ -1,7 +1,6 @@ ## Process this file with automake to produce Makefile.in. INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@ -DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" INSTALL_SDATA=@INSTALL@ -m 600 AM_CFLAGS = $(PICFLAGS) diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index c23d32a2..6718fff2 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -157,22 +157,6 @@ ripng_if_ipv6_lladdress_check (struct interface *ifp) return count; } -/* Check max mtu size. */ -static unsigned int -ripng_check_max_mtu (void) -{ - struct listnode *node; - struct interface *ifp; - unsigned int mtu; - - mtu = 0; - for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) - if (mtu < ifp->mtu6) - mtu = ifp->mtu6; - - return mtu; -} - static int ripng_if_down (struct interface *ifp) { @@ -277,8 +261,9 @@ ripng_interface_down (int command, struct zclient *zclient, ripng_if_down (ifp); if (IS_RIPNG_DEBUG_ZEBRA) - zlog_debug ("interface down %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_debug ("interface down %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, + (unsigned long long) ifp->flags, ifp->metric, ifp->mtu6); return 0; } @@ -292,8 +277,9 @@ ripng_interface_add (int command, struct zclient *zclient, zebra_size_t length) ifp = zebra_interface_add_read (zclient->ibuf); if (IS_RIPNG_DEBUG_ZEBRA) - zlog_debug ("RIPng interface add %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu6); /* Check is this interface is RIP enabled or not.*/ ripng_enable_apply (ifp); @@ -325,8 +311,9 @@ ripng_interface_delete (int command, struct zclient *zclient, ripng_if_down(ifp); } - zlog_info("interface delete %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu6); /* To support pseudo interface do not free interface structure. */ /* if_delete(ifp); */ diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 85209a15..62477b6f 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -34,17 +34,19 @@ #include "if.h" #include "privs.h" #include "sigevent.h" +#include "paths.h" #include "ripngd/ripngd.h" /* Configuration filename and directory. */ -char config_default[] = SYSCONFDIR RIPNG_DEFAULT_CONFIG; +char config_default[MAXPATHLEN]; char *config_file = NULL; /* RIPngd options. */ struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, + { "namespace", required_argument, NULL, 'N'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "dryrun", no_argument, NULL, 'C'}, @@ -96,8 +98,11 @@ int vty_port = RIPNG_VTY_PORT; /* Master of threads. */ struct thread_master *master; +/* pid_file default value */ +static char pid_file_default[MAXPATHLEN]; + /* Process ID saved for use by init system */ -const char *pid_file = PATH_RIPNGD_PID; +const char *pid_file = pid_file_default; /* Help information display. */ static void @@ -110,6 +115,7 @@ usage (char *progname, int status) printf ("Usage : %s [OPTION...]\n\ Daemon which manages RIPng.\n\n\ -d, --daemon Runs in daemon mode\n\ +-N, --namespace Insert argument into all paths\n\ -f, --config_file Set configuration file name\n\ -i, --pid_file Set process identifier file name\n\ -A, --vty_addr Set vty's bind address\n\ @@ -137,7 +143,7 @@ sighup (void) /* Reload config file. */ vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, path_state (RIPNG_VTY_NAME)); /* Try to return to normal operation. */ } @@ -205,7 +211,7 @@ main (int argc, char **argv) { int opt; - opt = getopt_long (argc, argv, "df:i:hA:P:u:g:vC", longopts, 0); + opt = getopt_long (argc, argv, "dN:f:i:hA:P:u:g:vC", longopts, 0); if (opt == EOF) break; @@ -217,6 +223,9 @@ main (int argc, char **argv) case 'd': daemon_mode = 1; break; + case 'N': + path_set_namespace (optarg); + break; case 'f': config_file = optarg; break; @@ -263,6 +272,9 @@ main (int argc, char **argv) } } + strcpy (config_default, path_config (RIPNG_CONFIG_NAME)); + strcpy (pid_file_default, path_state (RIPNG_PID_NAME)); + master = thread_master_create (); /* Library inits. */ @@ -295,7 +307,7 @@ main (int argc, char **argv) } /* Create VTY socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, path_state (RIPNG_VTY_NAME)); /* Process id file create. */ pid_output (pid_file); diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 9deac032..6e32d83c 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -272,7 +272,10 @@ ripng_recv_packet (int sock, u_char *buf, int bufsize, /* Incoming packet's multicast hop limit. */ if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT) - *hoplimit = *((int *) CMSG_DATA (cmsgptr)); + { + int *phoplimit = (int *) CMSG_DATA (cmsgptr); + *hoplimit = *phoplimit; + } } /* Hoplimit check shold be done when destination address is diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index ab06d81b..71615c3c 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -51,7 +51,9 @@ #define RIPNG_PEER_TIMER_DEFAULT 180 /* Default config file name. */ -#define RIPNG_DEFAULT_CONFIG "ripngd.conf" +#define RIPNG_CONFIG_NAME "ripngd.conf" +#define RIPNG_PID_NAME "ripngd.pid" +#define RIPNG_VTY_NAME "ripngd.vty" /* RIPng route types. */ #define RIPNG_ROUTE_RTE 0 |