]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Add attributes to interface
authorIgor Putovny <igor.putovny@nic.cz>
Tue, 29 Jul 2025 13:28:17 +0000 (15:28 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Wed, 30 Jul 2025 14:35:49 +0000 (16:35 +0200)
nest/iface.c
nest/iface.h
sysdep/linux/netlink.c
sysdep/unix/krt.h

index 499822b6455f28185b0373df9680a07085bd7d9a..e34886c86530f30e8113c181d125045ec2224c39 100644 (file)
@@ -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))
       {
index 1e4225eeda0ea6b6b0a9dae62bedcbff4e535112..93441b396922dc940bb55249dcf46b7a64892ac0 100644 (file)
@@ -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)
index 62e6d5a682fdb521ba1f154e2c89b46640f3e4fc..15df573b942a541d4dead096a1996f5375c8ba3b 100644 (file)
@@ -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;
index 2b1dfa96df787389050a688e829e63ff9455eaf5..2f2a486c7b2a8786f4aed3c8a0a5f6b7c4ef2da4 100644 (file)
@@ -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