Protocol: Introducing an enum protocol_class
This supersedes the EAP_* constants.
This commit is contained in:
parent
c3becfe193
commit
ee7e2ffd26
27 changed files with 115 additions and 106 deletions
|
@ -1522,7 +1522,7 @@ interpret(struct f_inst *what)
|
||||||
|
|
||||||
/* We ignore temporary attributes, probably not a problem here */
|
/* We ignore temporary attributes, probably not a problem here */
|
||||||
/* 0x02 is a value of BA_AS_PATH, we don't want to include BGP headers */
|
/* 0x02 is a value of BA_AS_PATH, we don't want to include BGP headers */
|
||||||
eattr *e = ea_find((*f_rte)->attrs->eattrs, EA_CODE(EAP_BGP, 0x02));
|
eattr *e = ea_find((*f_rte)->attrs->eattrs, EA_CODE(PROTOCOL_BGP, 0x02));
|
||||||
|
|
||||||
if (!e || e->type != EAF_TYPE_AS_PATH)
|
if (!e || e->type != EAF_TYPE_AS_PATH)
|
||||||
runtime("Missing AS_PATH attribute");
|
runtime("Missing AS_PATH attribute");
|
||||||
|
|
|
@ -25,6 +25,7 @@ pool *proto_pool;
|
||||||
list proto_list;
|
list proto_list;
|
||||||
|
|
||||||
static list protocol_list;
|
static list protocol_list;
|
||||||
|
struct protocol *class_to_protocol[PROTOCOL__MAX];
|
||||||
|
|
||||||
#define PD(pr, msg, args...) do { if (pr->debug & D_STATES) { log(L_TRACE "%s: " msg, pr->name , ## args); } } while(0)
|
#define PD(pr, msg, args...) do { if (pr->debug & D_STATES) { log(L_TRACE "%s: " msg, pr->name , ## args); } } while(0)
|
||||||
|
|
||||||
|
@ -1256,11 +1257,9 @@ void
|
||||||
proto_build(struct protocol *p)
|
proto_build(struct protocol *p)
|
||||||
{
|
{
|
||||||
add_tail(&protocol_list, &p->n);
|
add_tail(&protocol_list, &p->n);
|
||||||
if (p->attr_class)
|
ASSERT(p->class);
|
||||||
{
|
ASSERT(!class_to_protocol[p->class]);
|
||||||
ASSERT(!attr_class_to_protocol[p->attr_class]);
|
class_to_protocol[p->class] = p;
|
||||||
attr_class_to_protocol[p->attr_class] = p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: convert this call to some protocol hook */
|
/* FIXME: convert this call to some protocol hook */
|
||||||
|
|
|
@ -37,12 +37,31 @@ struct symbol;
|
||||||
* Routing Protocol
|
* Routing Protocol
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
enum protocol_class {
|
||||||
|
PROTOCOL_NONE,
|
||||||
|
PROTOCOL_BABEL,
|
||||||
|
PROTOCOL_BFD,
|
||||||
|
PROTOCOL_BGP,
|
||||||
|
PROTOCOL_DEVICE,
|
||||||
|
PROTOCOL_DIRECT,
|
||||||
|
PROTOCOL_KERNEL,
|
||||||
|
PROTOCOL_OSPF,
|
||||||
|
PROTOCOL_PIPE,
|
||||||
|
PROTOCOL_RADV,
|
||||||
|
PROTOCOL_RIP,
|
||||||
|
PROTOCOL_RPKI,
|
||||||
|
PROTOCOL_STATIC,
|
||||||
|
PROTOCOL__MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct protocol *class_to_protocol[PROTOCOL__MAX];
|
||||||
|
|
||||||
struct protocol {
|
struct protocol {
|
||||||
node n;
|
node n;
|
||||||
char *name;
|
char *name;
|
||||||
char *template; /* Template for automatic generation of names */
|
char *template; /* Template for automatic generation of names */
|
||||||
int name_counter; /* Counter for automatic name generation */
|
int name_counter; /* Counter for automatic name generation */
|
||||||
int attr_class; /* Attribute class known to this protocol */
|
enum protocol_class class; /* Machine readable protocol class */
|
||||||
uint preference; /* Default protocol preference */
|
uint preference; /* Default protocol preference */
|
||||||
uint channel_mask; /* Mask of accepted channel types (NB_*) */
|
uint channel_mask; /* Mask of accepted channel types (NB_*) */
|
||||||
uint proto_size; /* Size of protocol data structure */
|
uint proto_size; /* Size of protocol data structure */
|
||||||
|
|
16
nest/route.h
16
nest/route.h
|
@ -457,7 +457,7 @@ static inline int rte_is_reachable(rte *r)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct eattr {
|
typedef struct eattr {
|
||||||
word id; /* EA_CODE(EAP_..., protocol-dependent ID) */
|
word id; /* EA_CODE(PROTOCOL_..., protocol-dependent ID) */
|
||||||
byte flags; /* Protocol-dependent flags */
|
byte flags; /* Protocol-dependent flags */
|
||||||
byte type; /* Attribute type and several flags (EAF_...) */
|
byte type; /* Attribute type and several flags (EAF_...) */
|
||||||
union {
|
union {
|
||||||
|
@ -466,20 +466,11 @@ typedef struct eattr {
|
||||||
} u;
|
} u;
|
||||||
} eattr;
|
} eattr;
|
||||||
|
|
||||||
#define EAP_GENERIC 0 /* Generic attributes */
|
|
||||||
#define EAP_BGP 1 /* BGP attributes */
|
|
||||||
#define EAP_RIP 2 /* RIP */
|
|
||||||
#define EAP_OSPF 3 /* OSPF */
|
|
||||||
#define EAP_KRT 4 /* Kernel route attributes */
|
|
||||||
#define EAP_BABEL 5 /* Babel attributes */
|
|
||||||
#define EAP_RADV 6 /* Router advertisment attributes */
|
|
||||||
#define EAP_MAX 7
|
|
||||||
|
|
||||||
#define EA_CODE(proto,id) (((proto) << 8) | (id))
|
#define EA_CODE(proto,id) (((proto) << 8) | (id))
|
||||||
#define EA_PROTO(ea) ((ea) >> 8)
|
#define EA_PROTO(ea) ((ea) >> 8)
|
||||||
#define EA_ID(ea) ((ea) & 0xff)
|
#define EA_ID(ea) ((ea) & 0xff)
|
||||||
|
|
||||||
#define EA_GEN_IGP_METRIC EA_CODE(EAP_GENERIC, 0)
|
#define EA_GEN_IGP_METRIC EA_CODE(PROTOCOL_NONE, 0)
|
||||||
|
|
||||||
#define EA_CODE_MASK 0xffff
|
#define EA_CODE_MASK 0xffff
|
||||||
#define EA_ALLOW_UNDEF 0x10000 /* ea_find: allow EAF_TYPE_UNDEF */
|
#define EA_ALLOW_UNDEF 0x10000 /* ea_find: allow EAF_TYPE_UNDEF */
|
||||||
|
@ -656,9 +647,6 @@ rta_set_recursive_next_hop(rtable *dep, rta *a, rtable *tab, ip_addr gw, ip_addr
|
||||||
static inline void rt_lock_hostentry(struct hostentry *he) { if (he) he->uc++; }
|
static inline void rt_lock_hostentry(struct hostentry *he) { if (he) he->uc++; }
|
||||||
static inline void rt_unlock_hostentry(struct hostentry *he) { if (he) he->uc--; }
|
static inline void rt_unlock_hostentry(struct hostentry *he) { if (he) he->uc--; }
|
||||||
|
|
||||||
|
|
||||||
extern struct protocol *attr_class_to_protocol[EAP_MAX];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default protocol preferences
|
* Default protocol preferences
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,9 +88,6 @@ static struct idm src_ids;
|
||||||
|
|
||||||
static HASH(struct rte_src) src_hash;
|
static HASH(struct rte_src) src_hash;
|
||||||
|
|
||||||
struct protocol *attr_class_to_protocol[EAP_MAX];
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rte_src_init(void)
|
rte_src_init(void)
|
||||||
{
|
{
|
||||||
|
@ -851,7 +848,7 @@ ea_show(struct cli *c, eattr *e)
|
||||||
byte buf[CLI_MSG_SIZE];
|
byte buf[CLI_MSG_SIZE];
|
||||||
byte *pos = buf, *end = buf + sizeof(buf);
|
byte *pos = buf, *end = buf + sizeof(buf);
|
||||||
|
|
||||||
if (p = attr_class_to_protocol[EA_PROTO(e->id)])
|
if (p = class_to_protocol[EA_PROTO(e->id)])
|
||||||
{
|
{
|
||||||
pos += bsprintf(pos, "%s.", p->name);
|
pos += bsprintf(pos, "%s.", p->name);
|
||||||
if (p->get_attr)
|
if (p->get_attr)
|
||||||
|
|
|
@ -185,6 +185,7 @@ dev_copy_config(struct proto_config *dest, struct proto_config *src)
|
||||||
struct protocol proto_device = {
|
struct protocol proto_device = {
|
||||||
.name = "Direct",
|
.name = "Direct",
|
||||||
.template = "direct%d",
|
.template = "direct%d",
|
||||||
|
.class = PROTOCOL_DIRECT,
|
||||||
.preference = DEF_PREF_DIRECT,
|
.preference = DEF_PREF_DIRECT,
|
||||||
.channel_mask = NB_IP | NB_IP6_SADR,
|
.channel_mask = NB_IP | NB_IP6_SADR,
|
||||||
.proto_size = sizeof(struct rt_dev_proto),
|
.proto_size = sizeof(struct rt_dev_proto),
|
||||||
|
|
|
@ -2312,7 +2312,7 @@ babel_reconfigure(struct proto *P, struct proto_config *CF)
|
||||||
struct protocol proto_babel = {
|
struct protocol proto_babel = {
|
||||||
.name = "Babel",
|
.name = "Babel",
|
||||||
.template = "babel%d",
|
.template = "babel%d",
|
||||||
.attr_class = EAP_BABEL,
|
.class = PROTOCOL_BABEL,
|
||||||
.preference = DEF_PREF_BABEL,
|
.preference = DEF_PREF_BABEL,
|
||||||
.channel_mask = NB_IP | NB_IP6_SADR,
|
.channel_mask = NB_IP | NB_IP6_SADR,
|
||||||
.proto_size = sizeof(struct babel_proto),
|
.proto_size = sizeof(struct babel_proto),
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#include "lib/string.h"
|
#include "lib/string.h"
|
||||||
#include "lib/timer.h"
|
#include "lib/timer.h"
|
||||||
|
|
||||||
#define EA_BABEL_METRIC EA_CODE(EAP_BABEL, 0)
|
#define EA_BABEL_METRIC EA_CODE(PROTOCOL_BABEL, 0)
|
||||||
#define EA_BABEL_ROUTER_ID EA_CODE(EAP_BABEL, 1)
|
#define EA_BABEL_ROUTER_ID EA_CODE(PROTOCOL_BABEL, 1)
|
||||||
|
|
||||||
#define BABEL_MAGIC 42
|
#define BABEL_MAGIC 42
|
||||||
#define BABEL_VERSION 2
|
#define BABEL_VERSION 2
|
||||||
|
|
|
@ -1116,6 +1116,7 @@ bfd_show_sessions(struct proto *P)
|
||||||
struct protocol proto_bfd = {
|
struct protocol proto_bfd = {
|
||||||
.name = "BFD",
|
.name = "BFD",
|
||||||
.template = "bfd%d",
|
.template = "bfd%d",
|
||||||
|
.class = PROTOCOL_BFD,
|
||||||
.proto_size = sizeof(struct bfd_proto),
|
.proto_size = sizeof(struct bfd_proto),
|
||||||
.config_size = sizeof(struct bfd_config),
|
.config_size = sizeof(struct bfd_config),
|
||||||
.init = bfd_init,
|
.init = bfd_init,
|
||||||
|
|
|
@ -92,7 +92,7 @@ bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintp
|
||||||
a->next = *attrs;
|
a->next = *attrs;
|
||||||
*attrs = a;
|
*attrs = a;
|
||||||
|
|
||||||
e->id = EA_CODE(EAP_BGP, code);
|
e->id = EA_CODE(PROTOCOL_BGP, code);
|
||||||
e->type = bgp_attr_table[code].type;
|
e->type = bgp_attr_table[code].type;
|
||||||
e->flags = flags;
|
e->flags = flags;
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ static inline void
|
||||||
bgp_decode_unknown(struct bgp_parse_state *s, uint code, uint flags, byte *data, uint len, ea_list **to)
|
bgp_decode_unknown(struct bgp_parse_state *s, uint code, uint flags, byte *data, uint len, ea_list **to)
|
||||||
{
|
{
|
||||||
/* Cannot use bgp_set_attr_data() as it works on known attributes only */
|
/* Cannot use bgp_set_attr_data() as it works on known attributes only */
|
||||||
ea_set_attr_data(to, s->pool, EA_CODE(EAP_BGP, code), flags, EAF_TYPE_OPAQUE, data, len);
|
ea_set_attr_data(to, s->pool, EA_CODE(PROTOCOL_BGP, code), flags, EAF_TYPE_OPAQUE, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ bgp_attr_known(uint code)
|
||||||
static inline void
|
static inline void
|
||||||
bgp_export_attr(struct bgp_export_state *s, eattr *a, ea_list *to)
|
bgp_export_attr(struct bgp_export_state *s, eattr *a, ea_list *to)
|
||||||
{
|
{
|
||||||
if (EA_PROTO(a->id) != EAP_BGP)
|
if (EA_PROTO(a->id) != PROTOCOL_BGP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint code = EA_ID(a->id);
|
uint code = EA_ID(a->id);
|
||||||
|
@ -937,7 +937,7 @@ bgp_export_attrs(struct bgp_export_state *s, ea_list *attrs)
|
||||||
static inline int
|
static inline int
|
||||||
bgp_encode_attr(struct bgp_write_state *s, eattr *a, byte *buf, uint size)
|
bgp_encode_attr(struct bgp_write_state *s, eattr *a, byte *buf, uint size)
|
||||||
{
|
{
|
||||||
ASSERT(EA_PROTO(a->id) == EAP_BGP);
|
ASSERT(EA_PROTO(a->id) == PROTOCOL_BGP);
|
||||||
|
|
||||||
uint code = EA_ID(a->id);
|
uint code = EA_ID(a->id);
|
||||||
|
|
||||||
|
@ -1405,7 +1405,7 @@ bgp_import_control(struct proto *P, rte **new, ea_list **attrs UNUSED, struct li
|
||||||
/* Handle well-known communities, RFC 1997 */
|
/* Handle well-known communities, RFC 1997 */
|
||||||
struct eattr *c;
|
struct eattr *c;
|
||||||
if (p->cf->interpret_communities &&
|
if (p->cf->interpret_communities &&
|
||||||
(c = ea_find(e->attrs->eattrs, EA_CODE(EAP_BGP, BA_COMMUNITY))))
|
(c = ea_find(e->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY))))
|
||||||
{
|
{
|
||||||
struct adata *d = c->u.ptr;
|
struct adata *d = c->u.ptr;
|
||||||
|
|
||||||
|
@ -1570,7 +1570,7 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old, ea
|
||||||
static inline u32
|
static inline u32
|
||||||
bgp_get_neighbor(rte *r)
|
bgp_get_neighbor(rte *r)
|
||||||
{
|
{
|
||||||
eattr *e = ea_find(r->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
eattr *e = ea_find(r->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
u32 as;
|
u32 as;
|
||||||
|
|
||||||
if (e && as_path_get_first_regular(e->u.ptr, &as))
|
if (e && as_path_get_first_regular(e->u.ptr, &as))
|
||||||
|
@ -1612,8 +1612,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Start with local preferences */
|
/* Start with local preferences */
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
|
||||||
n = x ? x->u.data : new_bgp->cf->default_local_pref;
|
n = x ? x->u.data : new_bgp->cf->default_local_pref;
|
||||||
o = y ? y->u.data : old_bgp->cf->default_local_pref;
|
o = y ? y->u.data : old_bgp->cf->default_local_pref;
|
||||||
if (n > o)
|
if (n > o)
|
||||||
|
@ -1624,8 +1624,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
/* RFC 4271 9.1.2.2. a) Use AS path lengths */
|
/* RFC 4271 9.1.2.2. a) Use AS path lengths */
|
||||||
if (new_bgp->cf->compare_path_lengths || old_bgp->cf->compare_path_lengths)
|
if (new_bgp->cf->compare_path_lengths || old_bgp->cf->compare_path_lengths)
|
||||||
{
|
{
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
n = x ? as_path_getlen(x->u.ptr) : AS_PATH_MAXLEN;
|
n = x ? as_path_getlen(x->u.ptr) : AS_PATH_MAXLEN;
|
||||||
o = y ? as_path_getlen(y->u.ptr) : AS_PATH_MAXLEN;
|
o = y ? as_path_getlen(y->u.ptr) : AS_PATH_MAXLEN;
|
||||||
if (n < o)
|
if (n < o)
|
||||||
|
@ -1635,8 +1635,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RFC 4271 9.1.2.2. b) Use origins */
|
/* RFC 4271 9.1.2.2. b) Use origins */
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
|
||||||
n = x ? x->u.data : ORIGIN_INCOMPLETE;
|
n = x ? x->u.data : ORIGIN_INCOMPLETE;
|
||||||
o = y ? y->u.data : ORIGIN_INCOMPLETE;
|
o = y ? y->u.data : ORIGIN_INCOMPLETE;
|
||||||
if (n < o)
|
if (n < o)
|
||||||
|
@ -1658,8 +1658,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
if (new_bgp->cf->med_metric || old_bgp->cf->med_metric ||
|
if (new_bgp->cf->med_metric || old_bgp->cf->med_metric ||
|
||||||
(bgp_get_neighbor(new) == bgp_get_neighbor(old)))
|
(bgp_get_neighbor(new) == bgp_get_neighbor(old)))
|
||||||
{
|
{
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC));
|
||||||
n = x ? x->u.data : new_bgp->cf->default_med;
|
n = x ? x->u.data : new_bgp->cf->default_med;
|
||||||
o = y ? y->u.data : old_bgp->cf->default_med;
|
o = y ? y->u.data : old_bgp->cf->default_med;
|
||||||
if (n < o)
|
if (n < o)
|
||||||
|
@ -1684,8 +1684,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
|
|
||||||
/* RFC 4271 9.1.2.2. f) Compare BGP identifiers */
|
/* RFC 4271 9.1.2.2. f) Compare BGP identifiers */
|
||||||
/* RFC 4456 9. a) Use ORIGINATOR_ID instead of local neighbor ID */
|
/* RFC 4456 9. a) Use ORIGINATOR_ID instead of local neighbor ID */
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGINATOR_ID));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGINATOR_ID));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID));
|
||||||
n = x ? x->u.data : new_bgp->remote_id;
|
n = x ? x->u.data : new_bgp->remote_id;
|
||||||
o = y ? y->u.data : old_bgp->remote_id;
|
o = y ? y->u.data : old_bgp->remote_id;
|
||||||
|
|
||||||
|
@ -1702,8 +1702,8 @@ bgp_rte_better(rte *new, rte *old)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* RFC 4456 9. b) Compare cluster list lengths */
|
/* RFC 4456 9. b) Compare cluster list lengths */
|
||||||
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_CLUSTER_LIST));
|
x = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST));
|
||||||
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_CLUSTER_LIST));
|
y = ea_find(old->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST));
|
||||||
n = x ? int_set_get_size(x->u.ptr) : 0;
|
n = x ? int_set_get_size(x->u.ptr) : 0;
|
||||||
o = y ? int_set_get_size(y->u.ptr) : 0;
|
o = y ? int_set_get_size(y->u.ptr) : 0;
|
||||||
if (n < o)
|
if (n < o)
|
||||||
|
@ -1733,8 +1733,8 @@ bgp_rte_mergable(rte *pri, rte *sec)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Start with local preferences */
|
/* Start with local preferences */
|
||||||
x = ea_find(pri->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));
|
x = ea_find(pri->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
|
||||||
y = ea_find(sec->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));
|
y = ea_find(sec->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
|
||||||
p = x ? x->u.data : pri_bgp->cf->default_local_pref;
|
p = x ? x->u.data : pri_bgp->cf->default_local_pref;
|
||||||
s = y ? y->u.data : sec_bgp->cf->default_local_pref;
|
s = y ? y->u.data : sec_bgp->cf->default_local_pref;
|
||||||
if (p != s)
|
if (p != s)
|
||||||
|
@ -1743,8 +1743,8 @@ bgp_rte_mergable(rte *pri, rte *sec)
|
||||||
/* RFC 4271 9.1.2.2. a) Use AS path lengths */
|
/* RFC 4271 9.1.2.2. a) Use AS path lengths */
|
||||||
if (pri_bgp->cf->compare_path_lengths || sec_bgp->cf->compare_path_lengths)
|
if (pri_bgp->cf->compare_path_lengths || sec_bgp->cf->compare_path_lengths)
|
||||||
{
|
{
|
||||||
x = ea_find(pri->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
x = ea_find(pri->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
y = ea_find(sec->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
y = ea_find(sec->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
p = x ? as_path_getlen(x->u.ptr) : AS_PATH_MAXLEN;
|
p = x ? as_path_getlen(x->u.ptr) : AS_PATH_MAXLEN;
|
||||||
s = y ? as_path_getlen(y->u.ptr) : AS_PATH_MAXLEN;
|
s = y ? as_path_getlen(y->u.ptr) : AS_PATH_MAXLEN;
|
||||||
|
|
||||||
|
@ -1756,8 +1756,8 @@ bgp_rte_mergable(rte *pri, rte *sec)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RFC 4271 9.1.2.2. b) Use origins */
|
/* RFC 4271 9.1.2.2. b) Use origins */
|
||||||
x = ea_find(pri->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN));
|
x = ea_find(pri->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
|
||||||
y = ea_find(sec->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN));
|
y = ea_find(sec->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
|
||||||
p = x ? x->u.data : ORIGIN_INCOMPLETE;
|
p = x ? x->u.data : ORIGIN_INCOMPLETE;
|
||||||
s = y ? y->u.data : ORIGIN_INCOMPLETE;
|
s = y ? y->u.data : ORIGIN_INCOMPLETE;
|
||||||
if (p != s)
|
if (p != s)
|
||||||
|
@ -1767,8 +1767,8 @@ bgp_rte_mergable(rte *pri, rte *sec)
|
||||||
if (pri_bgp->cf->med_metric || sec_bgp->cf->med_metric ||
|
if (pri_bgp->cf->med_metric || sec_bgp->cf->med_metric ||
|
||||||
(bgp_get_neighbor(pri) == bgp_get_neighbor(sec)))
|
(bgp_get_neighbor(pri) == bgp_get_neighbor(sec)))
|
||||||
{
|
{
|
||||||
x = ea_find(pri->attrs->eattrs, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC));
|
x = ea_find(pri->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC));
|
||||||
y = ea_find(sec->attrs->eattrs, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC));
|
y = ea_find(sec->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC));
|
||||||
p = x ? x->u.data : pri_bgp->cf->default_med;
|
p = x ? x->u.data : pri_bgp->cf->default_med;
|
||||||
s = y ? y->u.data : sec_bgp->cf->default_med;
|
s = y ? y->u.data : sec_bgp->cf->default_med;
|
||||||
if (p != s)
|
if (p != s)
|
||||||
|
@ -2009,8 +2009,8 @@ bgp_get_attr(eattr *a, byte *buf, int buflen)
|
||||||
void
|
void
|
||||||
bgp_get_route_info(rte *e, byte *buf, ea_list *attrs)
|
bgp_get_route_info(rte *e, byte *buf, ea_list *attrs)
|
||||||
{
|
{
|
||||||
eattr *p = ea_find(attrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
eattr *p = ea_find(attrs, EA_CODE(PROTOCOL_BGP, BA_AS_PATH));
|
||||||
eattr *o = ea_find(attrs, EA_CODE(EAP_BGP, BA_ORIGIN));
|
eattr *o = ea_find(attrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
|
||||||
u32 origas;
|
u32 origas;
|
||||||
|
|
||||||
buf += bsprintf(buf, " (%d", e->pref);
|
buf += bsprintf(buf, " (%d", e->pref);
|
||||||
|
|
|
@ -2148,7 +2148,7 @@ struct channel_class channel_bgp = {
|
||||||
struct protocol proto_bgp = {
|
struct protocol proto_bgp = {
|
||||||
.name = "BGP",
|
.name = "BGP",
|
||||||
.template = "bgp%d",
|
.template = "bgp%d",
|
||||||
.attr_class = EAP_BGP,
|
.class = PROTOCOL_BGP,
|
||||||
.preference = DEF_PREF_BGP,
|
.preference = DEF_PREF_BGP,
|
||||||
.channel_mask = NB_IP | NB_VPN | NB_FLOW,
|
.channel_mask = NB_IP | NB_VPN | NB_FLOW,
|
||||||
.proto_size = sizeof(struct bgp_proto),
|
.proto_size = sizeof(struct bgp_proto),
|
||||||
|
|
|
@ -462,7 +462,7 @@ struct rte_source *bgp_get_source(struct bgp_proto *p, u32 path_id);
|
||||||
static inline eattr *
|
static inline eattr *
|
||||||
bgp_find_attr(ea_list *attrs, uint code)
|
bgp_find_attr(ea_list *attrs, uint code)
|
||||||
{
|
{
|
||||||
return ea_find(attrs, EA_CODE(EAP_BGP, code));
|
return ea_find(attrs, EA_CODE(PROTOCOL_BGP, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
eattr *
|
eattr *
|
||||||
|
|
|
@ -253,29 +253,29 @@ bgp_proto_channel: bgp_channel_start bgp_channel_opt_list bgp_channel_end;
|
||||||
|
|
||||||
|
|
||||||
CF_ADDTO(dynamic_attr, BGP_ORIGIN
|
CF_ADDTO(dynamic_attr, BGP_ORIGIN
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(EAP_BGP, BA_ORIGIN)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_PATH
|
CF_ADDTO(dynamic_attr, BGP_PATH
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(EAP_BGP, BA_AS_PATH)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_NEXT_HOP
|
CF_ADDTO(dynamic_attr, BGP_NEXT_HOP
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(EAP_BGP, BA_NEXT_HOP)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_MED
|
CF_ADDTO(dynamic_attr, BGP_MED
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_LOCAL_PREF
|
CF_ADDTO(dynamic_attr, BGP_LOCAL_PREF
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_LOCAL_PREF)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_ATOMIC_AGGR
|
CF_ADDTO(dynamic_attr, BGP_ATOMIC_AGGR
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(EAP_BGP, BA_ATOMIC_AGGR)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_AGGREGATOR
|
CF_ADDTO(dynamic_attr, BGP_AGGREGATOR
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_AGGREGATOR)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_COMMUNITY
|
CF_ADDTO(dynamic_attr, BGP_COMMUNITY
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(EAP_BGP, BA_COMMUNITY)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_ORIGINATOR_ID
|
CF_ADDTO(dynamic_attr, BGP_ORIGINATOR_ID
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(EAP_BGP, BA_ORIGINATOR_ID)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_CLUSTER_LIST
|
CF_ADDTO(dynamic_attr, BGP_CLUSTER_LIST
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(EAP_BGP, BA_CLUSTER_LIST)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_EXT_COMMUNITY
|
CF_ADDTO(dynamic_attr, BGP_EXT_COMMUNITY
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(EAP_BGP, BA_EXT_COMMUNITY)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); })
|
||||||
CF_ADDTO(dynamic_attr, BGP_LARGE_COMMUNITY
|
CF_ADDTO(dynamic_attr, BGP_LARGE_COMMUNITY
|
||||||
{ $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(EAP_BGP, BA_LARGE_COMMUNITY)); })
|
{ $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ ospf_sh_lsadb(struct lsadb_show_data *ld)
|
||||||
struct protocol proto_ospf = {
|
struct protocol proto_ospf = {
|
||||||
.name = "OSPF",
|
.name = "OSPF",
|
||||||
.template = "ospf%d",
|
.template = "ospf%d",
|
||||||
.attr_class = EAP_OSPF,
|
.class = PROTOCOL_OSPF,
|
||||||
.preference = DEF_PREF_OSPF,
|
.preference = DEF_PREF_OSPF,
|
||||||
.channel_mask = NB_IP,
|
.channel_mask = NB_IP,
|
||||||
.proto_size = sizeof(struct ospf_proto),
|
.proto_size = sizeof(struct ospf_proto),
|
||||||
|
|
|
@ -863,10 +863,10 @@ struct lsadb_show_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define EA_OSPF_METRIC1 EA_CODE(EAP_OSPF, 0)
|
#define EA_OSPF_METRIC1 EA_CODE(PROTOCOL_OSPF, 0)
|
||||||
#define EA_OSPF_METRIC2 EA_CODE(EAP_OSPF, 1)
|
#define EA_OSPF_METRIC2 EA_CODE(PROTOCOL_OSPF, 1)
|
||||||
#define EA_OSPF_TAG EA_CODE(EAP_OSPF, 2)
|
#define EA_OSPF_TAG EA_CODE(PROTOCOL_OSPF, 2)
|
||||||
#define EA_OSPF_ROUTER_ID EA_CODE(EAP_OSPF, 3)
|
#define EA_OSPF_ROUTER_ID EA_CODE(PROTOCOL_OSPF, 3)
|
||||||
|
|
||||||
|
|
||||||
/* ospf.c */
|
/* ospf.c */
|
||||||
|
|
|
@ -275,6 +275,7 @@ pipe_show_proto_info(struct proto *P)
|
||||||
struct protocol proto_pipe = {
|
struct protocol proto_pipe = {
|
||||||
.name = "Pipe",
|
.name = "Pipe",
|
||||||
.template = "pipe%d",
|
.template = "pipe%d",
|
||||||
|
.class = PROTOCOL_PIPE,
|
||||||
.proto_size = sizeof(struct pipe_proto),
|
.proto_size = sizeof(struct pipe_proto),
|
||||||
.config_size = sizeof(struct pipe_config),
|
.config_size = sizeof(struct pipe_config),
|
||||||
.postconfig = pipe_postconfig,
|
.postconfig = pipe_postconfig,
|
||||||
|
|
|
@ -762,7 +762,7 @@ radv_get_attr(eattr *a, byte *buf, int buflen UNUSED)
|
||||||
struct protocol proto_radv = {
|
struct protocol proto_radv = {
|
||||||
.name = "RAdv",
|
.name = "RAdv",
|
||||||
.template = "radv%d",
|
.template = "radv%d",
|
||||||
.attr_class = EAP_RADV,
|
.class = PROTOCOL_RADV,
|
||||||
.channel_mask = NB_IP6,
|
.channel_mask = NB_IP6,
|
||||||
.proto_size = sizeof(struct radv_proto),
|
.proto_size = sizeof(struct radv_proto),
|
||||||
.config_size = sizeof(struct radv_config),
|
.config_size = sizeof(struct radv_config),
|
||||||
|
|
|
@ -192,8 +192,8 @@ struct radv_iface
|
||||||
#define RA_PREF_MASK 0x18
|
#define RA_PREF_MASK 0x18
|
||||||
|
|
||||||
/* Attributes */
|
/* Attributes */
|
||||||
#define EA_RA_PREFERENCE EA_CODE(EAP_RADV, 0)
|
#define EA_RA_PREFERENCE EA_CODE(PROTOCOL_RADV, 0)
|
||||||
#define EA_RA_LIFETIME EA_CODE(EAP_RADV, 1)
|
#define EA_RA_LIFETIME EA_CODE(PROTOCOL_RADV, 1)
|
||||||
|
|
||||||
#ifdef LOCAL_DEBUG
|
#ifdef LOCAL_DEBUG
|
||||||
#define RADV_FORCE_DEBUG 1
|
#define RADV_FORCE_DEBUG 1
|
||||||
|
|
|
@ -1274,7 +1274,7 @@ rip_dump(struct proto *P)
|
||||||
struct protocol proto_rip = {
|
struct protocol proto_rip = {
|
||||||
.name = "RIP",
|
.name = "RIP",
|
||||||
.template = "rip%d",
|
.template = "rip%d",
|
||||||
.attr_class = EAP_RIP,
|
.class = PROTOCOL_RIP,
|
||||||
.preference = DEF_PREF_RIP,
|
.preference = DEF_PREF_RIP,
|
||||||
.channel_mask = NB_IP,
|
.channel_mask = NB_IP,
|
||||||
.proto_size = sizeof(struct rip_proto),
|
.proto_size = sizeof(struct rip_proto),
|
||||||
|
|
|
@ -182,8 +182,8 @@ struct rip_rte
|
||||||
#define RIP_ENTRY_VALID 1 /* Valid outgoing route */
|
#define RIP_ENTRY_VALID 1 /* Valid outgoing route */
|
||||||
#define RIP_ENTRY_STALE 2 /* Stale outgoing route, waiting for GC */
|
#define RIP_ENTRY_STALE 2 /* Stale outgoing route, waiting for GC */
|
||||||
|
|
||||||
#define EA_RIP_METRIC EA_CODE(EAP_RIP, 0)
|
#define EA_RIP_METRIC EA_CODE(PROTOCOL_RIP, 0)
|
||||||
#define EA_RIP_TAG EA_CODE(EAP_RIP, 1)
|
#define EA_RIP_TAG EA_CODE(PROTOCOL_RIP, 1)
|
||||||
|
|
||||||
static inline int rip_is_v2(struct rip_proto *p)
|
static inline int rip_is_v2(struct rip_proto *p)
|
||||||
{ return p->rip2; }
|
{ return p->rip2; }
|
||||||
|
|
|
@ -913,6 +913,7 @@ rpki_copy_config(struct proto_config *dest UNUSED, struct proto_config *src UNUS
|
||||||
struct protocol proto_rpki = {
|
struct protocol proto_rpki = {
|
||||||
.name = "RPKI",
|
.name = "RPKI",
|
||||||
.template = "rpki%d",
|
.template = "rpki%d",
|
||||||
|
.class = PROTOCOL_RPKI,
|
||||||
.preference = DEF_PREF_RPKI,
|
.preference = DEF_PREF_RPKI,
|
||||||
.proto_size = sizeof(struct rpki_proto),
|
.proto_size = sizeof(struct rpki_proto),
|
||||||
.config_size = sizeof(struct rpki_config),
|
.config_size = sizeof(struct rpki_config),
|
||||||
|
|
|
@ -656,6 +656,7 @@ static_show(struct proto *P)
|
||||||
struct protocol proto_static = {
|
struct protocol proto_static = {
|
||||||
.name = "Static",
|
.name = "Static",
|
||||||
.template = "static%d",
|
.template = "static%d",
|
||||||
|
.class = PROTOCOL_STATIC,
|
||||||
.preference = DEF_PREF_STATIC,
|
.preference = DEF_PREF_STATIC,
|
||||||
.channel_mask = NB_ANY,
|
.channel_mask = NB_ANY,
|
||||||
.proto_size = sizeof(struct static_proto),
|
.proto_size = sizeof(struct static_proto),
|
||||||
|
|
|
@ -34,9 +34,9 @@ static inline struct ifa * kif_get_primary_ip(struct iface *i UNUSED) { return N
|
||||||
|
|
||||||
#define KRT_ALLOW_MERGE_PATHS 1
|
#define KRT_ALLOW_MERGE_PATHS 1
|
||||||
|
|
||||||
#define EA_KRT_PREFSRC EA_CODE(EAP_KRT, 0x10)
|
#define EA_KRT_PREFSRC EA_CODE(PROTOCOL_KERNEL, 0x10)
|
||||||
#define EA_KRT_REALM EA_CODE(EAP_KRT, 0x11)
|
#define EA_KRT_REALM EA_CODE(PROTOCOL_KERNEL, 0x11)
|
||||||
#define EA_KRT_SCOPE EA_CODE(EAP_KRT, 0x12)
|
#define EA_KRT_SCOPE EA_CODE(PROTOCOL_KERNEL, 0x12)
|
||||||
|
|
||||||
|
|
||||||
#define KRT_METRICS_MAX 0x10 /* RTAX_QUICKACK+1 */
|
#define KRT_METRICS_MAX 0x10 /* RTAX_QUICKACK+1 */
|
||||||
|
@ -48,22 +48,22 @@ static inline struct ifa * kif_get_primary_ip(struct iface *i UNUSED) { return N
|
||||||
* Following attributes are parts of RTA_METRICS kernel route attribute, their
|
* Following attributes are parts of RTA_METRICS kernel route attribute, their
|
||||||
* ids must be consistent with their RTAX_* constants (+ KRT_METRICS_OFFSET)
|
* ids must be consistent with their RTAX_* constants (+ KRT_METRICS_OFFSET)
|
||||||
*/
|
*/
|
||||||
#define EA_KRT_METRICS EA_CODE(EAP_KRT, 0x20) /* Dummy one */
|
#define EA_KRT_METRICS EA_CODE(PROTOCOL_KERNEL, 0x20) /* Dummy one */
|
||||||
#define EA_KRT_LOCK EA_CODE(EAP_KRT, 0x21)
|
#define EA_KRT_LOCK EA_CODE(PROTOCOL_KERNEL, 0x21)
|
||||||
#define EA_KRT_MTU EA_CODE(EAP_KRT, 0x22)
|
#define EA_KRT_MTU EA_CODE(PROTOCOL_KERNEL, 0x22)
|
||||||
#define EA_KRT_WINDOW EA_CODE(EAP_KRT, 0x23)
|
#define EA_KRT_WINDOW EA_CODE(PROTOCOL_KERNEL, 0x23)
|
||||||
#define EA_KRT_RTT EA_CODE(EAP_KRT, 0x24)
|
#define EA_KRT_RTT EA_CODE(PROTOCOL_KERNEL, 0x24)
|
||||||
#define EA_KRT_RTTVAR EA_CODE(EAP_KRT, 0x25)
|
#define EA_KRT_RTTVAR EA_CODE(PROTOCOL_KERNEL, 0x25)
|
||||||
#define EA_KRT_SSTRESH EA_CODE(EAP_KRT, 0x26)
|
#define EA_KRT_SSTRESH EA_CODE(PROTOCOL_KERNEL, 0x26)
|
||||||
#define EA_KRT_CWND EA_CODE(EAP_KRT, 0x27)
|
#define EA_KRT_CWND EA_CODE(PROTOCOL_KERNEL, 0x27)
|
||||||
#define EA_KRT_ADVMSS EA_CODE(EAP_KRT, 0x28)
|
#define EA_KRT_ADVMSS EA_CODE(PROTOCOL_KERNEL, 0x28)
|
||||||
#define EA_KRT_REORDERING EA_CODE(EAP_KRT, 0x29)
|
#define EA_KRT_REORDERING EA_CODE(PROTOCOL_KERNEL, 0x29)
|
||||||
#define EA_KRT_HOPLIMIT EA_CODE(EAP_KRT, 0x2a)
|
#define EA_KRT_HOPLIMIT EA_CODE(PROTOCOL_KERNEL, 0x2a)
|
||||||
#define EA_KRT_INITCWND EA_CODE(EAP_KRT, 0x2b)
|
#define EA_KRT_INITCWND EA_CODE(PROTOCOL_KERNEL, 0x2b)
|
||||||
#define EA_KRT_FEATURES EA_CODE(EAP_KRT, 0x2c)
|
#define EA_KRT_FEATURES EA_CODE(PROTOCOL_KERNEL, 0x2c)
|
||||||
#define EA_KRT_RTO_MIN EA_CODE(EAP_KRT, 0x2d)
|
#define EA_KRT_RTO_MIN EA_CODE(PROTOCOL_KERNEL, 0x2d)
|
||||||
#define EA_KRT_INITRWND EA_CODE(EAP_KRT, 0x2e)
|
#define EA_KRT_INITRWND EA_CODE(PROTOCOL_KERNEL, 0x2e)
|
||||||
#define EA_KRT_QUICKACK EA_CODE(EAP_KRT, 0x2f)
|
#define EA_KRT_QUICKACK EA_CODE(PROTOCOL_KERNEL, 0x2f)
|
||||||
|
|
||||||
/* Bits of EA_KRT_LOCK, also based on RTAX_* constants */
|
/* Bits of EA_KRT_LOCK, also based on RTAX_* constants */
|
||||||
#define EA_KRT_LOCK_MTU EA_KRT_LOCK | EA_BIT(0x2)
|
#define EA_KRT_LOCK_MTU EA_KRT_LOCK | EA_BIT(0x2)
|
||||||
|
|
|
@ -1751,7 +1751,7 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
||||||
for (t = 1; t < KRT_METRICS_MAX; t++)
|
for (t = 1; t < KRT_METRICS_MAX; t++)
|
||||||
if (metrics[0] & (1 << t))
|
if (metrics[0] & (1 << t))
|
||||||
{
|
{
|
||||||
ea->attrs[n].id = EA_CODE(EAP_KRT, KRT_METRICS_OFFSET + t);
|
ea->attrs[n].id = EA_CODE(PROTOCOL_KERNEL, KRT_METRICS_OFFSET + t);
|
||||||
ea->attrs[n].flags = 0;
|
ea->attrs[n].flags = 0;
|
||||||
ea->attrs[n].type = EAF_TYPE_INT; /* FIXME: Some are EAF_TYPE_BITFIELD */
|
ea->attrs[n].type = EAF_TYPE_INT; /* FIXME: Some are EAF_TYPE_BITFIELD */
|
||||||
ea->attrs[n].u.data = metrics[t];
|
ea->attrs[n].u.data = metrics[t];
|
||||||
|
|
|
@ -232,6 +232,7 @@ kif_copy_config(struct proto_config *dest, struct proto_config *src)
|
||||||
struct protocol proto_unix_iface = {
|
struct protocol proto_unix_iface = {
|
||||||
.name = "Device",
|
.name = "Device",
|
||||||
.template = "device%d",
|
.template = "device%d",
|
||||||
|
.class = PROTOCOL_DEVICE,
|
||||||
.proto_size = sizeof(struct kif_proto),
|
.proto_size = sizeof(struct kif_proto),
|
||||||
.config_size = sizeof(struct kif_config),
|
.config_size = sizeof(struct kif_config),
|
||||||
.preconfig = kif_preconfig,
|
.preconfig = kif_preconfig,
|
||||||
|
@ -1235,7 +1236,7 @@ krt_get_attr(eattr *a, byte *buf, int buflen)
|
||||||
struct protocol proto_unix_kernel = {
|
struct protocol proto_unix_kernel = {
|
||||||
.name = "Kernel",
|
.name = "Kernel",
|
||||||
.template = "kernel%d",
|
.template = "kernel%d",
|
||||||
.attr_class = EAP_KRT,
|
.class = PROTOCOL_KERNEL,
|
||||||
.preference = DEF_PREF_INHERITED,
|
.preference = DEF_PREF_INHERITED,
|
||||||
.channel_mask = NB_IP | MAYBE_IP6_SADR | MAYBE_MPLS,
|
.channel_mask = NB_IP | MAYBE_IP6_SADR | MAYBE_MPLS,
|
||||||
.proto_size = sizeof(struct krt_proto),
|
.proto_size = sizeof(struct krt_proto),
|
||||||
|
|
|
@ -30,8 +30,8 @@ struct kif_proto;
|
||||||
|
|
||||||
#define KRT_DEFAULT_ECMP_LIMIT 16
|
#define KRT_DEFAULT_ECMP_LIMIT 16
|
||||||
|
|
||||||
#define EA_KRT_SOURCE EA_CODE(EAP_KRT, 0)
|
#define EA_KRT_SOURCE EA_CODE(PROTOCOL_KERNEL, 0)
|
||||||
#define EA_KRT_METRIC EA_CODE(EAP_KRT, 1)
|
#define EA_KRT_METRIC EA_CODE(PROTOCOL_KERNEL, 1)
|
||||||
|
|
||||||
/* Whenever we recognize our own routes, we allow learing of foreign routes */
|
/* Whenever we recognize our own routes, we allow learing of foreign routes */
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ bt_bird_init(void)
|
||||||
|
|
||||||
void bt_bird_cleanup(void)
|
void bt_bird_cleanup(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < EAP_MAX; i++)
|
for (int i = 0; i < PROTOCOL__MAX; i++)
|
||||||
attr_class_to_protocol[i] = NULL;
|
class_to_protocol[i] = NULL;
|
||||||
|
|
||||||
config = new_config = NULL;
|
config = new_config = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue