Merge pull request #263 from opensourcerouting/assorted-20170308

assorted bits
This commit is contained in:
Donald Sharp 2017-03-09 06:52:56 -05:00 committed by GitHub
commit 17791cc09a
9 changed files with 16 additions and 70 deletions

View File

@ -89,35 +89,15 @@ struct option longopts[] = {
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct thread_master *master;
/* for reload */
char _cwd[MAXPATHLEN];
char _progpath[MAXPATHLEN];
int _argc;
char **_argv;
char **_envp;
/* /*
* Prototypes. * Prototypes.
*/ */
void reload(void);
void sighup(void); void sighup(void);
void sigint(void); void sigint(void);
void sigterm(void); void sigterm(void);
void sigusr1(void); void sigusr1(void);
void
reload ()
{
zlog_debug ("Reload");
/* FIXME: Clean up func call here */
vty_reset ();
(void) isisd_privs.change (ZPRIVS_RAISE);
execve (_progpath, _argv, _envp);
zlog_err ("Reload failed: cannot exec %s: %s", _progpath,
safe_strerror (errno));
}
static __attribute__((__noreturn__)) void static __attribute__((__noreturn__)) void
terminate (int i) terminate (int i)
{ {
@ -131,9 +111,7 @@ terminate (int i)
void void
sighup (void) sighup (void)
{ {
zlog_debug ("SIGHUP received"); zlog_err ("SIGHUP/reload is not implemented for isisd");
reload ();
return; return;
} }
@ -199,21 +177,6 @@ main (int argc, char **argv, char **envp)
{ {
int opt; int opt;
/* for reload */
_argc = argc;
_argv = argv;
_envp = envp;
if (getcwd (_cwd, sizeof (_cwd)) == NULL)
{
zlog_err ("ISISd: Unable to determine CWD: %d", errno);
exit (1);
}
if (*argv[0] == '.')
snprintf (_progpath, sizeof (_progpath), "%s/%s", _cwd, _argv[0]);
else
snprintf (_progpath, sizeof (_progpath), "%s", argv[0]);
frr_preinit (&isisd_di, argc, argv); frr_preinit (&isisd_di, argc, argv);
frr_opt_add ("", longopts, ""); frr_opt_add ("", longopts, "");

View File

@ -153,8 +153,6 @@ struct timestamp_control {
char buf[QUAGGA_TIMESTAMP_LEN]; /* will contain the rendered timestamp */ char buf[QUAGGA_TIMESTAMP_LEN]; /* will contain the rendered timestamp */
}; };
#define LOG_DEFAULT_FILENAME "/var/log/quagga/Quagga.log"
/* Defines for use in command construction: */ /* Defines for use in command construction: */
#define LOG_LEVEL_DESC \ #define LOG_LEVEL_DESC \

View File

@ -93,21 +93,6 @@ struct thread_master *master;
extern int ospf_apiserver_enable; extern int ospf_apiserver_enable;
#endif /* SUPPORT_OSPF_API */ #endif /* SUPPORT_OSPF_API */
/* Help information display. */
static void __attribute__ ((noreturn))
usage (char *progname, int status)
{
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n", progname);
else
{
printf ("Usage : %s [OPTION...]\n\
\n\
Report bugs to %s\n", progname, FRR_BUG_ADDRESS);
}
exit (status);
}
/* SIGHUP handler. */ /* SIGHUP handler. */
static void static void
sighup (void) sighup (void)

View File

@ -113,9 +113,6 @@ int main(int argc, char** argv, char** envp) {
master = frr_init(); master = frr_init();
zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting",
FRR_VERSION, PIMD_VERSION);
/* /*
* Initializations * Initializations
*/ */

View File

@ -174,7 +174,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp,
/* Set router alert (RFC 2113) for all IGMP messages (RFC 3376 4. Message Formats)*/ /* Set router alert (RFC 2113) for all IGMP messages (RFC 3376 4. Message Formats)*/
if (protocol == IPPROTO_IGMP) { if (protocol == IPPROTO_IGMP) {
char ra[4]; uint8_t ra[4];
ra[0] = 148; ra[0] = 148;
ra[1] = 4; ra[1] = 4;
ra[2] = 0; ra[2] = 0;

View File

@ -174,6 +174,9 @@ struct daemon {
struct restart_info restart; struct restart_info restart;
}; };
#define OPTION_MINRESTART 2000
#define OPTION_MAXRESTART 2001
static const struct option longopts[] = { static const struct option longopts[] = {
{"daemon", no_argument, NULL, 'd'}, {"daemon", no_argument, NULL, 'd'},
{"statedir", required_argument, NULL, 'S'}, {"statedir", required_argument, NULL, 'S'},
@ -189,8 +192,8 @@ static const struct option longopts[] = {
{"all-restart", no_argument, NULL, 'a'}, {"all-restart", no_argument, NULL, 'a'},
{"always-all-restart", no_argument, NULL, 'A'}, {"always-all-restart", no_argument, NULL, 'A'},
{"unresponsive-restart", no_argument, NULL, 'z'}, {"unresponsive-restart", no_argument, NULL, 'z'},
{"min-restart-interval", required_argument, NULL, 'm'}, {"min-restart-interval", required_argument, NULL, OPTION_MINRESTART },
{"max-restart-interval", required_argument, NULL, 'M'}, {"max-restart-interval", required_argument, NULL, OPTION_MAXRESTART },
{"pid-file", required_argument, NULL, 'p'}, {"pid-file", required_argument, NULL, 'p'},
{"blank-string", required_argument, NULL, 'b'}, {"blank-string", required_argument, NULL, 'b'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
@ -263,10 +266,10 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n", progname,
The value should range from %d (LOG_EMERG) to %d (LOG_DEBUG),\n\ The value should range from %d (LOG_EMERG) to %d (LOG_DEBUG),\n\
but it can be set higher than %d if extra-verbose debugging\n\ but it can be set higher than %d if extra-verbose debugging\n\
messages are desired.\n\ messages are desired.\n\
-m, --min-restart-interval\n\ --min-restart-interval\n\
Set the minimum seconds to wait between invocations of daemon\n\ Set the minimum seconds to wait between invocations of daemon\n\
restart commands (default is %d).\n\ restart commands (default is %d).\n\
-M, --max-restart-interval\n\ --max-restart-interval\n\
Set the maximum seconds to wait between invocations of daemon\n\ Set the maximum seconds to wait between invocations of daemon\n\
restart commands (default is %d).\n\ restart commands (default is %d).\n\
-i, --interval Set the status polling interval in seconds (default is %d)\n\ -i, --interval Set the status polling interval in seconds (default is %d)\n\
@ -1044,7 +1047,7 @@ int main(int argc, char **argv)
frr_preinit(&watchfrr_di, argc, argv); frr_preinit(&watchfrr_di, argc, argv);
progname = watchfrr_di.progname; progname = watchfrr_di.progname;
frr_opt_add("aAb:dek:l:m:M:i:p:r:R:S:s:t:T:z", longopts, ""); frr_opt_add("aAb:dek:l:i:p:r:R:S:s:t:T:z", longopts, "");
gs.restart.name = "all"; gs.restart.name = "all";
while ((opt = frr_getopt(argc, argv, NULL)) != EOF) { while ((opt = frr_getopt(argc, argv, NULL)) != EOF) {
@ -1098,7 +1101,7 @@ int main(int argc, char **argv)
} }
} }
break; break;
case 'm': case OPTION_MINRESTART:
{ {
char garbage[3]; char garbage[3];
if ((sscanf(optarg, "%ld%1s", if ((sscanf(optarg, "%ld%1s",
@ -1112,7 +1115,7 @@ int main(int argc, char **argv)
} }
} }
break; break;
case 'M': case OPTION_MAXRESTART:
{ {
char garbage[3]; char garbage[3];
if ((sscanf(optarg, "%ld%1s", if ((sscanf(optarg, "%ld%1s",

View File

@ -229,7 +229,7 @@ main (int argc, char **argv)
#endif #endif
, longopts, , longopts,
" -b, --batch Runs in batch mode\n" " -b, --batch Runs in batch mode\n"
" -a, --allow_delete Allow other processes to delete Quagga Routes\n" " -a, --allow_delete Allow other processes to delete zebra routes\n"
" -F, --fpm_format Set fpm format to 'netlink' or 'protobuf'\n" " -F, --fpm_format Set fpm format to 'netlink' or 'protobuf'\n"
" -z, --socket Set path of zebra socket\n" " -z, --socket Set path of zebra socket\n"
" -e, --ecmp Specify ECMP to use.\n" " -e, --ecmp Specify ECMP to use.\n"

View File

@ -100,7 +100,7 @@ usage (char *progname, int status)
"redistribution between different routing protocols.\n\n"\ "redistribution between different routing protocols.\n\n"\
"-b, --batch Runs in batch mode\n"\ "-b, --batch Runs in batch mode\n"\
"-d, --daemon Runs in daemon mode\n"\ "-d, --daemon Runs in daemon mode\n"\
"-a, --allow_delete Allow other processes to delete Quagga Routes\n" \ "-a, --allow_delete Allow other processes to delete zebra routes\n" \
"-f, --config_file Set configuration file name\n"\ "-f, --config_file Set configuration file name\n"\
"-A, --vty_addr Set vty's bind address\n"\ "-A, --vty_addr Set vty's bind address\n"\
"-P, --vty_port Set vty's port number\n"\ "-P, --vty_port Set vty's port number\n"\

View File

@ -3825,7 +3825,7 @@ static_config_ipv6 (struct vty *vty)
DEFUN (allow_external_route_update, DEFUN (allow_external_route_update,
allow_external_route_update_cmd, allow_external_route_update_cmd,
"allow-external-route-update", "allow-external-route-update",
"Allow Quagga routes to be overwritten by external processes") "Allow FRR routes to be overwritten by external processes")
{ {
allow_delete = 1; allow_delete = 1;
@ -3835,7 +3835,7 @@ DEFUN (allow_external_route_update,
DEFUN (no_allow_external_route_update, DEFUN (no_allow_external_route_update,
no_allow_external_route_update_cmd, no_allow_external_route_update_cmd,
"no allow-external-route-update", "no allow-external-route-update",
"Allow Quagga routes to be overwritten by external processes") "Allow FRR routes to be overwritten by external processes")
{ {
allow_delete = 0; allow_delete = 0;