diff options
author | Martin Mares <mj@ucw.cz> | 2000-04-17 09:53:29 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-04-17 09:53:29 +0200 |
commit | c0668f36967ce651e452a476b786b7604038a556 (patch) | |
tree | 37ce9ac274e1badc32f0e7badc4d6e8dd2e78213 /proto/bgp/attrs.c | |
parent | ebff007f08965d83dba5840ee02171d09ac2598d (diff) | |
download | bird-c0668f36967ce651e452a476b786b7604038a556.tar bird-c0668f36967ce651e452a476b786b7604038a556.zip |
Created nest/a-path.c and a-set.c which should contain general operations
on AS paths and community sets.
Moved as_path_prepend() there.
Pavel, please move the other functions as well.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r-- | proto/bgp/attrs.c | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index dc74770..6d4fd9c 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -12,6 +12,7 @@ #include "nest/iface.h" #include "nest/protocol.h" #include "nest/route.h" +#include "nest/attrs.h" #include "conf/conf.h" #include "lib/resource.h" #include "lib/string.h" @@ -278,31 +279,6 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p return 0; /* Leave decision to the filters */ } -struct adata * -as_path_prepend(struct linpool *pool, struct adata *olda, int as) -{ - struct adata *newa; - - if (olda->length && olda->data[0] == 2 && olda->data[1] < 255) /* Starting with sequence => just prepend the AS number */ - { - newa = lp_alloc(pool, sizeof(struct adata) + olda->length + 2); - newa->length = olda->length + 2; - newa->data[0] = 2; - newa->data[1] = olda->data[1] + 1; - memcpy(newa->data+4, olda->data+2, olda->length-2); - } - else /* Create new path segment */ - { - newa = lp_alloc(pool, sizeof(struct adata) + olda->length + 4); - newa->length = olda->length + 4; - newa->data[0] = 2; - newa->data[1] = 1; - memcpy(newa->data+4, olda->data, olda->length); - } - put_u16(newa->data+2, as); - return newa; -} - static ea_list * bgp_path_prepend(struct linpool *pool, eattr *a, ea_list *old, int as) { |