]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'e063365590b9b857a5bd0acfa519783eba639bbf' into stable-v3.0
authorMaria Matejka <mq@ucw.cz>
Thu, 9 Jan 2025 17:30:33 +0000 (18:30 +0100)
committerMaria Matejka <mq@ucw.cz>
Thu, 9 Jan 2025 17:40:29 +0000 (18:40 +0100)
15 files changed:
1  2 
conf/cf-lex.l
conf/confbase.Y
filter/config.Y
filter/data.c
filter/f-inst.c
lib/birdlib.h
lib/net.h
lib/type.h
proto/babel/babel.c
proto/bgp/packets.c
proto/l3vpn/l3vpn.c
sysdep/bsd/krt-sock.c
sysdep/linux/netlink.c
sysdep/unix/krt.c
sysdep/unix/krt.h

diff --cc conf/cf-lex.l
Simple merge
diff --cc conf/confbase.Y
Simple merge
diff --cc filter/config.Y
index 32cfe51c0442469872765ce19b89336ba49d323e,4340d5e0e5d33526f4b3c4aa1267e38a3c9ccfea..faf55c67848f3bb958f85287913d6e7142775f3a
@@@ -677,10 -641,10 +677,10 @@@ fipa
  set_atom0:
     NUM    { $$.type = T_INT; $$.val.i = $1; }
   | fipa   { $$ = $1; }
-  | VPN_RD { $$.type = T_RD; $$.val.ec = $1; }
+  | VPN_RD { $$.type = T_RD; $$.val.rd = $1; }
   | ENUM_TOKEN { $$.type = pair_a($1); $$.val.i = pair_b($1); }
   | '(' term ')' {
 -     $$ = cf_eval($2, T_VOID);
 +     $$ = cf_eval_tmp($2, T_VOID);
       if (!f_valid_set_type($$.type))
         cf_error("Set-incompatible type (%s)", f_type_name($$.type));
     }
diff --cc filter/data.c
Simple merge
diff --cc filter/f-inst.c
Simple merge
diff --cc lib/birdlib.h
index e826040afc8d833b80c51936f96cae7d98f40b7e,da8985c76e3fb6c61daf338978ef98f033cf0de2..442bf60040cf970f494acc46e8e40e6d39cbaf58
@@@ -9,14 -9,9 +9,15 @@@
  #ifndef _BIRD_BIRDLIB_H_
  #define _BIRD_BIRDLIB_H_
  
 +#include <stddef.h>
 +#include <setjmp.h>
 +
 +#include "sysdep/config.h"
  #include "lib/alloca.h"
 +#include "lib/macro.h"
 +
  #include <stdarg.h>
+ #include <stdalign.h>
  
  /* Ugly structure offset handling macros */
  
diff --cc lib/net.h
Simple merge
diff --cc lib/type.h
index 9244ea401c62baea51c5b40f0323e93bac5a5d4c,0000000000000000000000000000000000000000..e694f9b853392b48f7369a82fc2c1595d93249c1
mode 100644,000000..100644
--- /dev/null
@@@ -1,131 -1,0 +1,132 @@@
 +/*
 + *     BIRD Internet Routing Daemon -- Internal Data Types
 + *
 + *     (c) 2022 Maria Matejka <mq@jmq.cz>
 + *
 + *     Can be freely distributed and used under the terms of the GNU GPL.
 + */
 +
 +#ifndef _BIRD_TYPE_H_
 +#define _BIRD_TYPE_H_
 +
 +#include "lib/birdlib.h"
 +#include "lib/attrs.h"
 +
 +union bval {
 +#define BVAL_ITEMS                                                                    \
 +  struct {                                                                            \
 +    u32 data;                 /* Integer type inherited from eattrs */                \
 +    PADDING(data, 0, 4);      /* Must be padded on 64-bits */                         \
 +  };                                                                                  \
 +  struct {                                                                            \
 +    u32 i;                    /* Integer type inherited from filters */               \
 +    PADDING(i, 0, 4);         /* Must be padded on 64-bits */                         \
 +  };                                                                                  \
 +  const struct adata *ptr;    /* Generic attribute data inherited from eattrs */      \
 +  const struct adata *ad;             /* Generic attribute data inherited from filters */     \
 +  void * v_ptr;                       /* Stored pointer */ \
 +
 +  BVAL_ITEMS;
 +};
 +
 +union bval_long {
 +  union bval bval;            /* For direct assignments */
 +  BVAL_ITEMS;                 /* For item-wise access */
 +
 +  u64 ec;
 +  lcomm lc;
++  vpn_rd rd;
 +  ip_addr ip;
 +  const net_addr *net;
 +  const char *s;
 +  const struct adata *bs;
 +  const struct f_tree *t;
 +  const struct f_trie *ti;
 +  const struct f_path_mask *path_mask;
 +  struct f_path_mask_item pmi;
 +  struct rte *rte;
 +  struct rte_block {
 +    struct rte **rte;
 +    uint len;
 +  } rte_block;
 +};
 +
 +
 +/* Internal types */
 +enum btype {
 +/* Nothing. Simply nothing. */
 +  T_VOID = 0,
 +  T_NONE = 0xff,
 +
 +/* Something but inaccessible. */
 +  T_OPAQUE = 0x02,            /* Opaque byte string (not filterable) */
 +  T_IFACE = 0x0c,             /* Pointer to an interface (inside adata) */
 +  T_ROUTES_BLOCK = 0x68,      /* Block of route pointers */
 +  T_ROUTE = 0x6a,             /* One route pointer */
 +  T_NEXTHOP_LIST = 0x6c,      /* The whole nexthop block */
 +  T_HOSTENTRY = 0x6e,         /* Hostentry with possible MPLS labels */
 +
 +/* Types shared with eattrs */
 +  T_INT = 0x01,                       /* 32-bit unsigned integer number */
 +  T_IP = 0x04,                        /* IP address */
 +  T_QUAD = 0x05,              /* Router ID (IPv4 address) */
 +  T_PATH = 0x06,              /* BGP AS path (encoding per RFC 1771:4.3) */
 +  T_CLIST = 0x0a,             /* Set of u32's (e.g., a community list) */
 +  T_ECLIST = 0x0e,            /* Set of pairs of u32's - ext. community list */
 +  T_LCLIST = 0x08,            /* Set of triplets of u32's - large community list */
 +  T_STRING = 0x10,
 +  T_PTR = 0x11,         /* Void pointer */
 +
 +  T_ENUM_BGP_ORIGIN = 0x13,   /* BGP Origin enum */
 +  T_ENUM_RA_PREFERENCE = 0x15,        /* RA Preference enum */
 +  T_ENUM_FLOWSPEC_VALID = 0x17,       /* Flowspec validation result */
 +
 +#define EAF_EMBEDDED 0x01             /* Data stored in eattr.u.data (part of type spec) */
 +                                      /* Otherwise, attribute data is adata */
 +
 +/* Other user visible types which fit in int */
 +  T_BOOL = 0xa0,
 +  T_PAIR = 0xa4,  /*  Notice that pair is stored as integer: first << 16 | second */
 +
 +/* Put enumerational types in 0x20..0x3f range */
 +  T_ENUM_LO = 0x12,
 +  T_ENUM_HI = 0x3f,
 +
 +  T_ENUM_ASPA = 0x2f,         /* ASPA validation result */
 +  T_ENUM_RTS = 0x31,
 +  T_ENUM_SCOPE = 0x33,
 +  T_ENUM_MPLS_POLICY = 0x35,
 +  T_ENUM_RTD = 0x37,
 +  T_ENUM_ROA = 0x39,
 +  T_ENUM_NET_TYPE = 0x3b,
 +  T_ENUM_AF = 0x3d,
 +
 +/* new enums go here */
 +
 +#define T_ENUM T_ENUM_LO ... T_ENUM_HI
 +
 +/* Bigger ones */
 +  T_NET = 0xb0,
 +  T_PATH_MASK = 0xb8, /* mask for BGP path */
 +  T_EC = 0xbc,                /* Extended community value, u64 */
 +  T_LC = 0xc0,                /* Large community value, lcomm */
 +  T_RD = 0xc4,                /* Route distinguisher for VPN addresses */
 +  T_PATH_MASK_ITEM = 0xc8,    /* Path mask item for path mask constructors */
 +  T_BYTESTRING = 0xcc,
 +  T_ROA_AGGREGATED = 0xd0,    /* ASN and maxlen tuple list */
 +
 +
 +  T_SET = 0x80,
 +  T_PREFIX_SET = 0x84,
 +
 +/* protocol */
 +  T_ENUM_STATE = 0xd1,
 +  T_BTIME = 0xd4,
 +} PACKED;
 +
 +typedef enum btype btype;
 +
 +STATIC_ASSERT(sizeof(btype) == sizeof(byte));
 +
 +
 +#endif
Simple merge
Simple merge
index 7c70f7ba9a7615185336da73f5c1ac4c171ddb6f,ec9eeb75281344e2b1d957143dff1a3f06026b29..2fd8bdcdd6806afcd5cf837823fbc92fc4021deb
@@@ -432,10 -407,10 +432,10 @@@ l3vpn_reconfigure(struct proto *P, stru
        !proto_configure_channel(P, &p->ip6_channel, proto_cf_find_channel(CF, NET_IP6)) ||
        !proto_configure_channel(P, &p->vpn4_channel, proto_cf_find_channel(CF, NET_VPN4)) ||
        !proto_configure_channel(P, &p->vpn6_channel, proto_cf_find_channel(CF, NET_VPN6)) ||
 -      !proto_configure_channel(P, &P->mpls_channel, proto_cf_find_channel(CF, NET_MPLS)))
 +      !proto_configure_mpls_channel(P, CF, RTS_L3VPN))
      return 0;
  
-   if (p->rd != cf->rd)
+   if (!rd_equal(p->rd, cf->rd))
      return 0;
  
    int import_changed = !same_tree(p->import_target, cf->import_target);
Simple merge
index 9e275152daeb96d9d8e93d74af557d58748b47ff,299f132fec9192d0e887c2ba9ebb15eedab7f13b..1703a67595d5ae7957381882da07466b59875d56
@@@ -1855,16 -1741,21 +1860,21 @@@ nl_parse_route(struct nl_parse_state *s
        {
          /* Silently skip strange 6to4 routes */
          const net_addr_ip6 sit = NET_ADDR_IP6(IP6_NONE, 96);
 -        if ((i->rtm_family == AF_INET6) && ipa_in_netX(ra->nh.gw, (net_addr *) &sit))
 +        if ((i->rtm_family == AF_INET6) && ipa_in_netX(nhad.nh.gw, (net_addr *) &sit))
            return;
  
+ #ifdef CONFIG_ASSUME_ONLINK
+         if (krt_assume_onlink(ra->nh.iface, ipa_is_ip6(ra->nh.gw)))
+           ra->nh.flags |= RNF_ONLINK;
+ #endif
          neighbor *nbr;
 -        nbr = neigh_find(&p->p, ra->nh.gw, ra->nh.iface,
 -                         (ra->nh.flags & RNF_ONLINK) ? NEF_ONLINK : 0);
 +        nbr = neigh_find(&p->p, nhad.nh.gw, nhad.nh.iface,
 +                         (nhad.nh.flags & RNF_ONLINK) ? NEF_ONLINK : 0);
          if (!nbr || (nbr->scope == SCOPE_HOST))
            {
 -            log(L_ERR "KRT: Received route %N with strange next-hop %I", net->n.addr,
 -                  ra->nh.gw);
 +            log(L_ERR "KRT: Received route %N with strange next-hop %I", net,
 +                  nhad.nh.gw);
              return;
            }
        }
Simple merge
Simple merge