summaryrefslogtreecommitdiffstats
path: root/proto/bgp/attrs.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-21 14:25:35 +0200
committerMartin Mares <mj@ucw.cz>2000-04-21 14:25:35 +0200
commit2a9e064d7b41ae6e944dd9fbcb18b89e8fda0dba (patch)
treea4c7df02e0857276b4244eebd1b25b807c48eec0 /proto/bgp/attrs.c
parentf380aa60faa41872b78155f899518b25933d18b9 (diff)
downloadbird-2a9e064d7b41ae6e944dd9fbcb18b89e8fda0dba.tar
bird-2a9e064d7b41ae6e944dd9fbcb18b89e8fda0dba.zip
If no NLRI's are present in an UPDATE message, parse the attributes, but
don't check presence of mandatory attributes. [draft-09]
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r--proto/bgp/attrs.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index fa2649c..f7d7b78 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -676,7 +676,7 @@ bgp_path_loopy(struct bgp_proto *p, eattr *a)
}
struct rta *
-bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct linpool *pool)
+bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct linpool *pool, int mandatory)
{
struct bgp_proto *bgp = conn->bgp;
rta *a = lp_alloc(pool, sizeof(struct rta));
@@ -800,13 +800,16 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin
}
/* Check if all mandatory attributes are present */
- for(i=0; i < sizeof(bgp_mandatory_attrs)/sizeof(bgp_mandatory_attrs[0]); i++)
+ if (mandatory)
{
- code = bgp_mandatory_attrs[i];
- if (!(seen[code/8] & (1 << (code%8))))
+ for(i=0; i < sizeof(bgp_mandatory_attrs)/sizeof(bgp_mandatory_attrs[0]); i++)
{
- bgp_error(conn, 3, 3, code, 1);
- return NULL;
+ code = bgp_mandatory_attrs[i];
+ if (!(seen[code/8] & (1 << (code%8))))
+ {
+ bgp_error(conn, 3, 3, code, 1);
+ return NULL;
+ }
}
}
@@ -831,7 +834,7 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin
neigh = neigh_find(&bgp->p, &nexthop, 0) ? : bgp->neigh;
a->gw = neigh->addr;
a->iface = neigh->iface;
- return rta_lookup(a);
+ return a;
malformed:
bgp_error(conn, 3, 1, len, 0);