diff options
author | Jan Moskyto Matejka <mq@ucw.cz> | 2016-03-04 12:55:50 +0100 |
---|---|---|
committer | Jan Moskyto Matejka <mq@ucw.cz> | 2016-12-22 21:38:33 +0100 |
commit | d14f8c3c45f7e33a7e54ebc0d45bdb0295d70301 (patch) | |
tree | e7dadc1408d852a36075efc64a9bdb15630efdd4 /nest | |
parent | f2010f9c65ca69584c34c762fb3e5e957958478e (diff) |
Netlink: MPLS routes in kernel
Anyway, Bird is now capable to insert both MPLS routes and MPLS encap
routes into kernel.
It was (among others) needed to define platform-specific AF_MPLS to 28
as this constant has been assigned in the linux kernel.
No support for BSD now, it may be added in the future.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 5 | ||||
-rw-r--r-- | nest/rt-attr.c | 4 | ||||
-rw-r--r-- | nest/rt-table.c | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/nest/route.h b/nest/route.h index c293fbb1..a2fadf62 100644 --- a/nest/route.h +++ b/nest/route.h @@ -512,8 +512,7 @@ uint ea_hash(ea_list *e); /* Calculate 16-bit hash value */ ea_list *ea_append(ea_list *to, ea_list *what); void ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max); -#define NEXTHOP_MAX_LABEL_STACK 8 -#define NEXTHOP_MAX_SIZE (sizeof(struct nexthop) + sizeof(u32)*NEXTHOP_MAX_LABEL_STACK) +#define NEXTHOP_MAX_SIZE (sizeof(struct nexthop) + sizeof(u32)*MPLS_MAX_LABEL_STACK) static inline size_t nexthop_size(const struct nexthop *nh) { return sizeof(struct nexthop) + sizeof(u32)*nh->labels; } @@ -528,7 +527,7 @@ int nexthop_is_sorted(struct nexthop *x); void rta_init(void); static inline size_t rta_size(const rta *a) { return sizeof(rta) + sizeof(u32)*a->nh.labels; } -#define RTA_MAX_SIZE (sizeof(rta) + sizeof(u32)*NEXTHOP_MAX_LABEL_STACK) +#define RTA_MAX_SIZE (sizeof(rta) + sizeof(u32)*MPLS_MAX_LABEL_STACK) rta *rta_lookup(rta *); /* Get rta equivalent to this one, uc++ */ static inline int rta_is_cached(rta *r) { return r->aflags & RTAF_CACHED; } static inline rta *rta_clone(rta *r) { r->uc++; return r; } diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 22a5cb14..120a8e24 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -1279,12 +1279,12 @@ rta_init(void) rta_slab_[0] = sl_new(rta_pool, sizeof(rta)); rta_slab_[1] = sl_new(rta_pool, sizeof(rta) + sizeof(u32)); rta_slab_[2] = sl_new(rta_pool, sizeof(rta) + sizeof(u32)*2); - rta_slab_[3] = sl_new(rta_pool, sizeof(rta) + sizeof(u32)*NEXTHOP_MAX_LABEL_STACK); + rta_slab_[3] = sl_new(rta_pool, sizeof(rta) + sizeof(u32)*MPLS_MAX_LABEL_STACK); nexthop_slab_[0] = sl_new(rta_pool, sizeof(struct nexthop)); nexthop_slab_[1] = sl_new(rta_pool, sizeof(struct nexthop) + sizeof(u32)); nexthop_slab_[2] = sl_new(rta_pool, sizeof(struct nexthop) + sizeof(u32)*2); - nexthop_slab_[3] = sl_new(rta_pool, sizeof(struct nexthop) + sizeof(u32)*NEXTHOP_MAX_LABEL_STACK); + nexthop_slab_[3] = sl_new(rta_pool, sizeof(struct nexthop) + sizeof(u32)*MPLS_MAX_LABEL_STACK); rta_alloc_hash(); rte_src_init(); diff --git a/nest/rt-table.c b/nest/rt-table.c index 92542ea8..73b838be 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2487,7 +2487,7 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, ea_list *tm tm, from, primary ? (sync_error ? " !" : " *") : "", info); for (nh = &(a->nh); nh; nh = nh->next) { - char ls[NEXTHOP_MAX_LABEL_STACK*8 + 5]; char *lsp = ls; + char ls[MPLS_MAX_LABEL_STACK*8 + 5]; char *lsp = ls; if (nh->labels) { lsp += bsprintf(lsp, " mpls %d", nh->label[0]); |