@@ -102,37 +102,41 @@ static void opt_extend(const struct optspec *os)
102102#define OPTION_SCRIPTDIR 1009
103103
104104static const struct option lo_always [] = {
105- {"help" , no_argument , NULL , 'h' },
106- {"version" , no_argument , NULL , 'v' },
107- {"daemon" , no_argument , NULL , 'd' },
108- {"module" , no_argument , NULL , 'M' },
109- {"profile" , required_argument , NULL , 'F' },
110- {"pathspace" , required_argument , NULL , 'N' },
111- {"vrfdefaultname" , required_argument , NULL , 'o' },
112- {"vty_socket" , required_argument , NULL , OPTION_VTYSOCK },
113- {"moduledir" , required_argument , NULL , OPTION_MODULEDIR },
114- {"scriptdir" , required_argument , NULL , OPTION_SCRIPTDIR },
115- {"log" , required_argument , NULL , OPTION_LOG },
116- {"log-level" , required_argument , NULL , OPTION_LOGLEVEL },
117- {"command-log-always" , no_argument , NULL , OPTION_LOGGING },
118- {"limit-fds" , required_argument , NULL , OPTION_LIMIT_FDS },
119- {NULL }};
105+ { "help" , no_argument , NULL , 'h' },
106+ { "version" , no_argument , NULL , 'v' },
107+ { "daemon" , no_argument , NULL , 'd' },
108+ { "module" , no_argument , NULL , 'M' },
109+ { "profile" , required_argument , NULL , 'F' },
110+ { "pathspace" , required_argument , NULL , 'N' },
111+ { "vrfdefaultname" , required_argument , NULL , 'o' },
112+ { "graceful_restart" , optional_argument , NULL , 'K' },
113+ { "vty_socket" , required_argument , NULL , OPTION_VTYSOCK },
114+ { "moduledir" , required_argument , NULL , OPTION_MODULEDIR },
115+ { "scriptdir" , required_argument , NULL , OPTION_SCRIPTDIR },
116+ { "log" , required_argument , NULL , OPTION_LOG },
117+ { "log-level" , required_argument , NULL , OPTION_LOGLEVEL },
118+ { "command-log-always" , no_argument , NULL , OPTION_LOGGING },
119+ { "limit-fds" , required_argument , NULL , OPTION_LIMIT_FDS },
120+ { NULL }
121+ };
120122static const struct optspec os_always = {
121- "hvdM:F:N:o:" ,
123+ "hvdM:F:N:o:K:: " ,
122124 " -h, --help Display this help and exit\n"
123125 " -v, --version Print program version\n"
124126 " -d, --daemon Runs in daemon mode\n"
125127 " -M, --module Load specified module\n"
126128 " -F, --profile Use specified configuration profile\n"
127129 " -N, --pathspace Insert prefix into config & socket paths\n"
128130 " -o, --vrfdefaultname Set default VRF name.\n"
131+ " -K, --graceful_restart FRR starting in Graceful Restart mode, with optional route-cleanup timer\n"
129132 " --vty_socket Override vty socket path\n"
130133 " --moduledir Override modules directory\n"
131134 " --scriptdir Override scripts directory\n"
132135 " --log Set Logging to stdout, syslog, or file:<name>\n"
133136 " --log-level Set Logging Level to use, debug, info, warn, etc\n"
134137 " --limit-fds Limit number of fds supported\n" ,
135- lo_always };
138+ lo_always
139+ };
136140
137141static bool logging_to_stdout = false; /* set when --log stdout specified */
138142
@@ -358,6 +362,8 @@ void frr_preinit(struct frr_daemon_info *daemon, int argc, char **argv)
358362 strlcpy (frr_protonameinst , di -> logname , sizeof (frr_protonameinst ));
359363
360364 di -> cli_mode = FRR_CLI_CLASSIC ;
365+ di -> graceful_restart = false;
366+ di -> gr_cleanup_time = 0 ;
361367
362368 /* we may be starting with extra FDs open for whatever purpose,
363369 * e.g. logging, some module, etc. Recording them here allows later
@@ -520,6 +526,11 @@ static int frr_opt(int opt)
520526 di -> db_file = optarg ;
521527 break ;
522528#endif
529+ case 'K' :
530+ di -> graceful_restart = true;
531+ if (optarg )
532+ di -> gr_cleanup_time = atoi (optarg );
533+ break ;
523534 case 'C' :
524535 if (di -> flags & FRR_NO_SPLIT_CONFIG )
525536 return 1 ;
0 commit comments