diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-path.c | 31 | ||||
-rw-r--r-- | nest/attrs.h | 1 | ||||
-rw-r--r-- | nest/config.Y | 2 | ||||
-rw-r--r-- | nest/proto.c | 3 | ||||
-rw-r--r-- | nest/route.h | 2 |
5 files changed, 35 insertions, 4 deletions
diff --git a/nest/a-path.c b/nest/a-path.c index c9c5aefb..32e2d27e 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -220,7 +220,7 @@ as_path_get_last(struct adata *path, u32 *orig_as) p += BS * len; } break; - default: bug("as_path_get_first: Invalid path segment"); + default: bug("Invalid path segment"); } } @@ -229,6 +229,35 @@ as_path_get_last(struct adata *path, u32 *orig_as) return found; } +u32 +as_path_get_last_nonaggregated(struct adata *path) +{ + u8 *p = path->data; + u8 *q = p+path->length; + u32 res = 0; + int len; + + while (p<q) + { + switch (*p++) + { + case AS_PATH_SET: + return res; + + case AS_PATH_SEQUENCE: + if (len = *p++) + res = get_as(p + BS * (len - 1)); + p += BS * len; + break; + + default: bug("Invalid path segment"); + } + } + + return res; +} + + int as_path_get_first(struct adata *path, u32 *last_as) { diff --git a/nest/attrs.h b/nest/attrs.h index 1d005a6a..0171c6a8 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -35,6 +35,7 @@ int as_path_getlen(struct adata *path); int as_path_getlen_int(struct adata *path, int bs); int as_path_get_first(struct adata *path, u32 *orig_as); int as_path_get_last(struct adata *path, u32 *last_as); +u32 as_path_get_last_nonaggregated(struct adata *path); int as_path_contains(struct adata *path, u32 as, int min); int as_path_match_set(struct adata *path, struct f_tree *set); struct adata *as_path_filter(struct linpool *pool, struct adata *path, struct f_tree *set, u32 key, int pos); diff --git a/nest/config.Y b/nest/config.Y index 6bb686c3..94a67670 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -112,7 +112,7 @@ idval: else if (($1->class == (SYM_CONSTANT | T_IP)) && ipa_is_ip4(SYM_VAL($1).ip)) $$ = ipa_to_u32(SYM_VAL($1).ip); else - cf_error("Number of IPv4 address constant expected"); + cf_error("Number or IPv4 address constant expected"); } ; diff --git a/nest/proto.c b/nest/proto.c index f712fe5f..df4952b7 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -264,6 +264,7 @@ channel_stop_export(struct channel *c) rt_feed_channel_abort(c); c->export_state = ES_DOWN; + c->stats.exp_routes = 0; } static void @@ -299,7 +300,7 @@ channel_do_flush(struct channel *c) static void channel_do_down(struct channel *c) { - rem2_node(&c->table_node); + rem_node(&c->table_node); rt_unlock_table(c->table); c->proto->active_channels--; diff --git a/nest/route.h b/nest/route.h index 08179d73..39475309 100644 --- a/nest/route.h +++ b/nest/route.h @@ -232,8 +232,8 @@ typedef struct rte { struct { /* Routes generated by krt sync (both temporary and inherited ones) */ s8 src; /* Alleged route source (see krt.h) */ u8 proto; /* Kernel source protocol ID */ - u8 type; /* Kernel route type */ u8 seen; /* Seen during last scan */ + u8 best; /* Best route in network, propagated to core */ u32 metric; /* Kernel metric */ } krt; } u; |