From: Igor Putovny Date: Tue, 29 Jul 2025 13:28:17 +0000 (+0200) Subject: Add attributes to interface X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=839c988093497642659a5b831168839eefedb242;p=thirdparty%2Fbird.git Add attributes to interface --- diff --git a/nest/iface.c b/nest/iface.c index 499822b64..e34886c86 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -130,6 +130,8 @@ if_what_changed(struct iface *i, struct iface *j) c |= IF_CHANGE_LINK; if (i->mtu != j->mtu) c |= IF_CHANGE_MTU; + if (i->attrs != j->attrs) + c |= IF_CHANGE_ATTRS; return c; } @@ -140,6 +142,7 @@ if_copy(struct iface *to, struct iface *from) to->mtu = from->mtu; to->master_index = from->master_index; to->master = from->master; + to->attrs = from->attrs; } static inline void @@ -301,6 +304,8 @@ if_update(struct iface *new) struct iface *i; unsigned c; + new->attrs = new->attrs->eattrs ? rta_lookup(new->attrs) : NULL; + WALK_LIST(i, iface_list) if (!strcmp(new->name, i->name)) { diff --git a/nest/iface.h b/nest/iface.h index 1e4225eed..93441b396 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -42,6 +42,7 @@ struct iface { struct ifa *llv6; /* Primary link-local address for IPv6 */ ip4_addr sysdep; /* Arbitrary IPv4 address for internal sysdep use */ list neighbors; /* All neighbors on this interface */ + struct rta *attrs; }; #define IF_UP 1 /* Currently just IF_ADMIN_UP */ @@ -95,6 +96,7 @@ struct iface { #define IF_CHANGE_ADDR6 0x200 /* ... */ #define IF_CHANGE_LLV6 0x400 #define IF_CHANGE_SYSDEP 0x800 +#define IF_CHANGE_ATTRS 0x1000 #define IF_CHANGE_TOO_MUCH 0x40000000 /* Used internally */ #define IF_CHANGE_UPDOWN (IF_CHANGE_UP | IF_CHANGE_DOWN) diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 62e6d5a68..15df573b9 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -951,7 +951,8 @@ nl_parse_link(struct nlmsghdr *h, int scan) struct ifinfomsg *i; struct rtattr *a[BIRD_IFLA_MAX]; int new = h->nlmsg_type == RTM_NEWLINK; - struct iface f = {}; + struct rta rta = { 0 }; + struct iface f = { .attrs = &rta }; struct iface *ifi; const char *name, *kind = NULL; u32 mtu, master = 0; diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index 2b1dfa96d..2f2a486c7 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -31,6 +31,12 @@ struct kif_proto; #define KRT_LEARN_ALIEN 1 /* Learn KRT_SRC_ALIEN routes */ #define KRT_LEARN_ALL 2 /* Learn both KRT_SRC_ALIEN and KRT_SRC_KERNEL routes */ + +#define EA_DEVICE_IF_VXLAN_ID EA_CODE(PROTOCOL_DEVICE, 0) +#define EA_DEVICE_IF_VXLAN_LEARNING EA_CODE(PROTOCOL_DEVICE, 1) +#define EA_DEVICE_IF_VXLAN_IP_ADDR EA_CODE(PROTOCOL_DEVICE, 2) + + /* Whenever we recognize our own routes, we allow learing of foreign routes */ #ifdef CONFIG_SELF_CONSCIOUS