From b6bf284a905412cfe107b4967e55649e6194187e Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 26 Oct 2008 22:59:21 +0100 Subject: Bugfixes in MULIT_EXIT_DISC attribute handling. - Old MED handling was completely different from behavior specified in RFCs - for example they havn't been propagated to neighboring areas. - Update tie-breaking according to RFC 4271. - Change default value for 'default bgp_med' configuration option according to RFC 4271. --- nest/a-path.c | 14 ++++++++++++++ nest/attrs.h | 1 + 2 files changed, 15 insertions(+) (limited to 'nest') diff --git a/nest/a-path.c b/nest/a-path.c index f466691..5e3ecfd 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -243,6 +243,20 @@ as_path_get_first(struct adata *path, u32 *orig_as) return found; } +int +as_path_get_last(struct adata *path, u32 *last_as) +{ + u8 *p = path->data; + + if ((path->length == 0) || (p[0] != AS_PATH_SEQUENCE) || (p[1] == 0)) + return 0; + else + { + *last_as = get_as(p+2); + return 1; + } +} + int as_path_is_member(struct adata *path, u32 as) { diff --git a/nest/attrs.h b/nest/attrs.h index aaa5f4a..fee2c2c 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -27,6 +27,7 @@ int as_path_convert_to_new(struct adata *path, byte *dst, int req_as); void as_path_format(struct adata *path, byte *buf, unsigned int size); int as_path_getlen(struct adata *path); int as_path_get_first(struct adata *path, u32 *orig_as); +int as_path_get_last(struct adata *path, u32 *last_as); int as_path_is_member(struct adata *path, u32 as); -- cgit v1.2.3