summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:09:31 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:28:33 +0200
commit7a7ac656829223713f9e6bcef63d2b5a5efce7d2 (patch)
tree153afd214a815124b37fcd88c66134d716a390cf /nest
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
parent06edbb67ed807811654e7fd8f0f9b83766430216 (diff)
Merge branch 'master' into int-new-channels
Diffstat (limited to 'nest')
-rw-r--r--nest/a-path.c31
-rw-r--r--nest/attrs.h1
-rw-r--r--nest/config.Y2
-rw-r--r--nest/proto.c3
-rw-r--r--nest/route.h2
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 22fca331..11b08ce5 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;