RAdv: Configure how long a dead prefix is advertised

This commit is contained in:
Michal 'vorner' Vaner 2017-08-17 11:34:25 +02:00 committed by Ondrej Zajicek (work)
parent e2d2b3ef21
commit ec7d6a506e
4 changed files with 16 additions and 4 deletions

View file

@ -3436,6 +3436,12 @@ dsc-iface
as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">. as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes. Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes.
<tag><label id="radv-iface-linger-time">linger time <m/expr/</tag>
When a prefix disappears, it is advertised for some time with 0 lifetime,
to inform clients the prefix is no longer usable. This sets the time for
how long it is advertised (in seconds). Maximum is 3600, 0 means
disable. Default 300.
<tag><label id="radv-iface-default-preference-low">default preference low|medium|high</tag> <tag><label id="radv-iface-default-preference-low">default preference low|medium|high</tag>
This option specifies the Default Router Preference value to advertise This option specifies the Default Router Preference value to advertise
to hosts. Default: medium. to hosts. Default: medium.

View file

@ -27,7 +27,7 @@ static u8 radv_mult_val; /* Used by radv_mult for second return value */
CF_DECLS CF_DECLS
CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL, CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL,
MANAGED, OTHER, CONFIG, LINK, MTU, REACHABLE, TIME, RETRANS, MANAGED, OTHER, CONFIG, LINGER, LINK, MTU, REACHABLE, TIME, RETRANS,
TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN,
LOCAL, TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH) LOCAL, TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH)
@ -82,6 +82,7 @@ radv_iface_start:
RADV_IFACE->max_ra_int = DEFAULT_MAX_RA_INT; RADV_IFACE->max_ra_int = DEFAULT_MAX_RA_INT;
RADV_IFACE->min_delay = DEFAULT_MIN_DELAY; RADV_IFACE->min_delay = DEFAULT_MIN_DELAY;
RADV_IFACE->current_hop_limit = DEFAULT_CURRENT_HOP_LIMIT; RADV_IFACE->current_hop_limit = DEFAULT_CURRENT_HOP_LIMIT;
RADV_IFACE->linger_time = DEFAULT_LINGER_TIME;
RADV_IFACE->default_lifetime = -1; RADV_IFACE->default_lifetime = -1;
RADV_IFACE->default_lifetime_sensitive = 1; RADV_IFACE->default_lifetime_sensitive = 1;
RADV_IFACE->default_preference = RA_PREF_MEDIUM; RADV_IFACE->default_preference = RA_PREF_MEDIUM;
@ -96,6 +97,7 @@ radv_iface_item:
| LINK MTU expr { RADV_IFACE->link_mtu = $3; if ($3 < 0) cf_error("Link MTU must be 0 or positive"); } | LINK MTU expr { RADV_IFACE->link_mtu = $3; if ($3 < 0) cf_error("Link MTU must be 0 or positive"); }
| REACHABLE TIME expr { RADV_IFACE->reachable_time = $3; if (($3 < 0) || ($3 > 3600000)) cf_error("Reachable time must be in range 0-3600000"); } | REACHABLE TIME expr { RADV_IFACE->reachable_time = $3; if (($3 < 0) || ($3 > 3600000)) cf_error("Reachable time must be in range 0-3600000"); }
| RETRANS TIMER expr { RADV_IFACE->retrans_timer = $3; if ($3 < 0) cf_error("Retrans timer must be 0 or positive"); } | RETRANS TIMER expr { RADV_IFACE->retrans_timer = $3; if ($3 < 0) cf_error("Retrans timer must be 0 or positive"); }
| LINGER TIME expr { RADV_IFACE->linger_time = $3; if (($3 < 0) || ($3 > 3600)) cf_error("Linger time must be in range 0-3600"); }
| CURRENT HOP LIMIT expr { RADV_IFACE->current_hop_limit = $4; if (($4 < 0) || ($4 > 255)) cf_error("Current hop limit must be in range 0-255"); } | CURRENT HOP LIMIT expr { RADV_IFACE->current_hop_limit = $4; if (($4 < 0) || ($4 > 255)) cf_error("Current hop limit must be in range 0-255"); }
| DEFAULT LIFETIME expr radv_sensitive { | DEFAULT LIFETIME expr radv_sensitive {
RADV_IFACE->default_lifetime = $3; RADV_IFACE->default_lifetime = $3;

View file

@ -115,6 +115,7 @@ static void
prefixes_prepare(struct radv_iface *ifa) prefixes_prepare(struct radv_iface *ifa)
{ {
struct radv_proto *p = ifa->ra; struct radv_proto *p = ifa->ra;
struct radv_iface_config *cf = ifa->cf;
/* First mark all the prefixes as unused */ /* First mark all the prefixes as unused */
struct radv_prefix *pfx; struct radv_prefix *pfx;
@ -164,8 +165,7 @@ prefixes_prepare(struct radv_iface *ifa)
* dropped just yet). If something is dead and rots there for long enough, * dropped just yet). If something is dead and rots there for long enough,
* clean it up. * clean it up.
*/ */
// XXX: Make these 5 minutes it configurable bird_clock_t rotten = now + cf->linger_time;
bird_clock_t rotten = now + 300;
struct radv_prefix *next; struct radv_prefix *next;
bird_clock_t expires_soonest = 0; bird_clock_t expires_soonest = 0;
WALK_LIST_DELSAFE(pfx, next, ifa->prefixes) { WALK_LIST_DELSAFE(pfx, next, ifa->prefixes) {

View file

@ -35,6 +35,7 @@
#define DEFAULT_MAX_RA_INT 600 #define DEFAULT_MAX_RA_INT 600
#define DEFAULT_MIN_DELAY 3 #define DEFAULT_MIN_DELAY 3
#define DEFAULT_CURRENT_HOP_LIMIT 64 #define DEFAULT_CURRENT_HOP_LIMIT 64
#define DEFAULT_LINGER_TIME 300
#define DEFAULT_VALID_LIFETIME 86400 #define DEFAULT_VALID_LIFETIME 86400
#define DEFAULT_PREFERRED_LIFETIME 14400 #define DEFAULT_PREFERRED_LIFETIME 14400
@ -66,6 +67,9 @@ struct radv_iface_config
u32 max_ra_int; u32 max_ra_int;
u32 min_delay; u32 min_delay;
u32 linger_time; /* How long a dead prefix should still be advertised with 0
lifetime */
u8 rdnss_local; /* Global list is not used for RDNSS */ u8 rdnss_local; /* Global list is not used for RDNSS */
u8 dnssl_local; /* Global list is not used for DNSSL */ u8 dnssl_local; /* Global list is not used for DNSSL */