@@ -74,8 +74,7 @@ int retain_mode = 0;
74
74
/* Allow non-quagga entities to delete quagga routes */
75
75
int allow_delete = 0 ;
76
76
77
- /* Don't delete kernel route. */
78
- int keep_kernel_mode = 0 ;
77
+ int graceful_restart ;
79
78
80
79
bool v6_rr_semantics = false;
81
80
@@ -95,6 +94,7 @@ struct option longopts[] = {
95
94
{"label_socket" , no_argument , NULL , 'l' },
96
95
{"retain" , no_argument , NULL , 'r' },
97
96
{"vrfdefaultname" , required_argument , NULL , 'o' },
97
+ {"graceful_restart" , required_argument , NULL , 'K' },
98
98
#ifdef HAVE_NETLINK
99
99
{"vrfwnetns" , no_argument , NULL , 'n' },
100
100
{"nl-bufsize" , required_argument , NULL , 's' },
@@ -262,13 +262,14 @@ int main(int argc, char **argv)
262
262
char * netlink_fuzzing = NULL ;
263
263
#endif /* HANDLE_NETLINK_FUZZING */
264
264
265
+ graceful_restart = 0 ;
265
266
vrf_configure_backend (VRF_BACKEND_VRF_LITE );
266
267
logicalrouter_configure_backend (LOGICALROUTER_BACKEND_NETNS );
267
268
268
269
frr_preinit (& zebra_di , argc , argv );
269
270
270
271
frr_opt_add (
271
- "bakz :e:l:o:r "
272
+ "baz :e:l:o:rK: "
272
273
#ifdef HAVE_NETLINK
273
274
"s:n"
274
275
#endif
@@ -280,24 +281,24 @@ int main(int argc, char **argv)
280
281
#endif /* HANDLE_NETLINK_FUZZING */
281
282
,
282
283
longopts ,
283
- " -b, --batch Runs in batch mode\n"
284
- " -a, --allow_delete Allow other processes to delete zebra routes\n"
285
- " -z, --socket Set path of zebra socket\n"
286
- " -e, --ecmp Specify ECMP to use.\n"
287
- " -l, --label_socket Socket to external label manager\n"
288
- " -k , --keep_kernel Don't delete old routes which were installed by zebra.\n"
289
- " -r , --retain When program terminates, retain added route by zebra .\n"
290
- " -o , --vrfdefaultname Set default VRF name. \n"
284
+ " -b, --batch Runs in batch mode\n"
285
+ " -a, --allow_delete Allow other processes to delete zebra routes\n"
286
+ " -z, --socket Set path of zebra socket\n"
287
+ " -e, --ecmp Specify ECMP to use.\n"
288
+ " -l, --label_socket Socket to external label manager\n"
289
+ " -r , --retain When program terminates, retain added route by zebra.\n"
290
+ " -o , --vrfdefaultname Set default VRF name .\n"
291
+ " -K , --graceful_restart Graceful restart at the kernel level, timer in seconds for expiration \n"
291
292
#ifdef HAVE_NETLINK
292
- " -n, --vrfwnetns Use NetNS as VRF backend\n"
293
- " -s, --nl-bufsize Set netlink receive buffer size\n"
294
- " --v6-rr-semantics Use v6 RR semantics\n"
293
+ " -n, --vrfwnetns Use NetNS as VRF backend\n"
294
+ " -s, --nl-bufsize Set netlink receive buffer size\n"
295
+ " --v6-rr-semantics Use v6 RR semantics\n"
295
296
#endif /* HAVE_NETLINK */
296
297
#if defined(HANDLE_ZAPI_FUZZING )
297
- " -c <file> Bypass normal startup and use this file for testing of zapi\n"
298
+ " -c <file> Bypass normal startup and use this file for testing of zapi\n"
298
299
#endif /* HANDLE_ZAPI_FUZZING */
299
300
#if defined(HANDLE_NETLINK_FUZZING )
300
- " -w <file> Bypass normal startup and use this file for testing of netlink input\n"
301
+ " -w <file> Bypass normal startup and use this file for testing of netlink input\n"
301
302
#endif /* HANDLE_NETLINK_FUZZING */
302
303
);
303
304
@@ -316,9 +317,6 @@ int main(int argc, char **argv)
316
317
case 'a' :
317
318
allow_delete = 1 ;
318
319
break ;
319
- case 'k' :
320
- keep_kernel_mode = 1 ;
321
- break ;
322
320
case 'e' :
323
321
zrouter .multipath_num = atoi (optarg );
324
322
if (zrouter .multipath_num > MULTIPATH_NUM
@@ -348,6 +346,9 @@ int main(int argc, char **argv)
348
346
case 'r' :
349
347
retain_mode = 1 ;
350
348
break ;
349
+ case 'K' :
350
+ graceful_restart = atoi (optarg );
351
+ break ;
351
352
#ifdef HAVE_NETLINK
352
353
case 's' :
353
354
nl_rcvbufsize = atoi (optarg );
@@ -435,8 +436,9 @@ int main(int argc, char **argv)
435
436
* will be equal to the current getpid(). To know about such routes,
436
437
* we have to have route_read() called before.
437
438
*/
438
- if (!keep_kernel_mode )
439
- rib_sweep_route ();
439
+ zrouter .startup_time = monotime (NULL );
440
+ thread_add_timer (zrouter .master , rib_sweep_route ,
441
+ NULL , graceful_restart , NULL );
440
442
441
443
/* Needed for BSD routing socket. */
442
444
pid = getpid ();
0 commit comments