Commit 830ba75e authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Merge commit '1e8721e2' into int-new

parents 46434a3c 1e8721e2
Loading
Loading
Loading
Loading
+84 −12
Original line number Diff line number Diff line
@@ -1941,7 +1941,7 @@ protocol bfd [<name>] {
	computation.

	<tag>password "<M>text</M>"</tag>
	Specifies a password used for authentication. See <ref id="dsc-pass"
	Specifies a password used for authentication. See <ref id="proto-pass"
	name="password"> common option for detailed description. Note that
	password option <cf/algorithm/ is not available in BFD protocol. The
	algorithm is selected by <cf/authentication/ option for all passwords.
@@ -3560,7 +3560,8 @@ time intervals or as an answer to a request) advertisement packets to connected
networks. These packets contain basic information about a local network (e.g. a
list of network prefixes), which allows network hosts to autoconfigure network
addresses and choose a default route. BIRD implements router behavior as defined
in <rfc id="4861"> and also the DNS extensions from <rfc id="6106">.
in <rfc id="4861">, router preferences and specific routes (<rfc id="4191">),
and DNS extensions (<rfc id="6106">).

<sect1>Configuration
<label id="radv-config">
@@ -3597,7 +3598,7 @@ definitions, prefix definitions and DNS definitions:
	definitions may also be interface-specific when used inside interface
	options. By default, interface uses both global and interface-specific
	options, but that can be changed by <cf/rdnss local/ option.
dsc-iface

	<tag><label id="radv-dnssl">dnssl { <m/options/ }</tag>
	DNSSL definitions allow to specify a list of advertised DNS search
	domains together with their options. Like <cf/rdnss/ above, multiple
@@ -3622,6 +3623,18 @@ dsc-iface
	default router. <cf/preferred lifetime/ and <cf/valid lifetime/ could
	also be configured as <cf/sensitive/ for a prefix, which would cause
	autoconfigured IPs to be deprecated or even removed.

	<tag><label id="radv-propagate-routes">propagate routes <m/switch/</tag>
	This option controls propagation of more specific routes, as defined in
	<rfc id="4191">. If enabled, all routes exported to the RAdv protocol,
	with the exception of the trigger prefix, are added to advertisments as
	additional options. The lifetime and preference of advertised routes can
	be set individually by <cf/ra_lifetime/ and <cf/ra_preference/ route
	attributes, or per interface by <cf/route lifetime/ and
	<cf/route preference/ options. Default: disabled.

	Note that the RFC discourages from sending more than 17 routes and
	recommends the routes to be configured manually.
</descrip>

<p>Interface specific options:
@@ -3668,21 +3681,45 @@ dsc-iface
	hosts. Valid values are 0-255, 0 means unspecified. Default: 64

	<tag><label id="radv-iface-default-lifetime">default lifetime <m/expr/ [sensitive <m/switch/]</tag>
	This option specifies the time (in seconds) how long (after the receipt
	This option specifies the time (in seconds) how long (since the receipt
	of RA) hosts may use the router as a default router. 0 means do not use
	as a default router. For <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
	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 option
	sets the time for how long it is advertised (in seconds). Maximum is
	3600, 0 means disabled. Default: 300.

	<tag><label id="radv-iface-default-preference-low">default preference low|medium|high</tag>
	<tag><label id="radv-iface-default-preference">default preference low|medium|high</tag>
	This option specifies the Default Router Preference value to advertise
	to hosts. Default: medium.

	<tag><label id="radv-iface-route-lifetime">route lifetime <m/expr/ [sensitive <m/switch/]</tag>
	This option specifies the default value of advertised lifetime for
	specific routes; i.e., the time (in seconds) for how long (since the
	receipt of RA) hosts should consider these routes valid. A special value
	0xffffffff represents infinity. The lifetime can be overriden on a per
	route basis by the <ref id="rta-ra-lifetime" name="ra_lifetime"> route
	attribute. Default: 3 * <cf/max ra interval/, <cf/sensitive/ no.

	For the <cf/sensitive/ option, see <ref id="radv-trigger" name="trigger">.
	If <cf/sensitive/ is enabled, even the routes with the <cf/ra_lifetime/
	attribute become sensitive to the trigger.

	<tag><label id="radv-iface-route-preference">route preference low|medium|high</tag>
	This option specifies the default value of advertised route preference
	for specific routes. The value can be overriden on a per route basis by
	the <ref id="rta-ra-preference" name="ra_preference"> route attribute.
	Default: medium.

	<tag><label id="radv-prefix-linger-time">prefix linger time <m/expr/</tag>
	When a prefix or a route disappears, it is advertised for some time with
	zero lifetime, to inform clients it is no longer valid. This option
	specifies the time (in seconds) for how long prefixes are advertised
	that way. Default: 3 * <cf/max ra interval/.

	<tag><label id="radv-route-linger-time">route linger time <m/expr/</tag>
	When a prefix or a route disappears, it is advertised for some time with
	zero lifetime, to inform clients it is no longer valid. This option
	specifies the time (in seconds) for how long routes are advertised
	that way. Default: 3 * <cf/max ra interval/.

	<tag><label id="radv-iface-rdnss-local">rdnss local <m/switch/</tag>
	Use only local (interface-specific) RDNSS definitions for this
	interface. Otherwise, both global and local definitions are used. Could
@@ -3729,7 +3766,6 @@ dsc-iface
	<cf/sensitive/ no.
</descrip>


<p>RDNSS specific options:

<descrip>
@@ -3762,12 +3798,48 @@ dsc-iface
	RDNSS <cf/lifetime/ option above. Default: 3 * <cf/max ra interval/.
</descrip>

<sect1>Attributes
<label id="radv-attr">

<p>RAdv defines two route attributes:

<descrip>
	<tag><label id="rta-ra-preference">enum ra_preference/</tag>
	The preference of the route. The value can be <it/RA_PREF_LOW/,
	<it/RA_PREF_MEDIUM/ or <it/RA_PREF_HIGH/. If the attribute is not set,
	the <ref id="radv-iface-route-preference" name="route preference">
	option is used.

	<tag><label id="rta-ra-lifetime">int ra_lifetime/</tag>
	The advertised lifetime of the route, in seconds. The special value of
	0xffffffff represents infinity. If the attribute is not set, the
	<ref id="radv-iface-route-lifetime" name="route lifetime">
	option is used.
</descrip>

<sect1>Example
<label id="radv-exam">

<p><code>
table radv_routes;			# Manually configured routes go here

protocol static {
	table radv_routes;

	route 2001:0DB8:4000::/48 unreachable;
	route 2001:0DB8:4010::/48 unreachable;

	route 2001:0DB8:4020::/48 unreachable {
		ra_preference = RA_PREF_HIGH;
		ra_lifetime = 3600;
	};
}

protocol radv {
	propagate routes yes;		# Propagate the routes from the radv_routes table
	table radv_routes;
	export all;

	interface "eth2" {
		max ra interval 5;	# Fast failover with more routers
		managed yes;		# Using DHCPv6 on eth2
+2 −1
Original line number Diff line number Diff line
@@ -1089,7 +1089,8 @@ interpret(struct f_inst *what)

      switch (what->aux & EAF_TYPE_MASK) {
      case EAF_TYPE_INT:
	if (v1.type != T_INT)
	// Enums are also ints, so allow them in.
	if (v1.type != T_INT && (v1.type < T_ENUM_LO || v1.type > T_ENUM_HI))
	  runtime( "Setting int attribute to non-int value" );
	l->attrs[0].u.data = v1.val.i;
	break;
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ void val_format(struct f_val v, buffer *buf);
#define T_ENUM_RTD 0x34
#define T_ENUM_ROA 0x35
#define T_ENUM_NETTYPE 0x36
#define T_ENUM_RA_PREFERENCE 0x37

/* new enums go here */
#define T_ENUM_EMPTY 0x3f	/* Special hack for atomic_aggr */
+6 −6
Original line number Diff line number Diff line
@@ -756,12 +756,12 @@ echo_size:
   }
 ;

CF_CLI(DISABLE, proto_patt, <protocol> | \"<pattern>\" | all, [[Disable protocol]])
{ proto_apply_cmd($2, proto_cmd_disable, 1, 0); } ;
CF_CLI(ENABLE, proto_patt, <protocol> | \"<pattern>\" | all, [[Enable protocol]])
{ proto_apply_cmd($2, proto_cmd_enable, 1, 0); } ;
CF_CLI(RESTART, proto_patt, <protocol> | \"<pattern>\" | all, [[Restart protocol]])
{ proto_apply_cmd($2, proto_cmd_restart, 1, 0); } ;
CF_CLI(DISABLE, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Disable protocol]])
{ proto_apply_cmd($2, proto_cmd_disable, 1, (uintptr_t) $3); } ;
CF_CLI(ENABLE, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Enable protocol]])
{ proto_apply_cmd($2, proto_cmd_enable, 1, (uintptr_t) $3); } ;
CF_CLI(RESTART, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Restart protocol]])
{ proto_apply_cmd($2, proto_cmd_restart, 1, (uintptr_t) $3); } ;
CF_CLI(RELOAD, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol]])
{ proto_apply_cmd($2, proto_cmd_reload, 1, CMD_RELOAD); } ;
CF_CLI(RELOAD IN, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol (just imported routes)]])
+50 −11
Original line number Diff line number Diff line
@@ -980,6 +980,7 @@ proto_rethink_goal(struct proto *p)
    proto_remove_channels(p);
    rem_node(&p->n);
    rfree(p->event);
    mb_free(p->message);
    mb_free(p);
    if (!nc)
      return;
@@ -1334,6 +1335,39 @@ proto_schedule_down(struct proto *p, byte restart, byte code)
  tm_start_max(proto_shutdown_timer, restart ? 250 MS : 0);
}

/**
 * proto_set_message - set administrative message to protocol
 * @p: protocol
 * @msg: message
 * @len: message length (-1 for NULL-terminated string)
 *
 * The function sets administrative message (string) related to protocol state
 * change. It is called by the nest code for manual enable/disable/restart
 * commands all routes to the protocol, and by protocol-specific code when the
 * protocol state change is initiated by the protocol. Using NULL message clears
 * the last message. The message string may be either NULL-terminated or with an
 * explicit length.
 */
void
proto_set_message(struct proto *p, char *msg, int len)
{
  mb_free(p->message);
  p->message = NULL;

  if (!msg || !len)
    return;

  if (len < 0)
    len = strlen(msg);

  if (!len)
    return;

  p->message = mb_alloc(proto_pool, len + 1);
  memcpy(p->message, msg, len);
  p->message[len] = 0;
}


static const char *
channel_limit_name(struct channel_limit *l)
@@ -1622,7 +1656,7 @@ channel_show_info(struct channel *c)
}

void
proto_cmd_show(struct proto *p, uint verbose, int cnt)
proto_cmd_show(struct proto *p, uintptr_t verbose, int cnt)
{
  byte buf[256], tbuf[TM_DATETIME_BUFFER_SIZE];

@@ -1646,6 +1680,8 @@ proto_cmd_show(struct proto *p, uint verbose, int cnt)
  {
    if (p->cf->dsc)
      cli_msg(-1006, "  Description:    %s", p->cf->dsc);
    if (p->message)
      cli_msg(-1006, "  Message:        %s", p->message);
    if (p->cf->router_id)
      cli_msg(-1006, "  Router ID:      %R", p->cf->router_id);
    if (p->vrf)
@@ -1665,7 +1701,7 @@ proto_cmd_show(struct proto *p, uint verbose, int cnt)
}

void
proto_cmd_disable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
proto_cmd_disable(struct proto *p, uintptr_t arg, int cnt UNUSED)
{
  if (p->disabled)
  {
@@ -1676,12 +1712,13 @@ proto_cmd_disable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
  log(L_INFO "Disabling protocol %s", p->name);
  p->disabled = 1;
  p->down_code = PDC_CMD_DISABLE;
  proto_set_message(p, (char *) arg, -1);
  proto_rethink_goal(p);
  cli_msg(-9, "%s: disabled", p->name);
}

void
proto_cmd_enable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
proto_cmd_enable(struct proto *p, uintptr_t arg, int cnt UNUSED)
{
  if (!p->disabled)
  {
@@ -1691,12 +1728,13 @@ proto_cmd_enable(struct proto *p, uint arg UNUSED, int cnt UNUSED)

  log(L_INFO "Enabling protocol %s", p->name);
  p->disabled = 0;
  proto_set_message(p, (char *) arg, -1);
  proto_rethink_goal(p);
  cli_msg(-11, "%s: enabled", p->name);
}

void
proto_cmd_restart(struct proto *p, uint arg UNUSED, int cnt UNUSED)
proto_cmd_restart(struct proto *p, uintptr_t arg, int cnt UNUSED)
{
  if (p->disabled)
  {
@@ -1707,6 +1745,7 @@ proto_cmd_restart(struct proto *p, uint arg UNUSED, int cnt UNUSED)
  log(L_INFO "Restarting protocol %s", p->name);
  p->disabled = 1;
  p->down_code = PDC_CMD_RESTART;
  proto_set_message(p, (char *) arg, -1);
  proto_rethink_goal(p);
  p->disabled = 0;
  proto_rethink_goal(p);
@@ -1714,7 +1753,7 @@ proto_cmd_restart(struct proto *p, uint arg UNUSED, int cnt UNUSED)
}

void
proto_cmd_reload(struct proto *p, uint dir, int cnt UNUSED)
proto_cmd_reload(struct proto *p, uintptr_t dir, int cnt UNUSED)
{
  struct channel *c;

@@ -1753,19 +1792,19 @@ proto_cmd_reload(struct proto *p, uint dir, int cnt UNUSED)
}

void
proto_cmd_debug(struct proto *p, uint mask, int cnt UNUSED)
proto_cmd_debug(struct proto *p, uintptr_t mask, int cnt UNUSED)
{
  p->debug = mask;
}

void
proto_cmd_mrtdump(struct proto *p, uint mask, int cnt UNUSED)
proto_cmd_mrtdump(struct proto *p, uintptr_t mask, int cnt UNUSED)
{
  p->mrtdump = mask;
}

static void
proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uint, int), uint arg)
proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg)
{
  if (s->class != SYM_PROTO)
  {
@@ -1778,7 +1817,7 @@ proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uint, int)
}

static void
proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uint, int), uint arg)
proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg)
{
  struct proto *p;
  int cnt = 0;
@@ -1794,8 +1833,8 @@ proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uint, int), uint a
}

void
proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int),
		int restricted, uint arg)
proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uintptr_t, int),
		int restricted, uintptr_t arg)
{
  if (restricted && cli_access_restricted())
    return;
Loading