Commit 46434a3c authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Merge commit '7b2c5f3d' into int-new

parents 4ff15a75 7b2c5f3d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -600,6 +600,15 @@ agreement").

	<tag><label id="proto-table">table <m/name/</tag>
	Connect this protocol to a non-default routing table.

	<tag><label id="proto-vrf">vrf "<m/text/"</tag>
	Associate the protocol with specific VRF. The protocol will be
	restricted to interfaces assigned to the VRF and will use sockets bound
	to the VRF. Appropriate VRF interface must exist on OS level. For kernel
	protocol, an appropriate table still must be explicitly selected by
	<cf/table/ option. Note that the VRF support in BIRD and Linux kernel
	(4.11) is still in development and is currently problematic outside of
	multihop BGP.
</descrip>

<p>There are several options that give sense only with certain protocols:
@@ -1331,6 +1340,8 @@ foot).

	<cf><m/P/.len</cf> returns the length of path <m/P/.

	<cf><m/P/.empty</cf> resets path <m/P/ to empty path.

	<cf>prepend(<m/P/,<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and
	returns the result.

@@ -1369,6 +1380,8 @@ foot).

	<cf><m/C/.len</cf> returns the length of clist <m/C/.

	<cf><m/C/.empty</cf> resets clist <m/C/ to empty clist.

	<cf>add(<m/C/,<m/P/)</cf> adds pair (or quad) <m/P/ to clist <m/C/ and
	returns the result. If item <m/P/ is already in clist <m/C/, it does
	nothing. <m/P/ may also be a clist, in that case all its members are
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ typedef struct birdsock {
  int ttl;				/* Time To Live, -1 = default */
  u32 flags;
  struct iface *iface;			/* Interface; specify this for broad/multicast sockets */
  struct iface *vrf;			/* Related VRF instance, NULL if global */

  byte *rbuf, *rpos;			/* NULL=allocate automatically */
  uint fast_rx;				/* RX has higher priority in event loop */
+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ proto_postconfig(void)
CF_DECLS

CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, TABLE, STATES, ROUTES, FILTERS)
CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6)
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
@@ -225,6 +225,7 @@ proto_item:
 | MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; }
 | ROUTER ID idval { this_proto->router_id = $3; }
 | DESCRIPTION text { this_proto->dsc = $2; }
 | VRF text { this_proto->vrf = if_get_by_name($2); }
 ;


+19 −5
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ if_what_changed(struct iface *i, struct iface *j)
  unsigned c;

  if (((i->flags ^ j->flags) & ~(IF_UP | IF_SHUTDOWN | IF_UPDATED | IF_ADMIN_UP | IF_LINK_UP | IF_TMP_DOWN | IF_JUST_CREATED))
      || i->index != j->index)
      || (i->index != j->index) || (i->master != j->master))
    return IF_CHANGE_TOO_MUCH;
  c = 0;
  if ((i->flags ^ j->flags) & IF_UP)
@@ -137,12 +137,16 @@ if_copy(struct iface *to, struct iface *from)
{
  to->flags = from->flags | (to->flags & IF_TMP_DOWN);
  to->mtu = from->mtu;
  to->master_index = from->master_index;
  to->master = from->master;
}

static inline void
ifa_send_notify(struct proto *p, unsigned c, struct ifa *a)
{
  if (p->ifa_notify && (p->proto_state != PS_DOWN))
  if (p->ifa_notify &&
      (p->proto_state != PS_DOWN) &&
      (!p->vrf || p->vrf == a->iface->master))
    {
      if (p->debug & D_IFACES)
	log(L_TRACE "%s < address %N on interface %s %s",
@@ -178,7 +182,9 @@ ifa_notify_change(unsigned c, struct ifa *a)
static inline void
if_send_notify(struct proto *p, unsigned c, struct iface *i)
{
  if (p->if_notify && (p->proto_state != PS_DOWN))
  if (p->if_notify &&
      (p->proto_state != PS_DOWN) &&
      (!p->vrf || p->vrf == i->master))
    {
      if (p->debug & D_IFACES)
	log(L_TRACE "%s < interface %s %s", p->name, i->name,
@@ -234,7 +240,9 @@ if_notify_change(unsigned c, struct iface *i)
static uint
if_recalc_flags(struct iface *i UNUSED, uint flags)
{
  if ((flags & IF_ADMIN_UP) && !(flags & (IF_SHUTDOWN | IF_TMP_DOWN)))
  if ((flags & IF_ADMIN_UP) &&
      !(flags & (IF_SHUTDOWN | IF_TMP_DOWN)) &&
      !(i->master_index && !i->master))
    flags |= IF_UP;
  else
    flags &= ~IF_UP;
@@ -835,7 +843,13 @@ if_show(void)
      if (i->flags & IF_SHUTDOWN)
	continue;

      cli_msg(-1001, "%s %s (index=%d)", i->name, (i->flags & IF_UP) ? "Up" : "Down", i->index);
      char mbuf[16 + sizeof(i->name)] = {};
      if (i->master)
	bsprintf(mbuf, " master=%s", i->master->name);
      else if (i->master_index)
	bsprintf(mbuf, " master=#%u", i->master_index);

      cli_msg(-1001, "%s %s (index=%d%s)", i->name, (i->flags & IF_UP) ? "Up" : "Down", i->index, mbuf);
      if (!(i->flags & IF_MULTIACCESS))
	type = "PtP";
      else
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ struct iface {
  unsigned flags;
  unsigned mtu;
  unsigned index;			/* OS-dependent interface index */
  unsigned master_index;		/* Interface index of master iface */
  struct iface *master;			/* Master iface (e.g. for VRF) */
  list addrs;				/* Addresses assigned to this interface */
  struct ifa *addr4;			/* Primary address for IPv4 */
  struct ifa *addr6;			/* Primary address for IPv6 */
Loading