Skip to content

Commit

Permalink
Add Option RemoveAdvOnExit
Browse files Browse the repository at this point in the history
Make it configureable if upon shutdown, a final advertisement with zero Router Lifetime is sent . This may need to be disabled ("off") in an vrrp or carp setup.
  • Loading branch information
Manon Goo committed Feb 15, 2022
1 parent bc34bf7 commit 3f1aeb2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions defaults.h
Expand Up @@ -49,6 +49,7 @@
#define DFLT_UnicastOnly 0
#define DFLT_UnrestrictedUnicast 0
#define DFLT_AdvRASolicitedUnicast 1
#define DFLT_RemoveAdvOnExit 1

/* Options sent with RA */

Expand Down
5 changes: 5 additions & 0 deletions gram.y
Expand Up @@ -77,6 +77,7 @@
%token T_AdvDefaultLifetime
%token T_AdvDefaultPreference
%token T_AdvSourceLLAddress
%token T_RemoveAdvOnExit

%token T_AdvOnLink
%token T_AdvAutonomous
Expand Down Expand Up @@ -308,6 +309,10 @@ ifaceval : T_MinRtrAdvInterval NUMBER ';'
{
iface->ra_header_info.AdvCurHopLimit = $2;
}
| T_RemoveAdvOnExit SWITCH ';'
{
iface->RemoveAdvOnExit = $2;
}
| T_AdvSourceLLAddress SWITCH ';'
{
iface->AdvSourceLLAddress = $2;
Expand Down
1 change: 1 addition & 0 deletions interface.c
Expand Up @@ -29,6 +29,7 @@ void iface_init_defaults(struct Interface *iface)
iface->AdvSendAdvert = DFLT_AdvSendAdv;
iface->MaxRtrAdvInterval = DFLT_MaxRtrAdvInterval;
iface->AdvSourceLLAddress = DFLT_AdvSourceLLAddress;
iface->RemoveAdvOnExit = DFLT_RemoveAdvOnExit;
iface->MinDelayBetweenRAs = DFLT_MinDelayBetweenRAs;
iface->MinRtrAdvInterval = -1;
iface->UnicastOnly = DFLT_UnicastOnly;
Expand Down
2 changes: 1 addition & 1 deletion radvd.c
Expand Up @@ -741,7 +741,7 @@ static void kickoff_adverts(int sock, struct Interface *iface)

static void stop_advert_foo(struct Interface *iface, void *data)
{
if (!iface->UnicastOnly) {
if (!iface->UnicastOnly && iface->RemoveAdvOnExit) {
/* send a final advertisement with zero Router Lifetime */
dlog(LOG_DEBUG, 4, "stopping all adverts on %s", iface->props.name);
iface->state_info.cease_adv = 1;
Expand Down
7 changes: 7 additions & 0 deletions radvd.conf.5.man
Expand Up @@ -338,6 +338,13 @@ included in the RA.

Default: on

.TP
.BR RemoveAdvOnExit " " on | off

Upon shutdown, send a final advertisement with zero Router Lifetime. This should cause the router and routes to be immediately removed from the receiving end-nodes' route table. This may need to be disabled ("off") in an vrrp or carp setup.

Default: on

.TP
.BR AdvHomeAgentFlag " " on | off

Expand Down
1 change: 1 addition & 0 deletions radvd.h
Expand Up @@ -58,6 +58,7 @@ struct Interface {
double MinRtrAdvInterval;
double MinDelayBetweenRAs;
int AdvSourceLLAddress;
int RemoveAdvOnExit;
int UnicastOnly;
int UnrestrictedUnicast;
int AdvRASolicitedUnicast;
Expand Down
1 change: 1 addition & 0 deletions scanner.l
Expand Up @@ -67,6 +67,7 @@ AdvCurHopLimit { return T_AdvCurHopLimit; }
AdvDefaultLifetime { return T_AdvDefaultLifetime; }
AdvDefaultPreference { return T_AdvDefaultPreference; }
AdvSourceLLAddress { return T_AdvSourceLLAddress; }
RemoveAdvOnExit { return T_RemoveAdvOnExit; }
AdvOnLink { return T_AdvOnLink; }
AdvAutonomous { return T_AdvAutonomous; }
Expand Down

0 comments on commit 3f1aeb2

Please sign in to comment.