Commit bcea7396 authored by Jan Maria Matejka's avatar Jan Maria Matejka
Browse files

Kernel: adminup config and several minor fices

parent d65c2588
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2576,6 +2576,15 @@ interfaces to be defined for them to work with.

	In all cases, an address marked by operating system as secondary cannot
	be chosen as the primary one.

	<tag><label id="device-adminup">adminup <m/pattern/ [, <m/.../]</tag>
	If a network interface status info is inconsistent, BIRD may override
	the information it gets from kernel by admin up/down status, ignoring
	interface operational status or link up information.

	This option allows BIRD to do this for specified interfaces.
	See <ref id="proto-iface" name="interface"> common option for detailed
	description of the pattern syntax.
</descrip>

<p>As the Device protocol doesn't generate any routes, it cannot have
+2 −2
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ ifa_find_preferred(struct iface *i, const net_addr *n, int done)
  return ret;
}

list kif_primary_list(void);
list *kif_primary_list(void);
int kif_set_sysdep_ip(struct iface *i);

static int
@@ -566,7 +566,7 @@ ifa_recalc_primary(struct iface *i)
    ret |= IF_CHANGE_SYSDEP;


  WALK_LIST(it, kif_primary_list())
  WALK_LIST(it, *kif_primary_list())
    {
      if (!it->pattern || patmatch(it->pattern, i->name))
	ret |= ifa_find_preferred(i, &it->prefix, ret);
+4 −2
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ krt_send_route(struct krt_proto *p, int cmd, rte *e)
  {
    WALK_LIST(j, iface_list)
    {
      if (j->flags & IF_LOOPBACK)
      if ((j->flags & IF_LOOPBACK) && (net->n.addr->type == NET_IP4 || j->llv6))
      {
        i = j;
        break;
@@ -574,6 +574,7 @@ krt_read_ifannounce(struct ks_msg *msg)
  DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam->ifan_what, ifam->ifan_index, ifam->ifan_name);
}

list *kif_adminup_list(void);
static void
krt_read_ifinfo(struct ks_msg *msg, int scan)
{
@@ -649,7 +650,8 @@ krt_read_ifinfo(struct ks_msg *msg, int scan)
    f.flags |= IF_MULTIACCESS;      /* NBMA */

  /* Estimation of link up. */
  if ((f.flags & IF_ADMIN_UP) && (f.flags & IF_LINK_UP))
  if ((f.flags & IF_ADMIN_UP) &&
      (iface_patt_find(kif_adminup_list(), &f, NULL) || (f.flags & IF_LINK_UP)))
    f.flags |= IF_SYSDEP_UP;

  iface = if_update(&f);
+4 −1
Original line number Diff line number Diff line
@@ -759,6 +759,7 @@ nl_parse_metrics(struct rtattr *hdr, u32 *metrics, int max)
 *	Scanning of interfaces
 */

list *kif_adminup_list(void);
static void
nl_parse_link(struct nlmsghdr *h, int scan)
{
@@ -827,7 +828,9 @@ nl_parse_link(struct nlmsghdr *h, int scan)
      if (fl & IFF_MULTICAST)
	f.flags |= IF_MULTICAST;

      if (a[IFLA_OPERSTATE])
      if (iface_patt_find(kif_adminup_list(), &f, NULL))
	f.flags |= (f.flags & IF_ADMIN_UP) ? IF_SYSDEP_UP : 0;
      else if (a[IFLA_OPERSTATE])
	switch (rta_get_u8(a[IFLA_OPERSTATE]))
	  {
	    case 0: /* IF_OPER_UNKNOWN */
+5 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ krt_set_merge_paths(struct channel_config *cc, uint merge, uint limit)

CF_DECLS

CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS, ADMINUP)

%type <i> kern_mp_limit

@@ -98,8 +98,12 @@ kif_item:
     ipn->prefix = $3;
     add_tail(&THIS_KIF->primary, &ipn->n);
   }
 | ADMINUP iface_patt_init iface_patt_list_nopx {
     add_tail(&THIS_KIF->adminup, &this_ipatt->n);
   }
 ;


CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_SOURCE); })
CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_METRIC); })

Loading