summaryrefslogtreecommitdiffstats
path: root/proto/bgp
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-12-14 23:31:25 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-12-14 23:31:25 +0100
commit43c1ceccb9caf8c4f63f191346c2f33889b4ad22 (patch)
tree4f32ef3db1e6c249dd630f4822dfdaf2fc30d5d2 /proto/bgp
parent13a7395704deeeff2d86910d8bcf9a6f32a7b207 (diff)
downloadbird-43c1ceccb9caf8c4f63f191346c2f33889b4ad22.tar
bird-43c1ceccb9caf8c4f63f191346c2f33889b4ad22.zip
Remove bgp_as4_support variable.
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c34
-rw-r--r--proto/bgp/bgp.c6
-rw-r--r--proto/bgp/bgp.h2
-rw-r--r--proto/bgp/config.Y2
4 files changed, 11 insertions, 33 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 7b49bdf..ec81bd0 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -196,16 +196,8 @@ bgp_format_aggregator(eattr *a, byte *buf, int buflen UNUSED)
byte *data = ad->data;
u32 as;
- if (bgp_as4_support)
- {
- as = get_u32(data);
- data += 4;
- }
- else
- {
- as = get_u16(data);
- data += 2;
- }
+ as = get_u32(data);
+ data += 4;
bsprintf(buf, "%d.%d.%d.%d AS%d", data[0], data[1], data[2], data[3], as);
}
@@ -279,9 +271,8 @@ static struct attr_desc bgp_attr_table[] = {
NULL, NULL }
};
-/* BA_AS4_PATH is type EAF_TYPE_OPAQUE and not type EAF_TYPE_AS_PATH because
- * EAF_TYPE_AS_PATH is supposed to have different format (2 or 4 B for each ASN)
- * depending on bgp_as4_support variable.
+/* BA_AS4_PATH is type EAF_TYPE_OPAQUE and not type EAF_TYPE_AS_PATH.
+ * It does not matter as this attribute does not appear on routes in the routing table.
*/
#define ATTR_KNOWN(code) ((code) < ARRAY_SIZE(bgp_attr_table) && bgp_attr_table[code].name)
@@ -449,7 +440,7 @@ bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains)
* we have to convert our 4B AS_PATH to 2B AS_PATH and send our AS_PATH
* as optional AS4_PATH attribute.
*/
- if ((code == BA_AS_PATH) && bgp_as4_support && (! p->as4_session))
+ if ((code == BA_AS_PATH) && (! p->as4_session))
{
len = a->u.ptr->length;
@@ -491,7 +482,7 @@ bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains)
}
/* The same issue with AGGREGATOR attribute */
- if ((code == BA_AGGREGATOR) && bgp_as4_support && (! p->as4_session))
+ if ((code == BA_AGGREGATOR) && (! p->as4_session))
{
int new_used;
@@ -864,14 +855,10 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p
bgp_set_attr_wa(ea->attrs+1, pool, BA_AS_PATH, 0);
else
{
- z = bgp_set_attr_wa(ea->attrs+1, pool, BA_AS_PATH, bgp_as4_support ? 6 : 4);
+ z = bgp_set_attr_wa(ea->attrs+1, pool, BA_AS_PATH, 6);
z[0] = AS_PATH_SEQUENCE;
z[1] = 1; /* 1 AS */
-
- if (bgp_as4_support)
- put_u32(z+2, p->local_as);
- else
- put_u16(z+2, p->local_as);
+ put_u32(z+2, p->local_as);
}
z = bgp_set_attr_wa(ea->attrs+2, pool, BA_NEXT_HOP, NEXT_HOP_LENGTH);
@@ -1416,11 +1403,10 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin
/* When receiving attributes from non-AS4-aware BGP speaker,
* we have to reconstruct 4B AS_PATH and AGGREGATOR attributes
*/
- if (bgp_as4_support && (! bgp->as4_session))
+ if (! bgp->as4_session)
bgp_reconstruct_4b_atts(bgp, a, pool);
- if (bgp_as4_support)
- bgp_remove_as4_attrs(bgp, a);
+ bgp_remove_as4_attrs(bgp, a);
/* If the AS path attribute contains our AS, reject the routes */
if (bgp_as_path_loopy(bgp, a))
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 24cd202..3cbcb6d 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -884,12 +884,6 @@ bgp_check(struct bgp_config *c)
if (!c->remote_as)
cf_error("Neighbor must be configured");
- if (!bgp_as4_support && c->enable_as4)
- cf_error("AS4 support disabled globally");
-
- if (!bgp_as4_support && (c->local_as > 0xFFFF))
- cf_error("Local AS number out of range");
-
if (!(c->capabilities && c->enable_as4) && (c->remote_as > 0xFFFF))
cf_error("Neighbor AS number out of range (AS4 not available)");
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 59ec9c1..7cbd655 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -132,8 +132,6 @@ struct bgp_bucket {
extern struct linpool *bgp_linpool;
-extern int bgp_as4_support;
-
void bgp_start_timer(struct timer *t, int value);
void bgp_check(struct bgp_config *c);
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 3c73d60..a469b4d 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -41,7 +41,7 @@ bgp_proto_start: proto_start BGP {
BGP_CFG->error_delay_time_min = 60;
BGP_CFG->error_delay_time_max = 300;
BGP_CFG->enable_refresh = 1;
- BGP_CFG->enable_as4 = bgp_as4_support;
+ BGP_CFG->enable_as4 = 1;
BGP_CFG->capabilities = 2;
BGP_CFG->advertise_ipv4 = 1;
}