2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Interface looking up by netlink.
|
|
|
|
* Copyright (C) 1998 Kunihiro Ishiguro
|
|
|
|
*
|
|
|
|
* This file is part of GNU Zebra.
|
|
|
|
*
|
|
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
2017-05-15 07:31:08 +02:00
|
|
|
|
2017-07-26 19:49:15 +02:00
|
|
|
#ifdef GNU_LINUX
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* The following definition is to workaround an issue in the Linux kernel
|
|
|
|
* header files with redefinition of 'struct in6_addr' in both
|
|
|
|
* netinet/in.h and linux/in6.h.
|
|
|
|
* Reference - https://sourceware.org/ml/libc-alpha/2013-01/msg00599.html
|
|
|
|
*/
|
|
|
|
#define _LINUX_IN6_H
|
2019-12-19 18:33:56 +01:00
|
|
|
#define _LINUX_IF_H
|
|
|
|
#define _LINUX_IP_H
|
2017-05-15 07:31:08 +02:00
|
|
|
|
2018-03-10 00:08:24 +01:00
|
|
|
#include <netinet/if_ether.h>
|
2017-05-15 07:31:08 +02:00
|
|
|
#include <linux/if_bridge.h>
|
2017-09-21 03:12:56 +02:00
|
|
|
#include <linux/if_link.h>
|
2019-12-19 18:33:56 +01:00
|
|
|
#include <linux/if_tunnel.h>
|
2016-10-17 21:39:55 +02:00
|
|
|
#include <net/if_arp.h>
|
2017-03-30 21:51:29 +02:00
|
|
|
#include <linux/sockios.h>
|
|
|
|
#include <linux/ethtool.h>
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
#include "linklist.h"
|
|
|
|
#include "if.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "connected.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "rib.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "privs.h"
|
|
|
|
#include "nexthop.h"
|
|
|
|
#include "vrf.h"
|
2017-05-16 01:02:34 +02:00
|
|
|
#include "vrf_int.h"
|
2016-10-17 21:39:55 +02:00
|
|
|
#include "mpls.h"
|
2018-06-14 16:38:40 +02:00
|
|
|
#include "lib_errors.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2016-10-06 22:23:13 +02:00
|
|
|
#include "vty.h"
|
2011-08-28 20:29:52 +02:00
|
|
|
#include "zebra/zserv.h"
|
2016-10-17 21:39:55 +02:00
|
|
|
#include "zebra/zebra_ns.h"
|
|
|
|
#include "zebra/zebra_vrf.h"
|
|
|
|
#include "zebra/rt.h"
|
|
|
|
#include "zebra/redistribute.h"
|
|
|
|
#include "zebra/interface.h"
|
|
|
|
#include "zebra/debug.h"
|
|
|
|
#include "zebra/rtadv.h"
|
|
|
|
#include "zebra/zebra_ptm.h"
|
|
|
|
#include "zebra/zebra_mpls.h"
|
|
|
|
#include "zebra/kernel_netlink.h"
|
2019-02-26 00:18:07 +01:00
|
|
|
#include "zebra/rt_netlink.h"
|
2016-10-17 21:39:55 +02:00
|
|
|
#include "zebra/if_netlink.h"
|
2018-08-16 22:10:32 +02:00
|
|
|
#include "zebra/zebra_errors.h"
|
2019-02-14 03:22:14 +01:00
|
|
|
#include "zebra/zebra_vxlan.h"
|
2020-03-28 01:32:46 +01:00
|
|
|
#include "zebra/zebra_evpn_mh.h"
|
2021-03-12 14:32:53 +01:00
|
|
|
#include "zebra/zebra_l2.h"
|
2021-05-04 14:50:00 +02:00
|
|
|
#include "zebra/netconf_netlink.h"
|
2021-10-06 14:22:48 +02:00
|
|
|
#include "zebra/zebra_trace.h"
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2018-01-29 16:14:46 +01:00
|
|
|
extern struct zebra_privs_t zserv_privs;
|
2022-01-26 06:07:57 +01:00
|
|
|
uint8_t frr_protodown_r_bit = FRR_PROTODOWN_REASON_DEFAULT_BIT;
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
/* Note: on netlink systems, there should be a 1-to-1 mapping between interface
|
|
|
|
names and ifindex values. */
|
|
|
|
static void set_ifindex(struct interface *ifp, ifindex_t ifi_index,
|
|
|
|
struct zebra_ns *zns)
|
|
|
|
{
|
|
|
|
struct interface *oifp;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (((oifp = if_lookup_by_index_per_ns(zns, ifi_index)) != NULL)
|
|
|
|
&& (oifp != ifp)) {
|
|
|
|
if (ifi_index == IFINDEX_INTERNAL)
|
2018-08-03 20:03:29 +02:00
|
|
|
flog_err(
|
2018-09-13 21:34:28 +02:00
|
|
|
EC_LIB_INTERFACE,
|
2018-06-18 14:49:36 +02:00
|
|
|
"Netlink is setting interface %s ifindex to reserved internal value %u",
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->name, ifi_index);
|
|
|
|
else {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"interface index %d was renamed from %s to %s",
|
|
|
|
ifi_index, oifp->name, ifp->name);
|
|
|
|
if (if_is_up(oifp))
|
2018-08-03 20:03:29 +02:00
|
|
|
flog_err(
|
2018-09-13 21:34:28 +02:00
|
|
|
EC_LIB_INTERFACE,
|
2018-06-18 14:49:36 +02:00
|
|
|
"interface rename detected on up interface: index %d was renamed from %s to %s, results are uncertain!",
|
2016-10-17 21:39:55 +02:00
|
|
|
ifi_index, oifp->name, ifp->name);
|
2022-03-25 01:02:33 +01:00
|
|
|
if_delete_update(&oifp);
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
|
|
|
}
|
2017-10-03 03:06:04 +02:00
|
|
|
if_set_index(ifp, ifi_index);
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Utility function to parse hardware link-layer address and update ifp */
|
|
|
|
static void netlink_interface_update_hw_addr(struct rtattr **tb,
|
|
|
|
struct interface *ifp)
|
|
|
|
{
|
|
|
|
int i;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFLA_ADDRESS]) {
|
|
|
|
int hw_addr_len;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
hw_addr_len = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (hw_addr_len > INTERFACE_HWADDR_MAX)
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug("Hardware address is too large: %d",
|
|
|
|
hw_addr_len);
|
2016-10-17 21:39:55 +02:00
|
|
|
else {
|
|
|
|
ifp->hw_addr_len = hw_addr_len;
|
|
|
|
memcpy(ifp->hw_addr, RTA_DATA(tb[IFLA_ADDRESS]),
|
|
|
|
hw_addr_len);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
for (i = 0; i < hw_addr_len; i++)
|
|
|
|
if (ifp->hw_addr[i] != 0)
|
|
|
|
break;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (i == hw_addr_len)
|
|
|
|
ifp->hw_addr_len = 0;
|
|
|
|
else
|
|
|
|
ifp->hw_addr_len = hw_addr_len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum zebra_link_type netlink_to_zebra_link_type(unsigned int hwt)
|
|
|
|
{
|
|
|
|
switch (hwt) {
|
|
|
|
case ARPHRD_ETHER:
|
|
|
|
return ZEBRA_LLT_ETHER;
|
|
|
|
case ARPHRD_EETHER:
|
|
|
|
return ZEBRA_LLT_EETHER;
|
|
|
|
case ARPHRD_AX25:
|
|
|
|
return ZEBRA_LLT_AX25;
|
|
|
|
case ARPHRD_PRONET:
|
|
|
|
return ZEBRA_LLT_PRONET;
|
|
|
|
case ARPHRD_IEEE802:
|
|
|
|
return ZEBRA_LLT_IEEE802;
|
|
|
|
case ARPHRD_ARCNET:
|
|
|
|
return ZEBRA_LLT_ARCNET;
|
|
|
|
case ARPHRD_APPLETLK:
|
|
|
|
return ZEBRA_LLT_APPLETLK;
|
|
|
|
case ARPHRD_DLCI:
|
|
|
|
return ZEBRA_LLT_DLCI;
|
|
|
|
case ARPHRD_ATM:
|
|
|
|
return ZEBRA_LLT_ATM;
|
|
|
|
case ARPHRD_METRICOM:
|
|
|
|
return ZEBRA_LLT_METRICOM;
|
|
|
|
case ARPHRD_IEEE1394:
|
|
|
|
return ZEBRA_LLT_IEEE1394;
|
|
|
|
case ARPHRD_EUI64:
|
|
|
|
return ZEBRA_LLT_EUI64;
|
|
|
|
case ARPHRD_INFINIBAND:
|
|
|
|
return ZEBRA_LLT_INFINIBAND;
|
|
|
|
case ARPHRD_SLIP:
|
|
|
|
return ZEBRA_LLT_SLIP;
|
|
|
|
case ARPHRD_CSLIP:
|
|
|
|
return ZEBRA_LLT_CSLIP;
|
|
|
|
case ARPHRD_SLIP6:
|
|
|
|
return ZEBRA_LLT_SLIP6;
|
|
|
|
case ARPHRD_CSLIP6:
|
|
|
|
return ZEBRA_LLT_CSLIP6;
|
|
|
|
case ARPHRD_RSRVD:
|
|
|
|
return ZEBRA_LLT_RSRVD;
|
|
|
|
case ARPHRD_ADAPT:
|
|
|
|
return ZEBRA_LLT_ADAPT;
|
|
|
|
case ARPHRD_ROSE:
|
|
|
|
return ZEBRA_LLT_ROSE;
|
|
|
|
case ARPHRD_X25:
|
|
|
|
return ZEBRA_LLT_X25;
|
|
|
|
case ARPHRD_PPP:
|
|
|
|
return ZEBRA_LLT_PPP;
|
|
|
|
case ARPHRD_CISCO:
|
|
|
|
return ZEBRA_LLT_CHDLC;
|
|
|
|
case ARPHRD_LAPB:
|
|
|
|
return ZEBRA_LLT_LAPB;
|
|
|
|
case ARPHRD_RAWHDLC:
|
|
|
|
return ZEBRA_LLT_RAWHDLC;
|
|
|
|
case ARPHRD_TUNNEL:
|
|
|
|
return ZEBRA_LLT_IPIP;
|
|
|
|
case ARPHRD_TUNNEL6:
|
|
|
|
return ZEBRA_LLT_IPIP6;
|
|
|
|
case ARPHRD_FRAD:
|
|
|
|
return ZEBRA_LLT_FRAD;
|
|
|
|
case ARPHRD_SKIP:
|
|
|
|
return ZEBRA_LLT_SKIP;
|
|
|
|
case ARPHRD_LOOPBACK:
|
|
|
|
return ZEBRA_LLT_LOOPBACK;
|
|
|
|
case ARPHRD_LOCALTLK:
|
|
|
|
return ZEBRA_LLT_LOCALTLK;
|
|
|
|
case ARPHRD_FDDI:
|
|
|
|
return ZEBRA_LLT_FDDI;
|
|
|
|
case ARPHRD_SIT:
|
|
|
|
return ZEBRA_LLT_SIT;
|
|
|
|
case ARPHRD_IPDDP:
|
|
|
|
return ZEBRA_LLT_IPDDP;
|
|
|
|
case ARPHRD_IPGRE:
|
|
|
|
return ZEBRA_LLT_IPGRE;
|
|
|
|
case ARPHRD_PIMREG:
|
|
|
|
return ZEBRA_LLT_PIMREG;
|
|
|
|
case ARPHRD_HIPPI:
|
|
|
|
return ZEBRA_LLT_HIPPI;
|
|
|
|
case ARPHRD_ECONET:
|
|
|
|
return ZEBRA_LLT_ECONET;
|
|
|
|
case ARPHRD_IRDA:
|
|
|
|
return ZEBRA_LLT_IRDA;
|
|
|
|
case ARPHRD_FCPP:
|
|
|
|
return ZEBRA_LLT_FCPP;
|
|
|
|
case ARPHRD_FCAL:
|
|
|
|
return ZEBRA_LLT_FCAL;
|
|
|
|
case ARPHRD_FCPL:
|
|
|
|
return ZEBRA_LLT_FCPL;
|
|
|
|
case ARPHRD_FCFABRIC:
|
|
|
|
return ZEBRA_LLT_FCFABRIC;
|
|
|
|
case ARPHRD_IEEE802_TR:
|
|
|
|
return ZEBRA_LLT_IEEE802_TR;
|
|
|
|
case ARPHRD_IEEE80211:
|
|
|
|
return ZEBRA_LLT_IEEE80211;
|
2017-11-14 10:36:05 +01:00
|
|
|
#ifdef ARPHRD_IEEE802154
|
2016-10-17 21:39:55 +02:00
|
|
|
case ARPHRD_IEEE802154:
|
|
|
|
return ZEBRA_LLT_IEEE802154;
|
2017-11-14 10:36:05 +01:00
|
|
|
#endif
|
2016-10-17 21:39:55 +02:00
|
|
|
#ifdef ARPHRD_IP6GRE
|
|
|
|
case ARPHRD_IP6GRE:
|
|
|
|
return ZEBRA_LLT_IP6GRE;
|
|
|
|
#endif
|
|
|
|
#ifdef ARPHRD_IEEE802154_PHY
|
|
|
|
case ARPHRD_IEEE802154_PHY:
|
|
|
|
return ZEBRA_LLT_IEEE802154_PHY;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
return ZEBRA_LLT_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-28 01:32:46 +01:00
|
|
|
static inline void zebra_if_set_ziftype(struct interface *ifp,
|
2021-08-30 19:24:26 +02:00
|
|
|
enum zebra_iftype zif_type,
|
2021-08-30 19:27:02 +02:00
|
|
|
enum zebra_slave_iftype zif_slave_type)
|
2020-03-28 01:32:46 +01:00
|
|
|
{
|
|
|
|
struct zebra_if *zif;
|
|
|
|
|
|
|
|
zif = (struct zebra_if *)ifp->info;
|
|
|
|
zif->zif_slave_type = zif_slave_type;
|
|
|
|
|
|
|
|
if (zif->zif_type != zif_type) {
|
|
|
|
zif->zif_type = zif_type;
|
|
|
|
/* If the if_type has been set to bond initialize ES info
|
|
|
|
* against it. XXX - note that we don't handle the case where
|
|
|
|
* a zif changes from bond to non-bond; it is really
|
|
|
|
* an unexpected/error condition.
|
|
|
|
*/
|
|
|
|
zebra_evpn_if_init(zif);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-10 21:54:43 +01:00
|
|
|
static void netlink_determine_zebra_iftype(const char *kind,
|
2021-08-30 19:24:26 +02:00
|
|
|
enum zebra_iftype *zif_type)
|
2017-05-15 07:31:08 +02:00
|
|
|
{
|
|
|
|
*zif_type = ZEBRA_IF_OTHER;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
if (!kind)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
if (strcmp(kind, "vrf") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_VRF;
|
|
|
|
else if (strcmp(kind, "bridge") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_BRIDGE;
|
|
|
|
else if (strcmp(kind, "vlan") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_VLAN;
|
|
|
|
else if (strcmp(kind, "vxlan") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_VXLAN;
|
2017-06-28 10:51:10 +02:00
|
|
|
else if (strcmp(kind, "macvlan") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_MACVLAN;
|
2018-08-29 11:29:07 +02:00
|
|
|
else if (strcmp(kind, "veth") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_VETH;
|
2018-11-10 21:54:43 +01:00
|
|
|
else if (strcmp(kind, "bond") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_BOND;
|
|
|
|
else if (strcmp(kind, "bond_slave") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_BOND_SLAVE;
|
2019-12-19 18:33:56 +01:00
|
|
|
else if (strcmp(kind, "gre") == 0)
|
|
|
|
*zif_type = ZEBRA_IF_GRE;
|
2017-05-15 07:31:08 +02:00
|
|
|
}
|
2016-12-01 02:24:47 +01:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
|
2020-03-09 14:50:18 +01:00
|
|
|
uint32_t ns_id, const char *name)
|
2016-10-17 21:39:55 +02:00
|
|
|
{
|
|
|
|
struct ifinfomsg *ifi;
|
|
|
|
struct rtattr *linkinfo[IFLA_INFO_MAX + 1];
|
|
|
|
struct rtattr *attr[IFLA_VRF_MAX + 1];
|
2020-11-12 13:37:30 +01:00
|
|
|
struct vrf *vrf = NULL;
|
2016-10-17 21:39:55 +02:00
|
|
|
struct zebra_vrf *zvrf;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t nl_table_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
ifi = NLMSG_DATA(h);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(linkinfo, IFLA_INFO_MAX, tb);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (!linkinfo[IFLA_INFO_DATA]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"%s: IFLA_INFO_DATA missing from VRF message: %s",
|
|
|
|
__func__, name);
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(attr, IFLA_VRF_MAX,
|
|
|
|
linkinfo[IFLA_INFO_DATA]);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (!attr[IFLA_VRF_TABLE]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"%s: IFLA_VRF_TABLE missing from VRF message: %s",
|
|
|
|
__func__, name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
nl_table_id = *(uint32_t *)RTA_DATA(attr[IFLA_VRF_TABLE]);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type == RTM_NEWLINK) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2017-05-15 07:31:08 +02:00
|
|
|
zlog_debug("RTM_NEWLINK for VRF %s(%u) table %u", name,
|
2016-10-17 21:39:55 +02:00
|
|
|
ifi->ifi_index, nl_table_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-04-30 04:12:22 +02:00
|
|
|
if (!vrf_lookup_by_id((vrf_id_t)ifi->ifi_index)) {
|
|
|
|
vrf_id_t exist_id;
|
2020-03-09 14:50:18 +01:00
|
|
|
|
2020-04-30 04:12:22 +02:00
|
|
|
exist_id = vrf_lookup_by_table(nl_table_id, ns_id);
|
|
|
|
if (exist_id != VRF_DEFAULT) {
|
|
|
|
vrf = vrf_lookup_by_id(exist_id);
|
|
|
|
|
|
|
|
flog_err(
|
|
|
|
EC_ZEBRA_VRF_MISCONFIGURED,
|
|
|
|
"VRF %s id %u table id overlaps existing vrf %s, misconfiguration exiting",
|
|
|
|
name, ifi->ifi_index, vrf->name);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2020-03-09 14:50:18 +01:00
|
|
|
}
|
2020-04-30 04:12:22 +02:00
|
|
|
|
2020-11-12 13:37:30 +01:00
|
|
|
vrf = vrf_update((vrf_id_t)ifi->ifi_index, name);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (!vrf) {
|
2018-09-13 21:34:28 +02:00
|
|
|
flog_err(EC_LIB_INTERFACE, "VRF %s id %u not created",
|
2018-09-13 21:38:57 +02:00
|
|
|
name, ifi->ifi_index);
|
2017-07-17 14:03:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-10-17 21:39:55 +02:00
|
|
|
* This is the only place that we get the actual kernel table_id
|
|
|
|
* being used. We need it to set the table_id of the routes
|
|
|
|
* we are passing to the kernel.... And to throw some totally
|
|
|
|
* awesome parties. that too.
|
2018-03-26 01:35:27 +02:00
|
|
|
*
|
|
|
|
* At this point we *must* have a zvrf because the vrf_create
|
|
|
|
* callback creates one. We *must* set the table id
|
|
|
|
* before the vrf_enable because of( at the very least )
|
|
|
|
* static routes being delayed for installation until
|
|
|
|
* during the vrf_enable callbacks.
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2016-10-17 21:39:55 +02:00
|
|
|
zvrf = (struct zebra_vrf *)vrf->info;
|
|
|
|
zvrf->table_id = nl_table_id;
|
2018-03-26 01:35:27 +02:00
|
|
|
|
|
|
|
/* Enable the created VRF. */
|
|
|
|
if (!vrf_enable(vrf)) {
|
2018-09-13 21:34:28 +02:00
|
|
|
flog_err(EC_LIB_INTERFACE,
|
2018-09-13 21:38:57 +02:00
|
|
|
"Failed to enable VRF %s id %u", name,
|
|
|
|
ifi->ifi_index);
|
2018-03-26 01:35:27 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
} else // h->nlmsg_type == RTM_DELLINK
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2016-10-17 21:39:55 +02:00
|
|
|
zlog_debug("RTM_DELLINK for VRF %s(%u)", name,
|
|
|
|
ifi->ifi_index);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-11-02 15:16:58 +01:00
|
|
|
vrf = vrf_lookup_by_id((vrf_id_t)ifi->ifi_index);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (!vrf) {
|
2018-09-13 21:21:05 +02:00
|
|
|
flog_warn(EC_ZEBRA_VRF_NOT_FOUND, "%s: vrf not found",
|
2018-08-16 22:10:32 +02:00
|
|
|
__func__);
|
2017-07-17 14:03:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
vrf_delete(vrf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-03 22:39:57 +01:00
|
|
|
static uint32_t get_iflink_speed(struct interface *interface, int *error)
|
2017-03-30 21:51:29 +02:00
|
|
|
{
|
|
|
|
struct ifreq ifdata;
|
|
|
|
struct ethtool_cmd ecmd;
|
|
|
|
int sd;
|
|
|
|
int rc;
|
2018-01-29 16:14:46 +01:00
|
|
|
const char *ifname = interface->name;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-06 11:15:05 +02:00
|
|
|
if (error)
|
|
|
|
*error = 0;
|
2017-03-30 21:51:29 +02:00
|
|
|
/* initialize struct */
|
|
|
|
memset(&ifdata, 0, sizeof(ifdata));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-03-30 21:51:29 +02:00
|
|
|
/* set interface name */
|
2017-08-25 02:43:29 +02:00
|
|
|
strlcpy(ifdata.ifr_name, ifname, sizeof(ifdata.ifr_name));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-03-30 21:51:29 +02:00
|
|
|
/* initialize ethtool interface */
|
|
|
|
memset(&ecmd, 0, sizeof(ecmd));
|
|
|
|
ecmd.cmd = ETHTOOL_GSET; /* ETHTOOL_GLINK */
|
2018-03-10 00:08:24 +01:00
|
|
|
ifdata.ifr_data = (caddr_t)&ecmd;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-08-09 07:06:47 +02:00
|
|
|
/* use ioctl to get speed of an interface */
|
2019-08-13 15:47:23 +02:00
|
|
|
frr_with_privs(&zserv_privs) {
|
2018-08-10 18:36:43 +02:00
|
|
|
sd = vrf_socket(PF_INET, SOCK_DGRAM, IPPROTO_IP,
|
2021-10-22 00:17:40 +02:00
|
|
|
interface->vrf->vrf_id, NULL);
|
2018-08-10 18:36:43 +02:00
|
|
|
if (sd < 0) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("Failure to read interface %s speed: %d %s",
|
|
|
|
ifname, errno, safe_strerror(errno));
|
2019-08-06 11:15:05 +02:00
|
|
|
/* no vrf socket creation may probably mean vrf issue */
|
|
|
|
if (error)
|
|
|
|
*error = -1;
|
2018-08-10 18:36:43 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2022-08-09 07:06:47 +02:00
|
|
|
/* Get the current link state for the interface */
|
2021-10-22 00:17:40 +02:00
|
|
|
rc = vrf_ioctl(interface->vrf->vrf_id, sd, SIOCETHTOOL,
|
2018-08-13 19:52:57 +02:00
|
|
|
(char *)&ifdata);
|
2018-08-10 18:36:43 +02:00
|
|
|
}
|
2017-03-30 21:51:29 +02:00
|
|
|
if (rc < 0) {
|
2019-01-02 19:47:51 +01:00
|
|
|
if (errno != EOPNOTSUPP && IS_ZEBRA_DEBUG_KERNEL)
|
2017-07-07 15:45:15 +02:00
|
|
|
zlog_debug(
|
|
|
|
"IOCTL failure to read interface %s speed: %d %s",
|
|
|
|
ifname, errno, safe_strerror(errno));
|
2019-08-06 11:15:05 +02:00
|
|
|
/* no device means interface unreachable */
|
|
|
|
if (errno == ENODEV && error)
|
|
|
|
*error = -1;
|
2017-04-04 00:28:26 +02:00
|
|
|
ecmd.speed_hi = 0;
|
|
|
|
ecmd.speed = 0;
|
2017-03-30 21:51:29 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-03-30 21:51:29 +02:00
|
|
|
close(sd);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-01-03 22:39:57 +01:00
|
|
|
return ((uint32_t)ecmd.speed_hi << 16) | ecmd.speed;
|
2017-03-30 21:51:29 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 11:15:05 +02:00
|
|
|
uint32_t kernel_get_speed(struct interface *ifp, int *error)
|
2018-01-11 01:01:57 +01:00
|
|
|
{
|
2019-08-06 11:15:05 +02:00
|
|
|
return get_iflink_speed(ifp, error);
|
2018-01-11 01:01:57 +01:00
|
|
|
}
|
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
static ssize_t
|
|
|
|
netlink_gre_set_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
|
|
|
|
size_t buflen)
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct ifinfomsg ifi;
|
|
|
|
char buf[];
|
|
|
|
} *req = buf;
|
|
|
|
uint32_t link_idx;
|
2021-03-11 16:01:10 +01:00
|
|
|
unsigned int mtu;
|
2021-03-11 15:33:41 +01:00
|
|
|
struct rtattr *rta_info, *rta_data;
|
2021-03-12 14:32:53 +01:00
|
|
|
const struct zebra_l2info_gre *gre_info;
|
2021-03-11 15:33:41 +01:00
|
|
|
|
|
|
|
if (buflen < sizeof(*req))
|
|
|
|
return 0;
|
|
|
|
memset(req, 0, sizeof(*req));
|
|
|
|
|
|
|
|
req->n.nlmsg_type = RTM_NEWLINK;
|
|
|
|
req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
|
|
|
req->n.nlmsg_flags = NLM_F_REQUEST;
|
|
|
|
|
|
|
|
req->ifi.ifi_index = dplane_ctx_get_ifindex(ctx);
|
2021-03-12 14:32:53 +01:00
|
|
|
|
|
|
|
gre_info = dplane_ctx_gre_get_info(ctx);
|
|
|
|
if (!gre_info)
|
|
|
|
return 0;
|
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
req->ifi.ifi_change = 0xFFFFFFFF;
|
|
|
|
link_idx = dplane_ctx_gre_get_link_ifindex(ctx);
|
2021-03-11 16:01:10 +01:00
|
|
|
mtu = dplane_ctx_gre_get_mtu(ctx);
|
|
|
|
|
|
|
|
if (mtu && !nl_attr_put32(&req->n, buflen, IFLA_MTU, mtu))
|
|
|
|
return 0;
|
2021-03-11 15:33:41 +01:00
|
|
|
|
|
|
|
rta_info = nl_attr_nest(&req->n, buflen, IFLA_LINKINFO);
|
|
|
|
if (!rta_info)
|
|
|
|
return 0;
|
2021-03-12 14:32:53 +01:00
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
if (!nl_attr_put(&req->n, buflen, IFLA_INFO_KIND, "gre", 3))
|
|
|
|
return 0;
|
2021-03-12 14:32:53 +01:00
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
rta_data = nl_attr_nest(&req->n, buflen, IFLA_INFO_DATA);
|
2021-03-12 14:32:53 +01:00
|
|
|
if (!rta_data)
|
2021-03-11 15:33:41 +01:00
|
|
|
return 0;
|
2021-03-12 14:32:53 +01:00
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
if (!nl_attr_put32(&req->n, buflen, IFLA_GRE_LINK, link_idx))
|
|
|
|
return 0;
|
2021-03-12 14:32:53 +01:00
|
|
|
|
|
|
|
if (gre_info->vtep_ip.s_addr &&
|
|
|
|
!nl_attr_put32(&req->n, buflen, IFLA_GRE_LOCAL,
|
|
|
|
gre_info->vtep_ip.s_addr))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (gre_info->vtep_ip_remote.s_addr &&
|
|
|
|
!nl_attr_put32(&req->n, buflen, IFLA_GRE_REMOTE,
|
|
|
|
gre_info->vtep_ip_remote.s_addr))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (gre_info->ikey &&
|
|
|
|
!nl_attr_put32(&req->n, buflen, IFLA_GRE_IKEY,
|
|
|
|
gre_info->ikey))
|
|
|
|
return 0;
|
|
|
|
if (gre_info->okey &&
|
|
|
|
!nl_attr_put32(&req->n, buflen, IFLA_GRE_IKEY,
|
|
|
|
gre_info->okey))
|
|
|
|
return 0;
|
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
nl_attr_nest_end(&req->n, rta_data);
|
|
|
|
nl_attr_nest_end(&req->n, rta_info);
|
|
|
|
|
|
|
|
return NLMSG_ALIGN(req->n.nlmsg_len);
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
static int netlink_extract_bridge_info(struct rtattr *link_data,
|
|
|
|
struct zebra_l2info_bridge *bridge_info)
|
|
|
|
{
|
|
|
|
struct rtattr *attr[IFLA_BR_MAX + 1];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
memset(bridge_info, 0, sizeof(*bridge_info));
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(attr, IFLA_BR_MAX, link_data);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (attr[IFLA_BR_VLAN_FILTERING])
|
|
|
|
bridge_info->vlan_aware =
|
2018-03-27 21:13:34 +02:00
|
|
|
*(uint8_t *)RTA_DATA(attr[IFLA_BR_VLAN_FILTERING]);
|
2017-05-15 07:31:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int netlink_extract_vlan_info(struct rtattr *link_data,
|
|
|
|
struct zebra_l2info_vlan *vlan_info)
|
|
|
|
{
|
|
|
|
struct rtattr *attr[IFLA_VLAN_MAX + 1];
|
|
|
|
vlanid_t vid_in_msg;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
memset(vlan_info, 0, sizeof(*vlan_info));
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(attr, IFLA_VLAN_MAX, link_data);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (!attr[IFLA_VLAN_ID]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("IFLA_VLAN_ID missing from VLAN IF message");
|
|
|
|
return -1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
vid_in_msg = *(vlanid_t *)RTA_DATA(attr[IFLA_VLAN_ID]);
|
|
|
|
vlan_info->vid = vid_in_msg;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-12-19 18:33:56 +01:00
|
|
|
static int netlink_extract_gre_info(struct rtattr *link_data,
|
|
|
|
struct zebra_l2info_gre *gre_info)
|
|
|
|
{
|
|
|
|
struct rtattr *attr[IFLA_GRE_MAX + 1];
|
|
|
|
|
|
|
|
memset(gre_info, 0, sizeof(*gre_info));
|
|
|
|
memset(attr, 0, sizeof(attr));
|
2021-05-05 05:43:47 +02:00
|
|
|
netlink_parse_rtattr_nested(attr, IFLA_GRE_MAX, link_data);
|
2019-12-19 18:33:56 +01:00
|
|
|
|
|
|
|
if (!attr[IFLA_GRE_LOCAL]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"IFLA_GRE_LOCAL missing from GRE IF message");
|
|
|
|
} else
|
|
|
|
gre_info->vtep_ip =
|
|
|
|
*(struct in_addr *)RTA_DATA(attr[IFLA_GRE_LOCAL]);
|
|
|
|
if (!attr[IFLA_GRE_REMOTE]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"IFLA_GRE_REMOTE missing from GRE IF message");
|
|
|
|
} else
|
|
|
|
gre_info->vtep_ip_remote =
|
|
|
|
*(struct in_addr *)RTA_DATA(attr[IFLA_GRE_REMOTE]);
|
|
|
|
|
|
|
|
if (!attr[IFLA_GRE_LINK]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("IFLA_GRE_LINK missing from GRE IF message");
|
2021-03-11 15:33:41 +01:00
|
|
|
} else {
|
2019-12-19 18:33:56 +01:00
|
|
|
gre_info->ifindex_link =
|
|
|
|
*(ifindex_t *)RTA_DATA(attr[IFLA_GRE_LINK]);
|
2021-03-11 15:33:41 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("IFLA_GRE_LINK obtained is %u",
|
|
|
|
gre_info->ifindex_link);
|
|
|
|
}
|
2019-12-19 18:33:56 +01:00
|
|
|
if (attr[IFLA_GRE_IKEY])
|
|
|
|
gre_info->ikey = *(uint32_t *)RTA_DATA(attr[IFLA_GRE_IKEY]);
|
|
|
|
if (attr[IFLA_GRE_OKEY])
|
|
|
|
gre_info->okey = *(uint32_t *)RTA_DATA(attr[IFLA_GRE_OKEY]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
static int netlink_extract_vxlan_info(struct rtattr *link_data,
|
|
|
|
struct zebra_l2info_vxlan *vxl_info)
|
|
|
|
{
|
|
|
|
struct rtattr *attr[IFLA_VXLAN_MAX + 1];
|
|
|
|
vni_t vni_in_msg;
|
|
|
|
struct in_addr vtep_ip_in_msg;
|
2019-09-24 10:44:58 +02:00
|
|
|
ifindex_t ifindex_link;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
memset(vxl_info, 0, sizeof(*vxl_info));
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(attr, IFLA_VXLAN_MAX, link_data);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (!attr[IFLA_VXLAN_ID]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"IFLA_VXLAN_ID missing from VXLAN IF message");
|
|
|
|
return -1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
vni_in_msg = *(vni_t *)RTA_DATA(attr[IFLA_VXLAN_ID]);
|
2021-07-27 09:44:15 +02:00
|
|
|
vxl_info->vni_info.vni.vni = vni_in_msg;
|
2017-05-15 07:31:08 +02:00
|
|
|
if (!attr[IFLA_VXLAN_LOCAL]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"IFLA_VXLAN_LOCAL missing from VXLAN IF message");
|
|
|
|
} else {
|
|
|
|
vtep_ip_in_msg =
|
|
|
|
*(struct in_addr *)RTA_DATA(attr[IFLA_VXLAN_LOCAL]);
|
|
|
|
vxl_info->vtep_ip = vtep_ip_in_msg;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-03-19 16:57:04 +01:00
|
|
|
if (attr[IFLA_VXLAN_GROUP]) {
|
2021-07-27 09:44:15 +02:00
|
|
|
vxl_info->vni_info.vni.mcast_grp =
|
2019-03-19 16:57:04 +01:00
|
|
|
*(struct in_addr *)RTA_DATA(attr[IFLA_VXLAN_GROUP]);
|
|
|
|
}
|
|
|
|
|
2019-09-24 10:44:58 +02:00
|
|
|
if (!attr[IFLA_VXLAN_LINK]) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2020-03-27 12:35:23 +01:00
|
|
|
zlog_debug("IFLA_VXLAN_LINK missing from VXLAN IF message");
|
2019-09-24 10:44:58 +02:00
|
|
|
} else {
|
|
|
|
ifindex_link =
|
|
|
|
*(ifindex_t *)RTA_DATA(attr[IFLA_VXLAN_LINK]);
|
|
|
|
vxl_info->ifindex_link = ifindex_link;
|
|
|
|
}
|
2017-05-15 07:31:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract and save L2 params (of interest) for an interface. When a
|
|
|
|
* bridge interface is added or updated, take further actions to map
|
|
|
|
* its members. Likewise, for VxLAN interface.
|
|
|
|
*/
|
|
|
|
static void netlink_interface_update_l2info(struct interface *ifp,
|
2019-09-24 10:44:58 +02:00
|
|
|
struct rtattr *link_data, int add,
|
|
|
|
ns_id_t link_nsid)
|
2017-05-15 07:31:08 +02:00
|
|
|
{
|
|
|
|
if (!link_data)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE(ifp)) {
|
|
|
|
struct zebra_l2info_bridge bridge_info;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
netlink_extract_bridge_info(link_data, &bridge_info);
|
|
|
|
zebra_l2_bridge_add_update(ifp, &bridge_info, add);
|
|
|
|
} else if (IS_ZEBRA_IF_VLAN(ifp)) {
|
|
|
|
struct zebra_l2info_vlan vlan_info;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
netlink_extract_vlan_info(link_data, &vlan_info);
|
|
|
|
zebra_l2_vlanif_update(ifp, &vlan_info);
|
2020-11-02 19:53:50 +01:00
|
|
|
zebra_evpn_acc_bd_svi_set(ifp->info, NULL,
|
|
|
|
!!if_is_operative(ifp));
|
2017-05-15 07:31:08 +02:00
|
|
|
} else if (IS_ZEBRA_IF_VXLAN(ifp)) {
|
|
|
|
struct zebra_l2info_vxlan vxlan_info;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
netlink_extract_vxlan_info(link_data, &vxlan_info);
|
2019-09-24 10:44:58 +02:00
|
|
|
vxlan_info.link_nsid = link_nsid;
|
2017-05-15 07:31:08 +02:00
|
|
|
zebra_l2_vxlanif_add_update(ifp, &vxlan_info, add);
|
2019-09-24 10:44:58 +02:00
|
|
|
if (link_nsid != NS_UNKNOWN &&
|
|
|
|
vxlan_info.ifindex_link)
|
|
|
|
zebra_if_update_link(ifp, vxlan_info.ifindex_link,
|
|
|
|
link_nsid);
|
2019-12-19 18:33:56 +01:00
|
|
|
} else if (IS_ZEBRA_IF_GRE(ifp)) {
|
|
|
|
struct zebra_l2info_gre gre_info;
|
|
|
|
|
|
|
|
netlink_extract_gre_info(link_data, &gre_info);
|
|
|
|
gre_info.link_nsid = link_nsid;
|
|
|
|
zebra_l2_greif_add_update(ifp, &gre_info, add);
|
|
|
|
if (link_nsid != NS_UNKNOWN &&
|
|
|
|
gre_info.ifindex_link)
|
|
|
|
zebra_if_update_link(ifp, gre_info.ifindex_link,
|
|
|
|
link_nsid);
|
2017-05-15 07:31:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-28 01:32:46 +01:00
|
|
|
static int netlink_bridge_vxlan_update(struct interface *ifp,
|
|
|
|
struct rtattr *af_spec)
|
|
|
|
{
|
|
|
|
struct rtattr *aftb[IFLA_BRIDGE_MAX + 1];
|
|
|
|
struct bridge_vlan_info *vinfo;
|
|
|
|
vlanid_t access_vlan;
|
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
if (!af_spec)
|
|
|
|
return 0;
|
|
|
|
|
2020-03-28 01:32:46 +01:00
|
|
|
/* There is a 1-to-1 mapping of VLAN to VxLAN - hence
|
|
|
|
* only 1 access VLAN is accepted.
|
|
|
|
*/
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(aftb, IFLA_BRIDGE_MAX, af_spec);
|
2020-03-28 01:32:46 +01:00
|
|
|
if (!aftb[IFLA_BRIDGE_VLAN_INFO])
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
vinfo = RTA_DATA(aftb[IFLA_BRIDGE_VLAN_INFO]);
|
|
|
|
if (!(vinfo->flags & BRIDGE_VLAN_INFO_PVID))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
access_vlan = (vlanid_t)vinfo->vid;
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("Access VLAN %u for VxLAN IF %s(%u)", access_vlan,
|
|
|
|
ifp->name, ifp->ifindex);
|
|
|
|
zebra_l2_vxlanif_update_access_vlan(ifp, access_vlan);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void netlink_bridge_vlan_update(struct interface *ifp,
|
|
|
|
struct rtattr *af_spec)
|
|
|
|
{
|
|
|
|
struct rtattr *i;
|
|
|
|
int rem;
|
|
|
|
uint16_t vid_range_start = 0;
|
|
|
|
struct zebra_if *zif;
|
|
|
|
bitfield_t old_vlan_bitmap;
|
|
|
|
struct bridge_vlan_info *vinfo;
|
|
|
|
|
|
|
|
zif = (struct zebra_if *)ifp->info;
|
|
|
|
|
|
|
|
/* cache the old bitmap addrs */
|
|
|
|
old_vlan_bitmap = zif->vlan_bitmap;
|
|
|
|
/* create a new bitmap space for re-eval */
|
|
|
|
bf_init(zif->vlan_bitmap, IF_VLAN_BITMAP_MAX);
|
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
if (af_spec) {
|
|
|
|
for (i = RTA_DATA(af_spec), rem = RTA_PAYLOAD(af_spec);
|
|
|
|
RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
|
2020-03-28 01:32:46 +01:00
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
if (i->rta_type != IFLA_BRIDGE_VLAN_INFO)
|
|
|
|
continue;
|
2020-03-28 01:32:46 +01:00
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
vinfo = RTA_DATA(i);
|
2020-03-28 01:32:46 +01:00
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
|
|
|
|
vid_range_start = vinfo->vid;
|
|
|
|
continue;
|
|
|
|
}
|
2020-03-28 01:32:46 +01:00
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
if (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END))
|
|
|
|
vid_range_start = vinfo->vid;
|
2020-03-28 01:32:46 +01:00
|
|
|
|
2021-07-20 11:28:37 +02:00
|
|
|
zebra_vlan_bitmap_compute(ifp, vid_range_start,
|
|
|
|
vinfo->vid);
|
|
|
|
}
|
2020-03-28 01:32:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
zebra_vlan_mbr_re_eval(ifp, old_vlan_bitmap);
|
|
|
|
|
|
|
|
bf_free(old_vlan_bitmap);
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
static int netlink_bridge_interface(struct nlmsghdr *h, int len, ns_id_t ns_id,
|
|
|
|
int startup)
|
|
|
|
{
|
|
|
|
char *name = NULL;
|
|
|
|
struct ifinfomsg *ifi;
|
|
|
|
struct rtattr *tb[IFLA_MAX + 1];
|
|
|
|
struct interface *ifp;
|
2020-03-28 01:32:46 +01:00
|
|
|
struct zebra_if *zif;
|
|
|
|
struct rtattr *af_spec;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Fetch name and ifindex */
|
|
|
|
ifi = NLMSG_DATA(h);
|
|
|
|
netlink_parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
if (tb[IFLA_IFNAME] == NULL)
|
|
|
|
return -1;
|
|
|
|
name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* The interface should already be known, if not discard. */
|
|
|
|
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), ifi->ifi_index);
|
|
|
|
if (!ifp) {
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug("Cannot find bridge IF %s(%u)", name,
|
|
|
|
ifi->ifi_index);
|
2017-05-15 07:31:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* We are only interested in the access VLAN i.e., AF_SPEC */
|
2020-03-28 01:32:46 +01:00
|
|
|
af_spec = tb[IFLA_AF_SPEC];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-03-28 01:32:46 +01:00
|
|
|
if (IS_ZEBRA_IF_VXLAN(ifp))
|
|
|
|
return netlink_bridge_vxlan_update(ifp, af_spec);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-03-28 01:32:46 +01:00
|
|
|
/* build vlan bitmap associated with this interface if that
|
|
|
|
* device type is interested in the vlans
|
|
|
|
*/
|
|
|
|
zif = (struct zebra_if *)ifp->info;
|
|
|
|
if (bf_is_inited(zif->vlan_bitmap))
|
|
|
|
netlink_bridge_vlan_update(ifp, af_spec);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-02-15 23:56:50 +01:00
|
|
|
static bool is_if_protodown_reason_only_frr(uint32_t rc_bitfield)
|
2022-01-25 19:49:05 +01:00
|
|
|
{
|
|
|
|
/* This shouldn't be possible */
|
|
|
|
assert(frr_protodown_r_bit < 32);
|
|
|
|
return (rc_bitfield == (((uint32_t)1) << frr_protodown_r_bit));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process interface protodown dplane update.
|
|
|
|
*
|
|
|
|
* If the interface is an es bond member then it must follow EVPN's
|
|
|
|
* protodown setting.
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
*/
|
|
|
|
static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
|
2022-01-25 19:49:05 +01:00
|
|
|
struct rtattr **tb)
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
{
|
2022-01-25 19:49:05 +01:00
|
|
|
bool protodown;
|
|
|
|
bool old_protodown;
|
|
|
|
uint32_t rc_bitfield = 0;
|
|
|
|
struct rtattr *pd_reason_info[IFLA_MAX + 1];
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
protodown = !!*(uint8_t *)RTA_DATA(tb[IFLA_PROTO_DOWN]);
|
|
|
|
|
|
|
|
if (tb[IFLA_PROTO_DOWN_REASON]) {
|
|
|
|
netlink_parse_rtattr_nested(pd_reason_info, IFLA_INFO_MAX,
|
|
|
|
tb[IFLA_PROTO_DOWN_REASON]);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
if (pd_reason_info[IFLA_PROTO_DOWN_REASON_VALUE])
|
|
|
|
rc_bitfield = *(uint32_t *)RTA_DATA(
|
|
|
|
pd_reason_info[IFLA_PROTO_DOWN_REASON_VALUE]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set our reason code to note it wasn't us.
|
|
|
|
* If the reason we got from the kernel is ONLY frr though, don't
|
|
|
|
* set it.
|
|
|
|
*/
|
2022-02-16 00:21:18 +01:00
|
|
|
COND_FLAG(zif->protodown_rc, ZEBRA_PROTODOWN_EXTERNAL,
|
|
|
|
protodown && rc_bitfield &&
|
|
|
|
!is_if_protodown_reason_only_frr(rc_bitfield));
|
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
|
2022-01-25 20:44:25 +01:00
|
|
|
old_protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
|
2022-01-25 19:49:05 +01:00
|
|
|
if (protodown == old_protodown)
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("interface %s dplane change, protdown %s",
|
|
|
|
zif->ifp->name, protodown ? "on" : "off");
|
|
|
|
|
2022-02-16 00:21:18 +01:00
|
|
|
/* Set protodown, respectively */
|
|
|
|
COND_FLAG(zif->flags, ZIF_FLAG_PROTODOWN, protodown);
|
2022-01-25 19:49:05 +01:00
|
|
|
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (zebra_evpn_is_es_bond_member(zif->ifp)) {
|
2022-02-15 18:36:18 +01:00
|
|
|
/* Check it's not already being sent to the dplane first */
|
2022-02-16 00:53:01 +01:00
|
|
|
if (protodown &&
|
|
|
|
CHECK_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"bond mbr %s protodown on recv'd but already sent protodown on to the dplane",
|
|
|
|
zif->ifp->name);
|
2022-02-15 18:36:18 +01:00
|
|
|
return;
|
2022-02-16 00:53:01 +01:00
|
|
|
}
|
2022-02-15 18:36:18 +01:00
|
|
|
|
2022-02-16 00:53:01 +01:00
|
|
|
if (!protodown &&
|
|
|
|
CHECK_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"bond mbr %s protodown off recv'd but already sent protodown off to the dplane",
|
|
|
|
zif->ifp->name);
|
2022-02-15 18:36:18 +01:00
|
|
|
return;
|
2022-02-16 00:53:01 +01:00
|
|
|
}
|
2022-02-15 18:36:18 +01:00
|
|
|
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2022-02-16 00:53:01 +01:00
|
|
|
"bond mbr %s reinstate protodown %s in the dplane",
|
2022-01-25 19:49:05 +01:00
|
|
|
zif->ifp->name, old_protodown ? "on" : "off");
|
|
|
|
|
|
|
|
if (old_protodown)
|
2022-02-16 00:21:18 +01:00
|
|
|
SET_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
else
|
2022-02-16 00:21:18 +01:00
|
|
|
SET_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN);
|
2022-01-25 19:49:05 +01:00
|
|
|
|
|
|
|
dplane_intf_update(zif->ifp);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-05 16:13:55 +02:00
|
|
|
static uint8_t netlink_parse_lacp_bypass(struct rtattr **linkinfo)
|
|
|
|
{
|
|
|
|
uint8_t bypass = 0;
|
|
|
|
struct rtattr *mbrinfo[IFLA_BOND_SLAVE_MAX + 1];
|
|
|
|
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(mbrinfo, IFLA_BOND_SLAVE_MAX,
|
|
|
|
linkinfo[IFLA_INFO_SLAVE_DATA]);
|
2020-08-05 16:13:55 +02:00
|
|
|
if (mbrinfo[IFLA_BOND_SLAVE_AD_RX_BYPASS])
|
|
|
|
bypass = *(uint8_t *)RTA_DATA(
|
|
|
|
mbrinfo[IFLA_BOND_SLAVE_AD_RX_BYPASS]);
|
|
|
|
|
|
|
|
return bypass;
|
|
|
|
}
|
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
/*
|
2022-01-31 22:12:01 +01:00
|
|
|
* Only called at startup to cleanup leftover protodown reasons we may
|
|
|
|
* have not cleaned up. We leave protodown set though.
|
2022-01-25 19:49:05 +01:00
|
|
|
*/
|
|
|
|
static void if_sweep_protodown(struct zebra_if *zif)
|
|
|
|
{
|
|
|
|
bool protodown;
|
|
|
|
|
2022-01-25 20:44:25 +01:00
|
|
|
protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
|
2022-01-25 19:49:05 +01:00
|
|
|
|
|
|
|
if (!protodown)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2022-01-31 22:12:01 +01:00
|
|
|
zlog_debug("interface %s sweeping protodown %s reason 0x%x",
|
|
|
|
zif->ifp->name, protodown ? "on" : "off",
|
|
|
|
zif->protodown_rc);
|
2022-01-25 19:49:05 +01:00
|
|
|
|
|
|
|
/* Only clear our reason codes, leave external if it was set */
|
2022-02-16 00:21:18 +01:00
|
|
|
UNSET_FLAG(zif->protodown_rc, ZEBRA_PROTODOWN_ALL);
|
2022-01-25 19:49:05 +01:00
|
|
|
dplane_intf_update(zif->ifp);
|
|
|
|
}
|
|
|
|
|
2018-05-23 15:37:06 +02:00
|
|
|
/*
|
|
|
|
* Called from interface_lookup_netlink(). This function is only used
|
|
|
|
* during bootstrap.
|
|
|
|
*/
|
|
|
|
static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
2016-10-17 21:39:55 +02:00
|
|
|
{
|
|
|
|
int len;
|
|
|
|
struct ifinfomsg *ifi;
|
|
|
|
struct rtattr *tb[IFLA_MAX + 1];
|
|
|
|
struct rtattr *linkinfo[IFLA_MAX + 1];
|
|
|
|
struct interface *ifp;
|
|
|
|
char *name = NULL;
|
|
|
|
char *kind = NULL;
|
2017-10-28 03:24:13 +02:00
|
|
|
char *desc = NULL;
|
2016-10-17 21:39:55 +02:00
|
|
|
char *slave_kind = NULL;
|
2019-08-13 18:29:40 +02:00
|
|
|
struct zebra_ns *zns = NULL;
|
2016-10-17 21:39:55 +02:00
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
2021-08-30 19:24:26 +02:00
|
|
|
enum zebra_iftype zif_type = ZEBRA_IF_OTHER;
|
2021-08-30 19:27:02 +02:00
|
|
|
enum zebra_slave_iftype zif_slave_type = ZEBRA_IF_SLAVE_NONE;
|
2017-05-15 07:31:08 +02:00
|
|
|
ifindex_t bridge_ifindex = IFINDEX_INTERNAL;
|
|
|
|
ifindex_t link_ifindex = IFINDEX_INTERNAL;
|
2018-11-10 21:54:43 +01:00
|
|
|
ifindex_t bond_ifindex = IFINDEX_INTERNAL;
|
2018-09-12 20:33:51 +02:00
|
|
|
struct zebra_if *zif;
|
2019-09-24 10:44:58 +02:00
|
|
|
ns_id_t link_nsid = ns_id;
|
2020-08-05 16:13:55 +02:00
|
|
|
uint8_t bypass = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-10-06 14:22:48 +02:00
|
|
|
frrtrace(3, frr_zebra, netlink_interface, h, ns_id, startup);
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
zns = zebra_ns_lookup(ns_id);
|
|
|
|
ifi = NLMSG_DATA(h);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type != RTM_NEWLINK)
|
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
2018-06-22 20:22:02 +02:00
|
|
|
if (len < 0) {
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_err(
|
|
|
|
"%s: Message received from netlink is of a broken size: %d %zu",
|
|
|
|
__func__, h->nlmsg_len,
|
|
|
|
(size_t)NLMSG_LENGTH(sizeof(struct ifinfomsg)));
|
2016-10-17 21:39:55 +02:00
|
|
|
return -1;
|
2018-06-22 20:22:02 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* We are interested in some AF_BRIDGE notifications. */
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ifi->ifi_family == AF_BRIDGE)
|
2017-05-15 07:31:08 +02:00
|
|
|
return netlink_bridge_interface(h, len, ns_id, startup);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Looking up interface name. */
|
2020-03-08 20:43:26 +01:00
|
|
|
memset(linkinfo, 0, sizeof(linkinfo));
|
2022-01-25 19:49:05 +01:00
|
|
|
netlink_parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(ifi), len,
|
|
|
|
NLA_F_NESTED);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
/* check for wireless messages to ignore */
|
|
|
|
if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: ignoring IFLA_WIRELESS message",
|
|
|
|
__func__);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tb[IFLA_IFNAME] == NULL)
|
|
|
|
return -1;
|
|
|
|
name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
|
|
|
|
|
2017-10-28 03:24:13 +02:00
|
|
|
if (tb[IFLA_IFALIAS])
|
|
|
|
desc = (char *)RTA_DATA(tb[IFLA_IFALIAS]);
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFLA_LINKINFO]) {
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(linkinfo, IFLA_INFO_MAX,
|
|
|
|
tb[IFLA_LINKINFO]);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
if (linkinfo[IFLA_INFO_KIND])
|
|
|
|
kind = RTA_DATA(linkinfo[IFLA_INFO_KIND]);
|
|
|
|
|
|
|
|
if (linkinfo[IFLA_INFO_SLAVE_KIND])
|
|
|
|
slave_kind = RTA_DATA(linkinfo[IFLA_INFO_SLAVE_KIND]);
|
|
|
|
|
2018-11-10 21:54:43 +01:00
|
|
|
if ((slave_kind != NULL) && strcmp(slave_kind, "bond") == 0)
|
|
|
|
netlink_determine_zebra_iftype("bond_slave", &zif_type);
|
|
|
|
else
|
|
|
|
netlink_determine_zebra_iftype(kind, &zif_type);
|
2017-05-15 07:31:08 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* If VRF, create the VRF structure itself. */
|
2018-01-22 09:42:53 +01:00
|
|
|
if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns()) {
|
2020-03-09 14:50:18 +01:00
|
|
|
netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name);
|
2017-05-15 07:31:08 +02:00
|
|
|
vrf_id = (vrf_id_t)ifi->ifi_index;
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFLA_MASTER]) {
|
2018-01-22 09:42:53 +01:00
|
|
|
if (slave_kind && (strcmp(slave_kind, "vrf") == 0)
|
|
|
|
&& !vrf_is_backend_netns()) {
|
2017-05-15 07:31:08 +02:00
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_VRF;
|
2018-03-27 21:13:34 +02:00
|
|
|
vrf_id = *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2017-05-15 07:31:08 +02:00
|
|
|
} else if (slave_kind && (strcmp(slave_kind, "bridge") == 0)) {
|
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE;
|
|
|
|
bridge_ifindex =
|
|
|
|
*(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2018-11-10 21:54:43 +01:00
|
|
|
} else if (slave_kind && (strcmp(slave_kind, "bond") == 0)) {
|
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_BOND;
|
|
|
|
bond_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2020-08-05 16:13:55 +02:00
|
|
|
bypass = netlink_parse_lacp_bypass(linkinfo);
|
2017-05-15 07:31:08 +02:00
|
|
|
} else
|
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_OTHER;
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
2018-01-22 09:42:53 +01:00
|
|
|
if (vrf_is_backend_netns())
|
|
|
|
vrf_id = (vrf_id_t)ns_id;
|
2019-06-24 01:46:39 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* If linking to another interface, note it. */
|
|
|
|
if (tb[IFLA_LINK])
|
|
|
|
link_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_LINK]);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-10-02 13:37:11 +02:00
|
|
|
if (tb[IFLA_LINK_NETNSID]) {
|
2019-09-24 10:44:58 +02:00
|
|
|
link_nsid = *(ns_id_t *)RTA_DATA(tb[IFLA_LINK_NETNSID]);
|
2019-10-02 13:37:11 +02:00
|
|
|
link_nsid = ns_id_get_absolute(ns_id, link_nsid);
|
|
|
|
}
|
2019-09-24 10:44:58 +02:00
|
|
|
|
2021-10-13 14:06:38 +02:00
|
|
|
ifp = if_get_by_name(name, vrf_id, NULL);
|
2019-08-13 18:29:40 +02:00
|
|
|
set_ifindex(ifp, ifi->ifi_index, zns); /* add it to ns struct */
|
2019-10-10 01:50:13 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
|
|
|
ifp->mtu6 = ifp->mtu = *(uint32_t *)RTA_DATA(tb[IFLA_MTU]);
|
|
|
|
ifp->metric = 0;
|
2019-08-06 11:15:05 +02:00
|
|
|
ifp->speed = get_iflink_speed(ifp, NULL);
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Set zebra interface type */
|
|
|
|
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
|
2018-03-06 21:50:32 +01:00
|
|
|
if (IS_ZEBRA_IF_VRF(ifp))
|
|
|
|
SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-09-17 18:13:15 +02:00
|
|
|
/*
|
|
|
|
* Just set the @link/lower-device ifindex. During nldump interfaces are
|
2018-09-12 20:33:51 +02:00
|
|
|
* not ordered in any fashion so we may end up getting upper devices
|
|
|
|
* before lower devices. We will setup the real linkage once the dump
|
2018-09-17 18:13:15 +02:00
|
|
|
* is complete.
|
|
|
|
*/
|
2018-09-12 20:33:51 +02:00
|
|
|
zif = (struct zebra_if *)ifp->info;
|
|
|
|
zif->link_ifindex = link_ifindex;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-04-28 01:55:21 +02:00
|
|
|
if (desc) {
|
2022-12-02 17:10:58 +01:00
|
|
|
XFREE(MTYPE_ZIF_DESC, zif->desc);
|
|
|
|
zif->desc = XSTRDUP(MTYPE_ZIF_DESC, desc);
|
2019-04-28 01:55:21 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Hardware type and address. */
|
|
|
|
ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type);
|
2021-05-04 14:50:00 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
netlink_interface_update_hw_addr(tb, ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if_add_update(ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Extract and save L2 interface information, take additional actions.
|
|
|
|
*/
|
2019-09-24 10:44:58 +02:00
|
|
|
netlink_interface_update_l2info(ifp, linkinfo[IFLA_INFO_DATA],
|
|
|
|
1, link_nsid);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (IS_ZEBRA_IF_BOND(ifp))
|
|
|
|
zebra_l2if_update_bond(ifp, true);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE_SLAVE(ifp))
|
2021-08-17 10:42:51 +02:00
|
|
|
zebra_l2if_update_bridge_slave(ifp, bridge_ifindex, ns_id,
|
|
|
|
ZEBRA_BRIDGE_NO_ACTION);
|
2018-11-10 21:54:43 +01:00
|
|
|
else if (IS_ZEBRA_IF_BOND_SLAVE(ifp))
|
2020-08-05 16:13:55 +02:00
|
|
|
zebra_l2if_update_bond_slave(ifp, bond_ifindex, !!bypass);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (tb[IFLA_PROTO_DOWN]) {
|
2022-01-25 19:49:05 +01:00
|
|
|
netlink_proc_dplane_if_protodown(zif, tb);
|
|
|
|
if_sweep_protodown(zif);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:28:32 +02:00
|
|
|
/* Request for specific interface or address information from the kernel */
|
2018-09-12 20:59:57 +02:00
|
|
|
static int netlink_request_intf_addr(struct nlsock *netlink_cmd, int family,
|
|
|
|
int type, uint32_t filter_mask)
|
2017-05-15 07:28:32 +02:00
|
|
|
{
|
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct ifinfomsg ifm;
|
|
|
|
char buf[256];
|
|
|
|
} req;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-10-06 14:34:35 +02:00
|
|
|
frrtrace(4, frr_zebra, netlink_request_intf_addr, netlink_cmd, family,
|
|
|
|
type, filter_mask);
|
|
|
|
|
2017-05-15 07:28:32 +02:00
|
|
|
/* Form the request, specifying filter (rtattr) if needed. */
|
|
|
|
memset(&req, 0, sizeof(req));
|
|
|
|
req.n.nlmsg_type = type;
|
2018-12-11 06:33:16 +01:00
|
|
|
req.n.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
|
2017-05-15 07:28:32 +02:00
|
|
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
|
|
|
req.ifm.ifi_family = family;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:28:32 +02:00
|
|
|
/* Include filter, if specified. */
|
|
|
|
if (filter_mask)
|
2020-06-08 23:37:26 +02:00
|
|
|
nl_attr_put32(&req.n, sizeof(req), IFLA_EXT_MASK, filter_mask);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-04-15 14:56:03 +02:00
|
|
|
return netlink_request(netlink_cmd, &req);
|
2017-05-15 07:28:32 +02:00
|
|
|
}
|
|
|
|
|
2021-03-11 15:33:41 +01:00
|
|
|
enum netlink_msg_status
|
|
|
|
netlink_put_gre_set_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx)
|
|
|
|
{
|
|
|
|
enum dplane_op_e op;
|
|
|
|
enum netlink_msg_status ret;
|
|
|
|
|
|
|
|
op = dplane_ctx_get_op(ctx);
|
|
|
|
assert(op == DPLANE_OP_GRE_SET);
|
|
|
|
|
|
|
|
ret = netlink_batch_add_msg(bth, ctx, netlink_gre_set_msg_encoder, false);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Interface lookup by netlink socket. */
|
|
|
|
int interface_lookup_netlink(struct zebra_ns *zns)
|
|
|
|
{
|
|
|
|
int ret;
|
2018-09-12 20:59:57 +02:00
|
|
|
struct zebra_dplane_info dp_info;
|
|
|
|
struct nlsock *netlink_cmd = &zns->netlink_cmd;
|
|
|
|
|
|
|
|
/* Capture key info from ns struct */
|
|
|
|
zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Get interface information. */
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_request_intf_addr(netlink_cmd, AF_PACKET, RTM_GETLINK, 0);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0,
|
2021-10-05 02:26:38 +02:00
|
|
|
true);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Get interface information - for bridge interfaces. */
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_request_intf_addr(netlink_cmd, AF_BRIDGE, RTM_GETLINK,
|
2017-05-15 07:31:08 +02:00
|
|
|
RTEXT_FILTER_BRVLAN);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0,
|
2021-10-05 02:26:38 +02:00
|
|
|
true);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-10-04 14:51:38 +02:00
|
|
|
/*
|
|
|
|
* So netlink_tunneldump_read will initiate a request
|
|
|
|
* per tunnel to get data. If we are on a kernel that
|
|
|
|
* does not support this then we will get X error messages
|
|
|
|
* (one per tunnel request )back which netlink_parse_info will
|
|
|
|
* stop after the first one. So we need to read equivalent
|
|
|
|
* error messages per tunnel then we can continue.
|
|
|
|
* if we do not gather all the read failures then
|
|
|
|
* later requests will not work right.
|
|
|
|
*/
|
2022-01-25 19:25:38 +01:00
|
|
|
ret = netlink_tunneldump_read(zns);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2018-09-12 20:33:51 +02:00
|
|
|
/* fixup linkages */
|
2021-04-29 12:02:47 +02:00
|
|
|
zebra_if_update_all_links(zns);
|
2019-02-15 18:28:56 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* interface_addr_lookup_netlink() - Look up interface addresses
|
|
|
|
*
|
|
|
|
* @zns: Zebra netlink socket
|
|
|
|
* Return: Result status
|
|
|
|
*/
|
|
|
|
static int interface_addr_lookup_netlink(struct zebra_ns *zns)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct zebra_dplane_info dp_info;
|
|
|
|
struct nlsock *netlink_cmd = &zns->netlink_cmd;
|
|
|
|
|
|
|
|
/* Capture key info from ns struct */
|
|
|
|
zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/);
|
2018-09-12 20:33:51 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Get IPv4 address of the interfaces. */
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_request_intf_addr(netlink_cmd, AF_INET, RTM_GETADDR, 0);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_parse_info(netlink_interface_addr, netlink_cmd, &dp_info,
|
2021-10-05 02:26:38 +02:00
|
|
|
0, true);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Get IPv6 address of the interfaces. */
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_request_intf_addr(netlink_cmd, AF_INET6, RTM_GETADDR, 0);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2018-09-12 20:59:57 +02:00
|
|
|
ret = netlink_parse_info(netlink_interface_addr, netlink_cmd, &dp_info,
|
2021-10-05 02:26:38 +02:00
|
|
|
0, true);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-06-13 14:59:32 +02:00
|
|
|
int kernel_interface_set_master(struct interface *master,
|
|
|
|
struct interface *slave)
|
|
|
|
{
|
|
|
|
struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT);
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct ifinfomsg ifa;
|
|
|
|
char buf[NL_PKT_BUF_SIZE];
|
|
|
|
} req;
|
|
|
|
|
2020-03-08 20:43:26 +01:00
|
|
|
memset(&req, 0, sizeof(req));
|
2017-06-13 14:59:32 +02:00
|
|
|
|
|
|
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
|
|
|
req.n.nlmsg_flags = NLM_F_REQUEST;
|
|
|
|
req.n.nlmsg_type = RTM_SETLINK;
|
|
|
|
req.n.nlmsg_pid = zns->netlink_cmd.snl.nl_pid;
|
|
|
|
|
|
|
|
req.ifa.ifi_index = slave->ifindex;
|
|
|
|
|
2020-06-13 13:31:13 +02:00
|
|
|
nl_attr_put32(&req.n, sizeof(req), IFLA_MASTER, master->ifindex);
|
|
|
|
nl_attr_put32(&req.n, sizeof(req), IFLA_LINK, slave->ifindex);
|
2017-06-13 14:59:32 +02:00
|
|
|
|
|
|
|
return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
|
2021-10-05 02:26:38 +02:00
|
|
|
false);
|
2017-06-13 14:59:32 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Interface address modification. */
|
2020-07-15 15:14:08 +02:00
|
|
|
static ssize_t netlink_address_msg_encoder(struct zebra_dplane_ctx *ctx,
|
|
|
|
void *buf, size_t buflen)
|
2016-10-17 21:39:55 +02:00
|
|
|
{
|
|
|
|
int bytelen;
|
2019-01-16 19:40:31 +01:00
|
|
|
const struct prefix *p;
|
|
|
|
int cmd;
|
|
|
|
const char *label;
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct ifaddrmsg ifa;
|
2020-07-15 15:14:08 +02:00
|
|
|
char buf[0];
|
|
|
|
} *req = buf;
|
|
|
|
|
|
|
|
if (buflen < sizeof(*req))
|
|
|
|
return 0;
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
p = dplane_ctx_get_intf_addr(ctx);
|
2020-07-15 15:14:08 +02:00
|
|
|
memset(req, 0, sizeof(*req));
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
bytelen = (p->family == AF_INET ? 4 : 16);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
|
|
|
|
req->n.nlmsg_flags = NLM_F_REQUEST;
|
2017-06-12 19:38:51 +02:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
if (dplane_ctx_get_op(ctx) == DPLANE_OP_ADDR_INSTALL)
|
|
|
|
cmd = RTM_NEWADDR;
|
|
|
|
else
|
|
|
|
cmd = RTM_DELADDR;
|
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
req->n.nlmsg_type = cmd;
|
|
|
|
req->ifa.ifa_family = p->family;
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
req->ifa.ifa_index = dplane_ctx_get_ifindex(ctx);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
if (!nl_attr_put(&req->n, buflen, IFA_LOCAL, &p->u.prefix, bytelen))
|
|
|
|
return 0;
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
if (p->family == AF_INET) {
|
|
|
|
if (dplane_ctx_intf_is_connected(ctx)) {
|
|
|
|
p = dplane_ctx_get_intf_dest(ctx);
|
2020-07-15 15:14:08 +02:00
|
|
|
if (!nl_attr_put(&req->n, buflen, IFA_ADDRESS,
|
|
|
|
&p->u.prefix, bytelen))
|
|
|
|
return 0;
|
2019-08-10 11:52:03 +02:00
|
|
|
} else if (cmd == RTM_NEWADDR) {
|
|
|
|
struct in_addr broad = {
|
|
|
|
.s_addr = ipv4_broadcast_addr(p->u.prefix4.s_addr,
|
|
|
|
p->prefixlen)
|
|
|
|
};
|
2020-07-15 15:14:08 +02:00
|
|
|
if (!nl_attr_put(&req->n, buflen, IFA_BROADCAST, &broad,
|
|
|
|
bytelen))
|
|
|
|
return 0;
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
/* p is now either address or destination/bcast addr */
|
2020-07-15 15:14:08 +02:00
|
|
|
req->ifa.ifa_prefixlen = p->prefixlen;
|
2010-01-20 18:27:16 +01:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
if (dplane_ctx_intf_is_secondary(ctx))
|
2020-07-15 15:14:08 +02:00
|
|
|
SET_FLAG(req->ifa.ifa_flags, IFA_F_SECONDARY);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2019-01-16 19:40:31 +01:00
|
|
|
if (dplane_ctx_intf_has_label(ctx)) {
|
|
|
|
label = dplane_ctx_get_intf_label(ctx);
|
2020-07-15 15:14:08 +02:00
|
|
|
if (!nl_attr_put(&req->n, buflen, IFA_LABEL, label,
|
|
|
|
strlen(label) + 1))
|
|
|
|
return 0;
|
2019-01-16 19:40:31 +01:00
|
|
|
}
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
return NLMSG_ALIGN(req->n.nlmsg_len);
|
2017-12-11 15:21:04 +01:00
|
|
|
}
|
|
|
|
|
2020-07-15 15:14:08 +02:00
|
|
|
enum netlink_msg_status
|
|
|
|
netlink_put_address_update_msg(struct nl_batch *bth,
|
|
|
|
struct zebra_dplane_ctx *ctx)
|
|
|
|
{
|
|
|
|
return netlink_batch_add_msg(bth, ctx, netlink_address_msg_encoder,
|
|
|
|
false);
|
2017-12-11 15:21:04 +01:00
|
|
|
}
|
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
static ssize_t netlink_intf_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
|
|
|
|
size_t buflen)
|
|
|
|
{
|
|
|
|
enum dplane_op_e op;
|
|
|
|
int cmd = 0;
|
|
|
|
|
|
|
|
op = dplane_ctx_get_op(ctx);
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case DPLANE_OP_INTF_UPDATE:
|
|
|
|
cmd = RTM_SETLINK;
|
|
|
|
break;
|
|
|
|
case DPLANE_OP_INTF_INSTALL:
|
|
|
|
cmd = RTM_NEWLINK;
|
|
|
|
break;
|
|
|
|
case DPLANE_OP_INTF_DELETE:
|
|
|
|
cmd = RTM_DELLINK;
|
|
|
|
break;
|
2023-01-30 16:05:58 +01:00
|
|
|
case DPLANE_OP_NONE:
|
|
|
|
case DPLANE_OP_ROUTE_INSTALL:
|
|
|
|
case DPLANE_OP_ROUTE_UPDATE:
|
|
|
|
case DPLANE_OP_ROUTE_DELETE:
|
|
|
|
case DPLANE_OP_ROUTE_NOTIFY:
|
|
|
|
case DPLANE_OP_NH_INSTALL:
|
|
|
|
case DPLANE_OP_NH_UPDATE:
|
|
|
|
case DPLANE_OP_NH_DELETE:
|
|
|
|
case DPLANE_OP_LSP_INSTALL:
|
|
|
|
case DPLANE_OP_LSP_DELETE:
|
|
|
|
case DPLANE_OP_LSP_NOTIFY:
|
|
|
|
case DPLANE_OP_LSP_UPDATE:
|
|
|
|
case DPLANE_OP_PW_INSTALL:
|
|
|
|
case DPLANE_OP_PW_UNINSTALL:
|
|
|
|
case DPLANE_OP_SYS_ROUTE_ADD:
|
|
|
|
case DPLANE_OP_SYS_ROUTE_DELETE:
|
|
|
|
case DPLANE_OP_ADDR_INSTALL:
|
|
|
|
case DPLANE_OP_ADDR_UNINSTALL:
|
|
|
|
case DPLANE_OP_MAC_INSTALL:
|
|
|
|
case DPLANE_OP_MAC_DELETE:
|
|
|
|
case DPLANE_OP_NEIGH_INSTALL:
|
|
|
|
case DPLANE_OP_NEIGH_UPDATE:
|
|
|
|
case DPLANE_OP_NEIGH_DELETE:
|
|
|
|
case DPLANE_OP_NEIGH_DISCOVER:
|
|
|
|
case DPLANE_OP_VTEP_ADD:
|
|
|
|
case DPLANE_OP_VTEP_DELETE:
|
|
|
|
case DPLANE_OP_RULE_ADD:
|
|
|
|
case DPLANE_OP_RULE_DELETE:
|
|
|
|
case DPLANE_OP_RULE_UPDATE:
|
|
|
|
case DPLANE_OP_BR_PORT_UPDATE:
|
|
|
|
case DPLANE_OP_IPTABLE_ADD:
|
|
|
|
case DPLANE_OP_IPTABLE_DELETE:
|
|
|
|
case DPLANE_OP_IPSET_ADD:
|
|
|
|
case DPLANE_OP_IPSET_ENTRY_ADD:
|
|
|
|
case DPLANE_OP_IPSET_ENTRY_DELETE:
|
|
|
|
case DPLANE_OP_IPSET_DELETE:
|
|
|
|
case DPLANE_OP_NEIGH_IP_INSTALL:
|
|
|
|
case DPLANE_OP_NEIGH_IP_DELETE:
|
|
|
|
case DPLANE_OP_NEIGH_TABLE_UPDATE:
|
|
|
|
case DPLANE_OP_GRE_SET:
|
|
|
|
case DPLANE_OP_INTF_ADDR_ADD:
|
|
|
|
case DPLANE_OP_INTF_ADDR_DEL:
|
|
|
|
case DPLANE_OP_INTF_NETCONFIG:
|
|
|
|
case DPLANE_OP_TC_QDISC_INSTALL:
|
|
|
|
case DPLANE_OP_TC_QDISC_UNINSTALL:
|
|
|
|
case DPLANE_OP_TC_CLASS_ADD:
|
|
|
|
case DPLANE_OP_TC_CLASS_DELETE:
|
|
|
|
case DPLANE_OP_TC_CLASS_UPDATE:
|
|
|
|
case DPLANE_OP_TC_FILTER_ADD:
|
|
|
|
case DPLANE_OP_TC_FILTER_DELETE:
|
|
|
|
case DPLANE_OP_TC_FILTER_UPDATE:
|
2022-01-26 06:07:57 +01:00
|
|
|
flog_err(
|
|
|
|
EC_ZEBRA_NHG_FIB_UPDATE,
|
|
|
|
"Context received for kernel interface update with incorrect OP code (%u)",
|
|
|
|
op);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return netlink_intf_msg_encode(cmd, ctx, buf, buflen);
|
|
|
|
}
|
|
|
|
|
|
|
|
enum netlink_msg_status
|
|
|
|
netlink_put_intf_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx)
|
|
|
|
{
|
|
|
|
return netlink_batch_add_msg(bth, ctx, netlink_intf_msg_encoder, false);
|
|
|
|
}
|
|
|
|
|
2018-05-23 15:37:06 +02:00
|
|
|
int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
2016-10-17 21:39:55 +02:00
|
|
|
{
|
|
|
|
int len;
|
|
|
|
struct ifaddrmsg *ifa;
|
|
|
|
struct rtattr *tb[IFA_MAX + 1];
|
|
|
|
struct interface *ifp;
|
|
|
|
void *addr;
|
|
|
|
void *broad;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t flags = 0;
|
2016-10-17 21:39:55 +02:00
|
|
|
char *label = NULL;
|
|
|
|
struct zebra_ns *zns;
|
zebra: set connected route metric based on the devaddr metric
MACVLAN devices are typically used for applications such as VRR/VRRP that
require a second MAC address (virtual). These devices have a corresponding
SVI/VLAN device -
root@TORC11:~# ip addr show vlan1002
39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::2/64 scope global
valid_lft forever preferred_lft forever
root@TORC11:~# ip addr show vlan1002-v0
40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::a/64 metric 1024 scope global
valid_lft forever preferred_lft forever
root@TORC11:~#
The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via
the SVI. To acheive that functionality the macvlan network's metric
is set to a higher value.
Zebra currently ignores the devaddr metric sent by the kernel and hardcodes
it to 0. This commit eliminates that hardcoding. If the devaddr metric
is available (METRIC_MAX) it is used for setting up the connected route
otherwise we fallback to the dev/interface metric.
Setting the macvlan metric to a higher value ensures that zebra will always
select the connected route on the SVI (and subsequently use it for next hop
resolution etc.) -
root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64"
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 1024, vrf vrf1
Last update 11:30:56 ago
* directly connected, vlan1002-v0
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 0, vrf vrf1, best
Last update 11:30:56 ago
* directly connected, vlan1002
root@TORC11:~#
Ticket: CM-23511
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-15 00:45:33 +01:00
|
|
|
uint32_t metric = METRIC_MAX;
|
2019-01-28 22:14:03 +01:00
|
|
|
uint32_t kernel_flags = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-10-06 14:53:02 +02:00
|
|
|
frrtrace(3, frr_zebra, netlink_interface_addr, h, ns_id, startup);
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
zns = zebra_ns_lookup(ns_id);
|
|
|
|
ifa = NLMSG_DATA(h);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-07-19 23:29:16 +02:00
|
|
|
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
|
2018-08-16 22:10:32 +02:00
|
|
|
flog_warn(
|
2018-09-13 21:21:05 +02:00
|
|
|
EC_ZEBRA_UNKNOWN_FAMILY,
|
2018-09-14 23:48:51 +02:00
|
|
|
"Invalid address family: %u received from kernel interface addr change: %s",
|
|
|
|
ifa->ifa_family, nl_msg_type_to_str(h->nlmsg_type));
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
2018-07-19 23:29:16 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR)
|
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
|
2018-06-22 20:22:02 +02:00
|
|
|
if (len < 0) {
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_err(
|
|
|
|
"%s: Message received from netlink is of a broken size: %d %zu",
|
|
|
|
__func__, h->nlmsg_len,
|
|
|
|
(size_t)NLMSG_LENGTH(sizeof(struct ifaddrmsg)));
|
2016-10-17 21:39:55 +02:00
|
|
|
return -1;
|
2018-06-22 20:22:02 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
netlink_parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index);
|
|
|
|
if (ifp == NULL) {
|
2021-09-22 22:02:40 +02:00
|
|
|
if (startup) {
|
|
|
|
/* During startup, failure to lookup the referenced
|
|
|
|
* interface should not be an error, so we have
|
|
|
|
* downgraded this condition to warning, and we permit
|
|
|
|
* the startup interface state retrieval to continue.
|
|
|
|
*/
|
|
|
|
flog_warn(EC_LIB_INTERFACE,
|
|
|
|
"%s: can't find interface by index %d",
|
|
|
|
__func__, ifa->ifa_index);
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
flog_err(EC_LIB_INTERFACE,
|
|
|
|
"%s: can't find interface by index %d",
|
|
|
|
__func__, ifa->ifa_index);
|
|
|
|
return -1;
|
|
|
|
}
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-28 22:14:03 +01:00
|
|
|
/* Flags passed through */
|
|
|
|
if (tb[IFA_FLAGS])
|
|
|
|
kernel_flags = *(int *)RTA_DATA(tb[IFA_FLAGS]);
|
|
|
|
else
|
|
|
|
kernel_flags = ifa->ifa_flags;
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL) /* remove this line to see initial ifcfg */
|
|
|
|
{
|
|
|
|
char buf[BUFSIZ];
|
2022-09-13 08:28:35 +02:00
|
|
|
zlog_debug("%s %s %s flags 0x%x:", __func__,
|
2016-10-17 21:39:55 +02:00
|
|
|
nl_msg_type_to_str(h->nlmsg_type), ifp->name,
|
2019-01-28 22:14:03 +01:00
|
|
|
kernel_flags);
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFA_LOCAL])
|
|
|
|
zlog_debug(" IFA_LOCAL %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_LOCAL]), buf,
|
|
|
|
BUFSIZ),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_ADDRESS])
|
|
|
|
zlog_debug(" IFA_ADDRESS %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_ADDRESS]), buf,
|
|
|
|
BUFSIZ),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_BROADCAST])
|
|
|
|
zlog_debug(" IFA_BROADCAST %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_BROADCAST]), buf,
|
|
|
|
BUFSIZ),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_LABEL] && strcmp(ifp->name, RTA_DATA(tb[IFA_LABEL])))
|
|
|
|
zlog_debug(" IFA_LABEL %s",
|
|
|
|
(char *)RTA_DATA(tb[IFA_LABEL]));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFA_CACHEINFO]) {
|
|
|
|
struct ifa_cacheinfo *ci = RTA_DATA(tb[IFA_CACHEINFO]);
|
|
|
|
zlog_debug(" IFA_CACHEINFO pref %d, valid %d",
|
|
|
|
ci->ifa_prefered, ci->ifa_valid);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* logic copied from iproute2/ip/ipaddress.c:print_addrinfo() */
|
|
|
|
if (tb[IFA_LOCAL] == NULL)
|
|
|
|
tb[IFA_LOCAL] = tb[IFA_ADDRESS];
|
|
|
|
if (tb[IFA_ADDRESS] == NULL)
|
|
|
|
tb[IFA_ADDRESS] = tb[IFA_LOCAL];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* local interface address */
|
|
|
|
addr = (tb[IFA_LOCAL] ? RTA_DATA(tb[IFA_LOCAL]) : NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* is there a peer address? */
|
|
|
|
if (tb[IFA_ADDRESS]
|
|
|
|
&& memcmp(RTA_DATA(tb[IFA_ADDRESS]), RTA_DATA(tb[IFA_LOCAL]),
|
|
|
|
RTA_PAYLOAD(tb[IFA_ADDRESS]))) {
|
|
|
|
broad = RTA_DATA(tb[IFA_ADDRESS]);
|
|
|
|
SET_FLAG(flags, ZEBRA_IFA_PEER);
|
|
|
|
} else
|
|
|
|
/* seeking a broadcast address */
|
|
|
|
broad = (tb[IFA_BROADCAST] ? RTA_DATA(tb[IFA_BROADCAST])
|
|
|
|
: NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* addr is primary key, SOL if we don't have one */
|
|
|
|
if (addr == NULL) {
|
2019-08-23 14:28:43 +02:00
|
|
|
zlog_debug("%s: Local Interface Address is NULL for %s",
|
|
|
|
__func__, ifp->name);
|
2016-10-17 21:39:55 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Flags. */
|
2019-01-28 22:14:03 +01:00
|
|
|
if (kernel_flags & IFA_F_SECONDARY)
|
2016-10-17 21:39:55 +02:00
|
|
|
SET_FLAG(flags, ZEBRA_IFA_SECONDARY);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Label */
|
|
|
|
if (tb[IFA_LABEL])
|
|
|
|
label = (char *)RTA_DATA(tb[IFA_LABEL]);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-07-02 18:50:20 +02:00
|
|
|
if (label && strcmp(ifp->name, label) == 0)
|
2016-10-17 21:39:55 +02:00
|
|
|
label = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: set connected route metric based on the devaddr metric
MACVLAN devices are typically used for applications such as VRR/VRRP that
require a second MAC address (virtual). These devices have a corresponding
SVI/VLAN device -
root@TORC11:~# ip addr show vlan1002
39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::2/64 scope global
valid_lft forever preferred_lft forever
root@TORC11:~# ip addr show vlan1002-v0
40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::a/64 metric 1024 scope global
valid_lft forever preferred_lft forever
root@TORC11:~#
The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via
the SVI. To acheive that functionality the macvlan network's metric
is set to a higher value.
Zebra currently ignores the devaddr metric sent by the kernel and hardcodes
it to 0. This commit eliminates that hardcoding. If the devaddr metric
is available (METRIC_MAX) it is used for setting up the connected route
otherwise we fallback to the dev/interface metric.
Setting the macvlan metric to a higher value ensures that zebra will always
select the connected route on the SVI (and subsequently use it for next hop
resolution etc.) -
root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64"
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 1024, vrf vrf1
Last update 11:30:56 ago
* directly connected, vlan1002-v0
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 0, vrf vrf1, best
Last update 11:30:56 ago
* directly connected, vlan1002
root@TORC11:~#
Ticket: CM-23511
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-15 00:45:33 +01:00
|
|
|
if (tb[IFA_RT_PRIORITY])
|
|
|
|
metric = *(uint32_t *)RTA_DATA(tb[IFA_RT_PRIORITY]);
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Register interface address to the interface. */
|
|
|
|
if (ifa->ifa_family == AF_INET) {
|
2018-07-21 05:20:28 +02:00
|
|
|
if (ifa->ifa_prefixlen > IPV4_MAX_BITLEN) {
|
2018-07-26 21:10:53 +02:00
|
|
|
zlog_err(
|
2018-09-14 23:48:51 +02:00
|
|
|
"Invalid prefix length: %u received from kernel interface addr change: %s",
|
|
|
|
ifa->ifa_prefixlen,
|
|
|
|
nl_msg_type_to_str(h->nlmsg_type));
|
2018-07-26 21:10:53 +02:00
|
|
|
return -1;
|
2018-07-21 05:20:28 +02:00
|
|
|
}
|
2020-06-01 14:59:06 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type == RTM_NEWADDR)
|
|
|
|
connected_add_ipv4(ifp, flags, (struct in_addr *)addr,
|
|
|
|
ifa->ifa_prefixlen,
|
zebra: set connected route metric based on the devaddr metric
MACVLAN devices are typically used for applications such as VRR/VRRP that
require a second MAC address (virtual). These devices have a corresponding
SVI/VLAN device -
root@TORC11:~# ip addr show vlan1002
39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::2/64 scope global
valid_lft forever preferred_lft forever
root@TORC11:~# ip addr show vlan1002-v0
40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::a/64 metric 1024 scope global
valid_lft forever preferred_lft forever
root@TORC11:~#
The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via
the SVI. To acheive that functionality the macvlan network's metric
is set to a higher value.
Zebra currently ignores the devaddr metric sent by the kernel and hardcodes
it to 0. This commit eliminates that hardcoding. If the devaddr metric
is available (METRIC_MAX) it is used for setting up the connected route
otherwise we fallback to the dev/interface metric.
Setting the macvlan metric to a higher value ensures that zebra will always
select the connected route on the SVI (and subsequently use it for next hop
resolution etc.) -
root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64"
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 1024, vrf vrf1
Last update 11:30:56 ago
* directly connected, vlan1002-v0
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 0, vrf vrf1, best
Last update 11:30:56 ago
* directly connected, vlan1002
root@TORC11:~#
Ticket: CM-23511
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-15 00:45:33 +01:00
|
|
|
(struct in_addr *)broad, label,
|
|
|
|
metric);
|
2020-06-01 14:59:06 +02:00
|
|
|
else if (CHECK_FLAG(flags, ZEBRA_IFA_PEER)) {
|
|
|
|
/* Delete with a peer address */
|
|
|
|
connected_delete_ipv4(
|
|
|
|
ifp, flags, (struct in_addr *)addr,
|
|
|
|
ifa->ifa_prefixlen, broad);
|
|
|
|
} else
|
2016-10-17 21:39:55 +02:00
|
|
|
connected_delete_ipv4(
|
|
|
|
ifp, flags, (struct in_addr *)addr,
|
2019-08-13 16:29:09 +02:00
|
|
|
ifa->ifa_prefixlen, NULL);
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
2020-06-01 14:59:06 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ifa->ifa_family == AF_INET6) {
|
2018-07-21 05:20:28 +02:00
|
|
|
if (ifa->ifa_prefixlen > IPV6_MAX_BITLEN) {
|
2018-07-26 21:10:53 +02:00
|
|
|
zlog_err(
|
2018-09-14 23:48:51 +02:00
|
|
|
"Invalid prefix length: %u received from kernel interface addr change: %s",
|
|
|
|
ifa->ifa_prefixlen,
|
|
|
|
nl_msg_type_to_str(h->nlmsg_type));
|
2018-07-26 21:10:53 +02:00
|
|
|
return -1;
|
2018-07-21 05:20:28 +02:00
|
|
|
}
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type == RTM_NEWADDR) {
|
|
|
|
/* Only consider valid addresses; we'll not get a
|
|
|
|
* notification from
|
|
|
|
* the kernel till IPv6 DAD has completed, but at init
|
|
|
|
* time, Quagga
|
|
|
|
* does query for and will receive all addresses.
|
|
|
|
*/
|
2019-01-28 22:14:03 +01:00
|
|
|
if (!(kernel_flags
|
2016-10-17 21:39:55 +02:00
|
|
|
& (IFA_F_DADFAILED | IFA_F_TENTATIVE)))
|
2017-08-30 17:23:01 +02:00
|
|
|
connected_add_ipv6(ifp, flags,
|
|
|
|
(struct in6_addr *)addr,
|
2018-04-15 16:57:19 +02:00
|
|
|
(struct in6_addr *)broad,
|
zebra: set connected route metric based on the devaddr metric
MACVLAN devices are typically used for applications such as VRR/VRRP that
require a second MAC address (virtual). These devices have a corresponding
SVI/VLAN device -
root@TORC11:~# ip addr show vlan1002
39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::2/64 scope global
valid_lft forever preferred_lft forever
root@TORC11:~# ip addr show vlan1002-v0
40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff
inet6 2001:aa:1::a/64 metric 1024 scope global
valid_lft forever preferred_lft forever
root@TORC11:~#
The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via
the SVI. To acheive that functionality the macvlan network's metric
is set to a higher value.
Zebra currently ignores the devaddr metric sent by the kernel and hardcodes
it to 0. This commit eliminates that hardcoding. If the devaddr metric
is available (METRIC_MAX) it is used for setting up the connected route
otherwise we fallback to the dev/interface metric.
Setting the macvlan metric to a higher value ensures that zebra will always
select the connected route on the SVI (and subsequently use it for next hop
resolution etc.) -
root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64"
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 1024, vrf vrf1
Last update 11:30:56 ago
* directly connected, vlan1002-v0
Routing entry for 2001:aa:1::/64
Known via "connected", distance 0, metric 0, vrf vrf1, best
Last update 11:30:56 ago
* directly connected, vlan1002
root@TORC11:~#
Ticket: CM-23511
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-15 00:45:33 +01:00
|
|
|
ifa->ifa_prefixlen, label,
|
|
|
|
metric);
|
2017-07-17 14:03:14 +02:00
|
|
|
} else
|
2016-10-17 21:39:55 +02:00
|
|
|
connected_delete_ipv6(ifp, (struct in6_addr *)addr,
|
2019-08-13 16:29:09 +02:00
|
|
|
NULL, ifa->ifa_prefixlen);
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-10-17 21:44:08 +02:00
|
|
|
/*
|
|
|
|
* Linux kernel does not send route delete on interface down/addr del
|
|
|
|
* so we have to re-process routes it owns (i.e. kernel routes)
|
|
|
|
*/
|
|
|
|
if (h->nlmsg_type != RTM_NEWADDR)
|
|
|
|
rib_update(RIB_UPDATE_KERNEL);
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-13 22:59:46 +02:00
|
|
|
/*
|
|
|
|
* Parse and validate an incoming interface address change message,
|
|
|
|
* generating a dplane context object.
|
|
|
|
* This runs in the dplane pthread; the context is enqueued to the
|
|
|
|
* main pthread for processing.
|
|
|
|
*/
|
|
|
|
int netlink_interface_addr_dplane(struct nlmsghdr *h, ns_id_t ns_id,
|
|
|
|
int startup /*ignored*/)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
struct ifaddrmsg *ifa;
|
|
|
|
struct rtattr *tb[IFA_MAX + 1];
|
|
|
|
void *addr;
|
|
|
|
void *broad;
|
|
|
|
char *label = NULL;
|
|
|
|
uint32_t metric = METRIC_MAX;
|
|
|
|
uint32_t kernel_flags = 0;
|
|
|
|
struct zebra_dplane_ctx *ctx;
|
|
|
|
struct prefix p;
|
|
|
|
|
|
|
|
ifa = NLMSG_DATA(h);
|
|
|
|
|
|
|
|
/* Validate message types */
|
|
|
|
if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: Invalid address family: %u",
|
|
|
|
__func__, nl_msg_type_to_str(h->nlmsg_type),
|
|
|
|
ifa->ifa_family);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
|
|
|
|
if (len < 0) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: netlink msg bad size: %d %zu",
|
|
|
|
__func__, nl_msg_type_to_str(h->nlmsg_type),
|
|
|
|
h->nlmsg_len,
|
|
|
|
(size_t)NLMSG_LENGTH(
|
|
|
|
sizeof(struct ifaddrmsg)));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
netlink_parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
|
|
|
|
|
|
|
|
/* Flags passed through */
|
|
|
|
if (tb[IFA_FLAGS])
|
|
|
|
kernel_flags = *(int *)RTA_DATA(tb[IFA_FLAGS]);
|
|
|
|
else
|
|
|
|
kernel_flags = ifa->ifa_flags;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL) { /* remove this line to see initial ifcfg */
|
|
|
|
char buf[PREFIX_STRLEN];
|
|
|
|
|
|
|
|
zlog_debug("%s: %s nsid %u ifindex %u flags 0x%x:", __func__,
|
|
|
|
nl_msg_type_to_str(h->nlmsg_type), ns_id,
|
|
|
|
ifa->ifa_index, kernel_flags);
|
|
|
|
if (tb[IFA_LOCAL])
|
|
|
|
zlog_debug(" IFA_LOCAL %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_LOCAL]), buf,
|
|
|
|
sizeof(buf)),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_ADDRESS])
|
|
|
|
zlog_debug(" IFA_ADDRESS %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_ADDRESS]), buf,
|
|
|
|
sizeof(buf)),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_BROADCAST])
|
|
|
|
zlog_debug(" IFA_BROADCAST %s/%d",
|
|
|
|
inet_ntop(ifa->ifa_family,
|
|
|
|
RTA_DATA(tb[IFA_BROADCAST]), buf,
|
|
|
|
sizeof(buf)),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
if (tb[IFA_LABEL])
|
|
|
|
zlog_debug(" IFA_LABEL %s",
|
|
|
|
(const char *)RTA_DATA(tb[IFA_LABEL]));
|
|
|
|
|
|
|
|
if (tb[IFA_CACHEINFO]) {
|
|
|
|
struct ifa_cacheinfo *ci = RTA_DATA(tb[IFA_CACHEINFO]);
|
|
|
|
|
|
|
|
zlog_debug(" IFA_CACHEINFO pref %d, valid %d",
|
|
|
|
ci->ifa_prefered, ci->ifa_valid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate prefix length */
|
|
|
|
|
|
|
|
if (ifa->ifa_family == AF_INET
|
|
|
|
&& ifa->ifa_prefixlen > IPV4_MAX_BITLEN) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: Invalid prefix length: %u",
|
|
|
|
__func__, nl_msg_type_to_str(h->nlmsg_type),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ifa->ifa_family == AF_INET6) {
|
|
|
|
if (ifa->ifa_prefixlen > IPV6_MAX_BITLEN) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: Invalid prefix length: %u",
|
|
|
|
__func__,
|
|
|
|
nl_msg_type_to_str(h->nlmsg_type),
|
|
|
|
ifa->ifa_prefixlen);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only consider valid addresses; we'll not get a kernel
|
|
|
|
* notification till IPv6 DAD has completed, but at init
|
|
|
|
* time, FRR does query for and will receive all addresses.
|
|
|
|
*/
|
|
|
|
if (h->nlmsg_type == RTM_NEWADDR
|
|
|
|
&& (kernel_flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: Invalid/tentative addr",
|
|
|
|
__func__,
|
|
|
|
nl_msg_type_to_str(h->nlmsg_type));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* logic copied from iproute2/ip/ipaddress.c:print_addrinfo() */
|
|
|
|
if (tb[IFA_LOCAL] == NULL)
|
|
|
|
tb[IFA_LOCAL] = tb[IFA_ADDRESS];
|
|
|
|
if (tb[IFA_ADDRESS] == NULL)
|
|
|
|
tb[IFA_ADDRESS] = tb[IFA_LOCAL];
|
|
|
|
|
|
|
|
/* local interface address */
|
|
|
|
addr = (tb[IFA_LOCAL] ? RTA_DATA(tb[IFA_LOCAL]) : NULL);
|
|
|
|
|
|
|
|
/* addr is primary key, SOL if we don't have one */
|
|
|
|
if (addr == NULL) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: %s: No local interface address",
|
|
|
|
__func__, nl_msg_type_to_str(h->nlmsg_type));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a context object, now that validation is done. */
|
|
|
|
ctx = dplane_ctx_alloc();
|
|
|
|
if (h->nlmsg_type == RTM_NEWADDR)
|
|
|
|
dplane_ctx_set_op(ctx, DPLANE_OP_INTF_ADDR_ADD);
|
|
|
|
else
|
|
|
|
dplane_ctx_set_op(ctx, DPLANE_OP_INTF_ADDR_DEL);
|
|
|
|
|
|
|
|
dplane_ctx_set_ifindex(ctx, ifa->ifa_index);
|
|
|
|
dplane_ctx_set_ns_id(ctx, ns_id);
|
|
|
|
|
|
|
|
/* Convert addr to prefix */
|
|
|
|
memset(&p, 0, sizeof(p));
|
|
|
|
p.family = ifa->ifa_family;
|
|
|
|
p.prefixlen = ifa->ifa_prefixlen;
|
|
|
|
if (p.family == AF_INET)
|
|
|
|
p.u.prefix4 = *(struct in_addr *)addr;
|
|
|
|
else
|
|
|
|
p.u.prefix6 = *(struct in6_addr *)addr;
|
|
|
|
|
|
|
|
dplane_ctx_set_intf_addr(ctx, &p);
|
|
|
|
|
|
|
|
/* is there a peer address? */
|
|
|
|
if (tb[IFA_ADDRESS]
|
|
|
|
&& memcmp(RTA_DATA(tb[IFA_ADDRESS]), RTA_DATA(tb[IFA_LOCAL]),
|
|
|
|
RTA_PAYLOAD(tb[IFA_ADDRESS]))) {
|
|
|
|
broad = RTA_DATA(tb[IFA_ADDRESS]);
|
|
|
|
dplane_ctx_intf_set_connected(ctx);
|
|
|
|
} else if (tb[IFA_BROADCAST]) {
|
|
|
|
/* seeking a broadcast address */
|
|
|
|
broad = RTA_DATA(tb[IFA_BROADCAST]);
|
|
|
|
dplane_ctx_intf_set_broadcast(ctx);
|
|
|
|
} else
|
|
|
|
broad = NULL;
|
|
|
|
|
|
|
|
if (broad) {
|
|
|
|
/* Convert addr to prefix */
|
|
|
|
memset(&p, 0, sizeof(p));
|
|
|
|
p.family = ifa->ifa_family;
|
|
|
|
p.prefixlen = ifa->ifa_prefixlen;
|
|
|
|
if (p.family == AF_INET)
|
|
|
|
p.u.prefix4 = *(struct in_addr *)broad;
|
|
|
|
else
|
|
|
|
p.u.prefix6 = *(struct in6_addr *)broad;
|
|
|
|
|
|
|
|
dplane_ctx_set_intf_dest(ctx, &p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Flags. */
|
|
|
|
if (kernel_flags & IFA_F_SECONDARY)
|
|
|
|
dplane_ctx_intf_set_secondary(ctx);
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
if (tb[IFA_LABEL]) {
|
|
|
|
label = (char *)RTA_DATA(tb[IFA_LABEL]);
|
|
|
|
dplane_ctx_set_intf_label(ctx, label);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tb[IFA_RT_PRIORITY])
|
|
|
|
metric = *(uint32_t *)RTA_DATA(tb[IFA_RT_PRIORITY]);
|
|
|
|
|
|
|
|
dplane_ctx_set_intf_metric(ctx, metric);
|
|
|
|
|
|
|
|
/* Enqueue ctx for main pthread to process */
|
|
|
|
dplane_provider_enqueue_to_zebra(ctx);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-05-23 15:37:06 +02:00
|
|
|
int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
2016-10-17 21:39:55 +02:00
|
|
|
{
|
|
|
|
int len;
|
|
|
|
struct ifinfomsg *ifi;
|
|
|
|
struct rtattr *tb[IFLA_MAX + 1];
|
|
|
|
struct rtattr *linkinfo[IFLA_MAX + 1];
|
|
|
|
struct interface *ifp;
|
|
|
|
char *name = NULL;
|
|
|
|
char *kind = NULL;
|
2017-10-28 03:24:13 +02:00
|
|
|
char *desc = NULL;
|
2016-10-17 21:39:55 +02:00
|
|
|
char *slave_kind = NULL;
|
|
|
|
struct zebra_ns *zns;
|
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
2021-08-30 19:24:26 +02:00
|
|
|
enum zebra_iftype zif_type = ZEBRA_IF_OTHER;
|
2021-08-30 19:27:02 +02:00
|
|
|
enum zebra_slave_iftype zif_slave_type = ZEBRA_IF_SLAVE_NONE;
|
2017-05-15 07:31:08 +02:00
|
|
|
ifindex_t bridge_ifindex = IFINDEX_INTERNAL;
|
2018-11-10 21:54:43 +01:00
|
|
|
ifindex_t bond_ifindex = IFINDEX_INTERNAL;
|
2017-05-15 07:31:08 +02:00
|
|
|
ifindex_t link_ifindex = IFINDEX_INTERNAL;
|
2019-02-14 03:22:14 +01:00
|
|
|
uint8_t old_hw_addr[INTERFACE_HWADDR_MAX];
|
2019-04-28 01:55:21 +02:00
|
|
|
struct zebra_if *zif;
|
2019-09-24 10:44:58 +02:00
|
|
|
ns_id_t link_nsid = ns_id;
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
ifindex_t master_infindex = IFINDEX_INTERNAL;
|
2020-08-05 16:13:55 +02:00
|
|
|
uint8_t bypass = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
zns = zebra_ns_lookup(ns_id);
|
|
|
|
ifi = NLMSG_DATA(h);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-12-08 19:06:34 +01:00
|
|
|
/* assume if not default zns, then new VRF */
|
2016-10-17 21:39:55 +02:00
|
|
|
if (!(h->nlmsg_type == RTM_NEWLINK || h->nlmsg_type == RTM_DELLINK)) {
|
|
|
|
/* If this is not link add/delete message so print warning. */
|
2022-09-13 08:28:35 +02:00
|
|
|
zlog_debug("%s: wrong kernel message %s", __func__,
|
2018-09-14 23:48:51 +02:00
|
|
|
nl_msg_type_to_str(h->nlmsg_type));
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-07-19 23:29:16 +02:00
|
|
|
if (!(ifi->ifi_family == AF_UNSPEC || ifi->ifi_family == AF_BRIDGE
|
|
|
|
|| ifi->ifi_family == AF_INET6)) {
|
2018-08-16 22:10:32 +02:00
|
|
|
flog_warn(
|
2018-09-13 21:21:05 +02:00
|
|
|
EC_ZEBRA_UNKNOWN_FAMILY,
|
2018-09-14 23:48:51 +02:00
|
|
|
"Invalid address family: %u received from kernel link change: %s",
|
|
|
|
ifi->ifi_family, nl_msg_type_to_str(h->nlmsg_type));
|
2018-07-19 23:29:16 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
2018-06-22 20:22:02 +02:00
|
|
|
if (len < 0) {
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_err(
|
|
|
|
"%s: Message received from netlink is of a broken size %d %zu",
|
|
|
|
__func__, h->nlmsg_len,
|
|
|
|
(size_t)NLMSG_LENGTH(sizeof(struct ifinfomsg)));
|
2016-10-17 21:39:55 +02:00
|
|
|
return -1;
|
2018-06-22 20:22:02 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* We are interested in some AF_BRIDGE notifications. */
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ifi->ifi_family == AF_BRIDGE)
|
2017-05-15 07:31:08 +02:00
|
|
|
return netlink_bridge_interface(h, len, ns_id, startup);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Looking up interface name. */
|
2020-03-08 20:43:26 +01:00
|
|
|
memset(linkinfo, 0, sizeof(linkinfo));
|
2022-01-25 19:49:05 +01:00
|
|
|
netlink_parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(ifi), len,
|
|
|
|
NLA_F_NESTED);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
/* check for wireless messages to ignore */
|
|
|
|
if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: ignoring IFLA_WIRELESS message",
|
|
|
|
__func__);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tb[IFLA_IFNAME] == NULL)
|
|
|
|
return -1;
|
|
|
|
name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
|
|
|
|
|
2021-08-12 22:45:38 +02:00
|
|
|
/* Must be valid string. */
|
|
|
|
len = RTA_PAYLOAD(tb[IFLA_IFNAME]);
|
|
|
|
if (len < 2 || name[len - 1] != '\0') {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("%s: invalid intf name", __func__);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFLA_LINKINFO]) {
|
2021-05-05 05:48:17 +02:00
|
|
|
netlink_parse_rtattr_nested(linkinfo, IFLA_INFO_MAX,
|
|
|
|
tb[IFLA_LINKINFO]);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
|
|
|
if (linkinfo[IFLA_INFO_KIND])
|
|
|
|
kind = RTA_DATA(linkinfo[IFLA_INFO_KIND]);
|
|
|
|
|
|
|
|
if (linkinfo[IFLA_INFO_SLAVE_KIND])
|
|
|
|
slave_kind = RTA_DATA(linkinfo[IFLA_INFO_SLAVE_KIND]);
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
netlink_determine_zebra_iftype(kind, &zif_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If linking to another interface, note it. */
|
|
|
|
if (tb[IFLA_LINK])
|
|
|
|
link_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_LINK]);
|
2016-10-17 21:39:55 +02:00
|
|
|
|
2019-10-02 13:37:11 +02:00
|
|
|
if (tb[IFLA_LINK_NETNSID]) {
|
2019-09-24 10:44:58 +02:00
|
|
|
link_nsid = *(ns_id_t *)RTA_DATA(tb[IFLA_LINK_NETNSID]);
|
2019-10-02 13:37:11 +02:00
|
|
|
link_nsid = ns_id_get_absolute(ns_id, link_nsid);
|
|
|
|
}
|
2017-10-28 03:24:13 +02:00
|
|
|
if (tb[IFLA_IFALIAS]) {
|
|
|
|
desc = (char *)RTA_DATA(tb[IFLA_IFALIAS]);
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* See if interface is present. */
|
2017-04-30 15:26:06 +02:00
|
|
|
ifp = if_lookup_by_name_per_ns(zns, name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (h->nlmsg_type == RTM_NEWLINK) {
|
2022-01-23 23:51:10 +01:00
|
|
|
/* If VRF, create or update the VRF structure itself. */
|
|
|
|
if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns()) {
|
|
|
|
netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name);
|
|
|
|
vrf_id = (vrf_id_t)ifi->ifi_index;
|
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (tb[IFLA_MASTER]) {
|
2018-01-22 09:42:53 +01:00
|
|
|
if (slave_kind && (strcmp(slave_kind, "vrf") == 0)
|
|
|
|
&& !vrf_is_backend_netns()) {
|
2017-05-15 07:31:08 +02:00
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_VRF;
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
master_infindex = vrf_id =
|
|
|
|
*(uint32_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2017-05-15 07:31:08 +02:00
|
|
|
} else if (slave_kind
|
|
|
|
&& (strcmp(slave_kind, "bridge") == 0)) {
|
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE;
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
master_infindex = bridge_ifindex =
|
2017-05-15 07:31:08 +02:00
|
|
|
*(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2018-11-10 21:54:43 +01:00
|
|
|
} else if (slave_kind
|
|
|
|
&& (strcmp(slave_kind, "bond") == 0)) {
|
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_BOND;
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
master_infindex = bond_ifindex =
|
2018-11-10 21:54:43 +01:00
|
|
|
*(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]);
|
2020-08-05 16:13:55 +02:00
|
|
|
bypass = netlink_parse_lacp_bypass(linkinfo);
|
2017-07-17 14:03:14 +02:00
|
|
|
} else
|
2017-05-15 07:31:08 +02:00
|
|
|
zif_slave_type = ZEBRA_IF_SLAVE_OTHER;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2017-12-08 19:06:34 +01:00
|
|
|
if (vrf_is_backend_netns())
|
|
|
|
vrf_id = (vrf_id_t)ns_id;
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ifp == NULL
|
|
|
|
|| !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) {
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Add interface notification from kernel */
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2016-10-17 21:39:55 +02:00
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"RTM_NEWLINK ADD for %s(%u) vrf_id %u type %d sl_type %d master %u flags 0x%x",
|
2017-05-15 07:31:08 +02:00
|
|
|
name, ifi->ifi_index, vrf_id, zif_type,
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
zif_slave_type, master_infindex,
|
2016-10-17 21:39:55 +02:00
|
|
|
ifi->ifi_flags);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (ifp == NULL) {
|
|
|
|
/* unknown interface */
|
2021-10-13 14:06:38 +02:00
|
|
|
ifp = if_get_by_name(name, vrf_id, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
} else {
|
2016-10-17 21:39:55 +02:00
|
|
|
/* pre-configured interface, learnt now */
|
2021-10-22 00:17:40 +02:00
|
|
|
if (ifp->vrf->vrf_id != vrf_id)
|
2019-06-24 01:46:39 +02:00
|
|
|
if_update_to_new_vrf(ifp, vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Update interface information. */
|
|
|
|
set_ifindex(ifp, ifi->ifi_index, zns);
|
|
|
|
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
2018-07-20 22:10:43 +02:00
|
|
|
if (!tb[IFLA_MTU]) {
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug(
|
2018-07-20 22:10:43 +02:00
|
|
|
"RTM_NEWLINK for interface %s(%u) without MTU set",
|
|
|
|
name, ifi->ifi_index);
|
|
|
|
return 0;
|
|
|
|
}
|
2017-05-15 07:31:08 +02:00
|
|
|
ifp->mtu6 = ifp->mtu = *(int *)RTA_DATA(tb[IFLA_MTU]);
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->metric = 0;
|
|
|
|
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Set interface type */
|
|
|
|
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
|
2018-03-06 21:50:32 +01:00
|
|
|
if (IS_ZEBRA_IF_VRF(ifp))
|
|
|
|
SET_FLAG(ifp->status,
|
|
|
|
ZEBRA_INTERFACE_VRF_LOOPBACK);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Update link. */
|
2022-02-15 05:14:57 +01:00
|
|
|
zebra_if_update_link(ifp, link_ifindex, link_nsid);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-10-08 23:22:31 +02:00
|
|
|
ifp->ll_type =
|
|
|
|
netlink_to_zebra_link_type(ifi->ifi_type);
|
2016-10-17 21:39:55 +02:00
|
|
|
netlink_interface_update_hw_addr(tb, ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Inform clients, install any configured addresses. */
|
|
|
|
if_add_update(ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Extract and save L2 interface information, take
|
|
|
|
* additional actions. */
|
|
|
|
netlink_interface_update_l2info(
|
2019-09-24 10:44:58 +02:00
|
|
|
ifp, linkinfo[IFLA_INFO_DATA],
|
|
|
|
1, link_nsid);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE_SLAVE(ifp))
|
2021-08-17 10:42:51 +02:00
|
|
|
zebra_l2if_update_bridge_slave(
|
|
|
|
ifp, bridge_ifindex, ns_id,
|
|
|
|
ZEBRA_BRIDGE_NO_ACTION);
|
2018-11-10 21:54:43 +01:00
|
|
|
else if (IS_ZEBRA_IF_BOND_SLAVE(ifp))
|
2020-08-05 16:13:55 +02:00
|
|
|
zebra_l2if_update_bond_slave(ifp, bond_ifindex,
|
|
|
|
!!bypass);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
if (tb[IFLA_PROTO_DOWN])
|
|
|
|
netlink_proc_dplane_if_protodown(ifp->info, tb);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
|
2021-10-22 00:17:40 +02:00
|
|
|
} else if (ifp->vrf->vrf_id != vrf_id) {
|
2016-10-17 21:39:55 +02:00
|
|
|
/* VRF change for an interface. */
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"RTM_NEWLINK vrf-change for %s(%u) vrf_id %u -> %u flags 0x%x",
|
2021-10-22 00:17:40 +02:00
|
|
|
name, ifp->ifindex, ifp->vrf->vrf_id,
|
|
|
|
vrf_id, ifi->ifi_flags);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-06-24 01:46:39 +02:00
|
|
|
if_handle_vrf_change(ifp, vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
} else {
|
2018-11-10 21:54:43 +01:00
|
|
|
bool was_bridge_slave, was_bond_slave;
|
2021-08-17 10:42:51 +02:00
|
|
|
uint8_t chgflags = ZEBRA_BRIDGE_NO_ACTION;
|
2020-05-28 20:40:29 +02:00
|
|
|
zif = ifp->info;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Interface update. */
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"RTM_NEWLINK update for %s(%u) sl_type %d master %u flags 0x%x",
|
2017-05-15 07:31:08 +02:00
|
|
|
name, ifp->ifindex, zif_slave_type,
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
master_infindex, ifi->ifi_flags);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
set_ifindex(ifp, ifi->ifi_index, zns);
|
2018-07-20 22:10:43 +02:00
|
|
|
if (!tb[IFLA_MTU]) {
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug(
|
2018-07-20 22:10:43 +02:00
|
|
|
"RTM_NEWLINK for interface %s(%u) without MTU set",
|
|
|
|
name, ifi->ifi_index);
|
|
|
|
return 0;
|
|
|
|
}
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->mtu6 = ifp->mtu = *(int *)RTA_DATA(tb[IFLA_MTU]);
|
|
|
|
ifp->metric = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Update interface type - NOTE: Only slave_type can
|
|
|
|
* change. */
|
|
|
|
was_bridge_slave = IS_ZEBRA_IF_BRIDGE_SLAVE(ifp);
|
2018-11-10 21:54:43 +01:00
|
|
|
was_bond_slave = IS_ZEBRA_IF_BOND_SLAVE(ifp);
|
2017-05-15 07:31:08 +02:00
|
|
|
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-02-14 03:22:14 +01:00
|
|
|
memcpy(old_hw_addr, ifp->hw_addr, INTERFACE_HWADDR_MAX);
|
|
|
|
|
2021-04-29 11:58:15 +02:00
|
|
|
/* Update link. */
|
2022-02-15 05:14:57 +01:00
|
|
|
zebra_if_update_link(ifp, link_ifindex, link_nsid);
|
2021-04-29 11:58:15 +02:00
|
|
|
|
2021-10-08 23:22:31 +02:00
|
|
|
ifp->ll_type =
|
|
|
|
netlink_to_zebra_link_type(ifi->ifi_type);
|
2016-10-17 21:39:55 +02:00
|
|
|
netlink_interface_update_hw_addr(tb, ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
if (tb[IFLA_PROTO_DOWN])
|
|
|
|
netlink_proc_dplane_if_protodown(ifp->info, tb);
|
2020-05-28 20:40:29 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (if_is_no_ptm_operative(ifp)) {
|
2020-10-02 20:49:09 +02:00
|
|
|
bool is_up = if_is_operative(ifp);
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
2020-05-28 20:40:29 +02:00
|
|
|
if (!if_is_no_ptm_operative(ifp) ||
|
|
|
|
CHECK_FLAG(zif->flags,
|
|
|
|
ZIF_FLAG_PROTODOWN)) {
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"Intf %s(%u) has gone DOWN",
|
|
|
|
name, ifp->ifindex);
|
|
|
|
if_down(ifp);
|
2019-10-17 21:44:08 +02:00
|
|
|
rib_update(RIB_UPDATE_KERNEL);
|
2016-10-17 21:39:55 +02:00
|
|
|
} else if (if_is_operative(ifp)) {
|
2021-08-17 10:42:51 +02:00
|
|
|
bool mac_updated = false;
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Must notify client daemons of new
|
|
|
|
* interface status. */
|
2016-10-17 21:39:55 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2017-05-15 07:31:08 +02:00
|
|
|
"Intf %s(%u) PTM up, notifying clients",
|
2016-10-17 21:39:55 +02:00
|
|
|
name, ifp->ifindex);
|
2020-10-02 20:49:09 +02:00
|
|
|
if_up(ifp, !is_up);
|
2019-02-14 03:22:14 +01:00
|
|
|
|
|
|
|
/* Update EVPN VNI when SVI MAC change
|
|
|
|
*/
|
2021-08-17 10:42:51 +02:00
|
|
|
if (memcmp(old_hw_addr, ifp->hw_addr,
|
|
|
|
INTERFACE_HWADDR_MAX))
|
|
|
|
mac_updated = true;
|
|
|
|
if (IS_ZEBRA_IF_VLAN(ifp)
|
|
|
|
&& mac_updated) {
|
2019-02-14 03:22:14 +01:00
|
|
|
struct interface *link_if;
|
|
|
|
|
|
|
|
link_if =
|
|
|
|
if_lookup_by_index_per_ns(
|
|
|
|
zebra_ns_lookup(NS_DEFAULT),
|
|
|
|
link_ifindex);
|
|
|
|
if (link_if)
|
|
|
|
zebra_vxlan_svi_up(ifp,
|
|
|
|
link_if);
|
2021-08-17 10:42:51 +02:00
|
|
|
} else if (mac_updated
|
|
|
|
&& IS_ZEBRA_IF_BRIDGE(ifp)) {
|
|
|
|
zlog_debug(
|
|
|
|
"Intf %s(%u) bridge changed MAC address",
|
|
|
|
name, ifp->ifindex);
|
|
|
|
chgflags =
|
|
|
|
ZEBRA_BRIDGE_MASTER_MAC_CHANGE;
|
2019-02-14 03:22:14 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
} else {
|
2016-10-17 21:39:55 +02:00
|
|
|
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
2020-05-28 20:40:29 +02:00
|
|
|
if (if_is_operative(ifp) &&
|
|
|
|
!CHECK_FLAG(zif->flags,
|
|
|
|
ZIF_FLAG_PROTODOWN)) {
|
2016-10-17 21:39:55 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2017-05-15 07:31:08 +02:00
|
|
|
"Intf %s(%u) has come UP",
|
2016-10-17 21:39:55 +02:00
|
|
|
name, ifp->ifindex);
|
2020-10-02 20:49:09 +02:00
|
|
|
if_up(ifp, true);
|
zebra: refresh vxlan evpn contexts, when bridge interface goes up
When using bgp evpn rt5 setup, after BGP configuration has been
loaded, if the user attempts to detach and reattach the bridged
vxlan interface from the bridge, then BGP loses its BGP EVPN
contexts, and a refresh of BGP configuration is necessary to
maintain consistency between linux configuration and BGP EVPN
contexts (RIB). The following command can lead to inconsistency:
ip netns exec cust1 ip link set dev vxlan1000 nomaster
ip netns exec cust1 ip link set dev vxlan1000 master br1000
consecutive to the, BGP l2vpn evpn RIB is empty, and the way to
solve this until now is to reconfigure EVPN like this:
vrf cust1
no vni 1000
vni 1000
exit-vrf
Actually, the link information is correctly handled. In fact,
at the time of link event, the lower link status of the bridge
interface was not yet up, thus preventing from establishing
BGP EVPN contexts. In fact, when a bridge interface does not
have any slave interface, the link status of the bridge interface
is down. That change of status comes a bit after, and is not
detected by slave interfaces, as this event is not intercepted.
This commit intercepts the bridge link up event, and triggers
a check on slaved vxlan interfaces.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-08-17 10:56:32 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE(ifp))
|
|
|
|
chgflags =
|
|
|
|
ZEBRA_BRIDGE_MASTER_UP;
|
2019-08-01 19:37:05 +02:00
|
|
|
} else {
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
2019-08-06 10:52:07 +02:00
|
|
|
"Intf %s(%u) has gone DOWN",
|
2019-08-01 19:37:05 +02:00
|
|
|
name, ifp->ifindex);
|
|
|
|
if_down(ifp);
|
2019-10-17 21:44:08 +02:00
|
|
|
rib_update(RIB_UPDATE_KERNEL);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Extract and save L2 interface information, take
|
|
|
|
* additional actions. */
|
|
|
|
netlink_interface_update_l2info(
|
2019-09-24 10:44:58 +02:00
|
|
|
ifp, linkinfo[IFLA_INFO_DATA],
|
|
|
|
0, link_nsid);
|
2021-08-17 10:42:51 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE(ifp))
|
|
|
|
zebra_l2if_update_bridge(ifp, chgflags);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (IS_ZEBRA_IF_BOND(ifp))
|
|
|
|
zebra_l2if_update_bond(ifp, true);
|
2017-05-15 07:31:08 +02:00
|
|
|
if (IS_ZEBRA_IF_BRIDGE_SLAVE(ifp) || was_bridge_slave)
|
2021-08-17 10:42:51 +02:00
|
|
|
zebra_l2if_update_bridge_slave(
|
|
|
|
ifp, bridge_ifindex, ns_id, chgflags);
|
2018-11-10 21:54:43 +01:00
|
|
|
else if (IS_ZEBRA_IF_BOND_SLAVE(ifp) || was_bond_slave)
|
2020-08-05 16:13:55 +02:00
|
|
|
zebra_l2if_update_bond_slave(ifp, bond_ifindex,
|
|
|
|
!!bypass);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2019-09-19 19:27:04 +02:00
|
|
|
|
|
|
|
zif = ifp->info;
|
|
|
|
if (zif) {
|
2022-12-02 17:10:58 +01:00
|
|
|
XFREE(MTYPE_ZIF_DESC, zif->desc);
|
2019-09-19 19:27:04 +02:00
|
|
|
if (desc)
|
2022-12-02 17:10:58 +01:00
|
|
|
zif->desc = XSTRDUP(MTYPE_ZIF_DESC, desc);
|
2019-09-19 19:27:04 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
} else {
|
2016-10-17 21:39:55 +02:00
|
|
|
/* Delete interface notification from kernel */
|
|
|
|
if (ifp == NULL) {
|
2018-08-16 22:10:32 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug(
|
|
|
|
"RTM_DELLINK for unknown interface %s(%u)",
|
|
|
|
name, ifi->ifi_index);
|
2016-10-17 21:39:55 +02:00
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
|
|
|
zlog_debug("RTM_DELLINK for %s(%u)", name,
|
|
|
|
ifp->ifindex);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-17 21:39:55 +02:00
|
|
|
UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
if (IS_ZEBRA_IF_BOND(ifp))
|
|
|
|
zebra_l2if_update_bond(ifp, false);
|
2020-08-05 16:13:55 +02:00
|
|
|
if (IS_ZEBRA_IF_BOND_SLAVE(ifp))
|
|
|
|
zebra_l2if_update_bond_slave(ifp, bond_ifindex, false);
|
2017-05-15 07:31:08 +02:00
|
|
|
/* Special handling for bridge or VxLAN interfaces. */
|
|
|
|
if (IS_ZEBRA_IF_BRIDGE(ifp))
|
|
|
|
zebra_l2_bridge_del(ifp);
|
|
|
|
else if (IS_ZEBRA_IF_VXLAN(ifp))
|
|
|
|
zebra_l2_vxlanif_del(ifp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-03-25 01:02:33 +01:00
|
|
|
if_delete_update(&ifp);
|
2022-01-23 23:51:10 +01:00
|
|
|
|
|
|
|
/* If VRF, delete the VRF structure itself. */
|
|
|
|
if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns())
|
|
|
|
netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name);
|
2016-10-17 21:39:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
/**
|
|
|
|
* Interface encoding helper function.
|
|
|
|
*
|
|
|
|
* \param[in] cmd netlink command.
|
|
|
|
* \param[in] ctx dataplane context (information snapshot).
|
|
|
|
* \param[out] buf buffer to hold the packet.
|
|
|
|
* \param[in] buflen amount of buffer bytes.
|
|
|
|
*/
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
ssize_t netlink_intf_msg_encode(uint16_t cmd,
|
|
|
|
const struct zebra_dplane_ctx *ctx, void *buf,
|
|
|
|
size_t buflen)
|
|
|
|
{
|
2019-02-05 23:02:40 +01:00
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct ifinfomsg ifa;
|
2022-01-26 06:07:57 +01:00
|
|
|
char buf[];
|
|
|
|
} *req = buf;
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
struct rtattr *nest_protodown_reason;
|
|
|
|
ifindex_t ifindex = dplane_ctx_get_ifindex(ctx);
|
|
|
|
bool down = dplane_ctx_intf_is_protodown(ctx);
|
2022-01-31 22:12:01 +01:00
|
|
|
bool pd_reason_val = dplane_ctx_get_intf_pd_reason_val(ctx);
|
2022-01-26 06:07:57 +01:00
|
|
|
struct nlsock *nl =
|
|
|
|
kernel_netlink_nlsock_lookup(dplane_ctx_get_ns_sock(ctx));
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
if (buflen < sizeof(*req))
|
|
|
|
return 0;
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
memset(req, 0, sizeof(*req));
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
if (cmd != RTM_SETLINK)
|
|
|
|
flog_err(
|
|
|
|
EC_ZEBRA_INTF_UPDATE_FAILURE,
|
|
|
|
"Only RTM_SETLINK message type currently supported in dplane pthread");
|
2019-02-05 23:02:40 +01:00
|
|
|
|
2022-01-26 06:07:57 +01:00
|
|
|
req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
|
|
|
req->n.nlmsg_flags = NLM_F_REQUEST;
|
|
|
|
req->n.nlmsg_type = cmd;
|
|
|
|
req->n.nlmsg_pid = nl->snl.nl_pid;
|
|
|
|
|
|
|
|
req->ifa.ifi_index = ifindex;
|
|
|
|
|
|
|
|
nl_attr_put8(&req->n, buflen, IFLA_PROTO_DOWN, down);
|
|
|
|
nl_attr_put32(&req->n, buflen, IFLA_LINK, ifindex);
|
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
/* Reason info nest */
|
|
|
|
nest_protodown_reason =
|
|
|
|
nl_attr_nest(&req->n, buflen, IFLA_PROTO_DOWN_REASON);
|
2022-01-26 06:07:57 +01:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
if (!nest_protodown_reason)
|
|
|
|
return -1;
|
2022-01-26 06:07:57 +01:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
nl_attr_put32(&req->n, buflen, IFLA_PROTO_DOWN_REASON_MASK,
|
|
|
|
(1 << frr_protodown_r_bit));
|
|
|
|
nl_attr_put32(&req->n, buflen, IFLA_PROTO_DOWN_REASON_VALUE,
|
2022-01-31 22:12:01 +01:00
|
|
|
((int)pd_reason_val) << frr_protodown_r_bit);
|
2022-01-26 06:07:57 +01:00
|
|
|
|
2022-01-25 19:49:05 +01:00
|
|
|
nl_attr_nest_end(&req->n, nest_protodown_reason);
|
2022-01-26 06:07:57 +01:00
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2022-01-31 22:12:01 +01:00
|
|
|
zlog_debug("%s: %s, protodown=%d reason_val=%d ifindex=%u",
|
|
|
|
__func__, nl_msg_type_to_str(cmd), down,
|
|
|
|
pd_reason_val, ifindex);
|
2022-01-26 06:07:57 +01:00
|
|
|
|
|
|
|
return NLMSG_ALIGN(req->n.nlmsg_len);
|
2019-02-05 23:02:40 +01:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Interface information read by netlink. */
|
2016-02-01 19:55:42 +01:00
|
|
|
void interface_list(struct zebra_ns *zns)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2016-02-01 19:55:42 +01:00
|
|
|
interface_lookup_netlink(zns);
|
2019-02-26 00:18:07 +01:00
|
|
|
/* We add routes for interface address,
|
|
|
|
* so we need to get the nexthop info
|
|
|
|
* from the kernel before we can do that
|
|
|
|
*/
|
2019-08-01 20:53:06 +02:00
|
|
|
netlink_nexthop_read(zns);
|
2019-03-06 20:08:13 +01:00
|
|
|
|
2019-02-15 18:28:56 +01:00
|
|
|
interface_addr_lookup_netlink(zns);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-26 19:49:15 +02:00
|
|
|
|
2022-01-19 20:36:10 +01:00
|
|
|
void if_netlink_set_frr_protodown_r_bit(uint8_t bit)
|
|
|
|
{
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2022-02-16 00:53:01 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Protodown reason bit index changed: bit-index %u -> bit-index %u",
|
|
|
|
frr_protodown_r_bit, bit);
|
2022-01-19 20:36:10 +01:00
|
|
|
|
|
|
|
frr_protodown_r_bit = bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void if_netlink_unset_frr_protodown_r_bit(void)
|
|
|
|
{
|
|
|
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
2022-02-16 00:53:01 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Protodown reason bit index changed: bit-index %u -> bit-index %u",
|
|
|
|
frr_protodown_r_bit, FRR_PROTODOWN_REASON_DEFAULT_BIT);
|
2022-01-19 20:36:10 +01:00
|
|
|
|
|
|
|
frr_protodown_r_bit = FRR_PROTODOWN_REASON_DEFAULT_BIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool if_netlink_frr_protodown_r_bit_is_set(void)
|
|
|
|
{
|
|
|
|
return (frr_protodown_r_bit != FRR_PROTODOWN_REASON_DEFAULT_BIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t if_netlink_get_frr_protodown_r_bit(void)
|
|
|
|
{
|
|
|
|
return frr_protodown_r_bit;
|
|
|
|
}
|
|
|
|
|
2022-01-25 19:25:38 +01:00
|
|
|
/**
|
|
|
|
* netlink_request_tunneldump() - Request all tunnels from the linux kernel
|
|
|
|
*
|
|
|
|
* @zns: Zebra namespace
|
|
|
|
* @family: AF_* netlink family
|
|
|
|
* @type: RTM_* (RTM_GETTUNNEL) route type
|
|
|
|
*
|
|
|
|
* Return: Result status
|
|
|
|
*/
|
|
|
|
static int netlink_request_tunneldump(struct zebra_ns *zns, int family,
|
|
|
|
int ifindex)
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
struct nlmsghdr n;
|
|
|
|
struct tunnel_msg tmsg;
|
|
|
|
char buf[256];
|
|
|
|
} req;
|
|
|
|
|
|
|
|
/* Form the request */
|
|
|
|
memset(&req, 0, sizeof(req));
|
|
|
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tunnel_msg));
|
|
|
|
req.n.nlmsg_type = RTM_GETTUNNEL;
|
|
|
|
req.n.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
|
|
|
|
req.tmsg.family = family;
|
|
|
|
req.tmsg.ifindex = ifindex;
|
|
|
|
|
|
|
|
return netlink_request(&zns->netlink_cmd, &req);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Currently we only ask for vxlan l3svd vni information.
|
|
|
|
* In the future this can be expanded.
|
|
|
|
*/
|
|
|
|
int netlink_tunneldump_read(struct zebra_ns *zns)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct zebra_dplane_info dp_info;
|
|
|
|
struct route_node *rn;
|
|
|
|
struct interface *tmp_if = NULL;
|
|
|
|
struct zebra_if *zif;
|
2022-10-04 14:51:38 +02:00
|
|
|
struct nlsock *netlink_cmd = &zns->netlink_cmd;
|
2022-01-25 19:25:38 +01:00
|
|
|
|
|
|
|
zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/);
|
|
|
|
|
|
|
|
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
|
|
|
|
tmp_if = (struct interface *)rn->info;
|
|
|
|
if (!tmp_if)
|
|
|
|
continue;
|
|
|
|
zif = tmp_if->info;
|
|
|
|
if (!zif || zif->zif_type != ZEBRA_IF_VXLAN)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ret = netlink_request_tunneldump(zns, PF_BRIDGE,
|
|
|
|
tmp_if->ifindex);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2022-10-04 14:51:38 +02:00
|
|
|
|
|
|
|
ret = netlink_parse_info(netlink_interface, netlink_cmd,
|
|
|
|
&dp_info, 0, true);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2022-01-25 19:25:38 +01:00
|
|
|
}
|
2022-10-04 14:51:38 +02:00
|
|
|
|
2022-01-25 19:25:38 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2017-07-26 19:49:15 +02:00
|
|
|
#endif /* GNU_LINUX */
|