summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-04-28 12:14:59 +0200
committerPavel Machek <pavel@ucw.cz>2000-04-28 12:14:59 +0200
commita769a180d77b88fbfc77cae3e895a320007f6e30 (patch)
treef4ed943a81a918e559f9becc55180ca67aa5de53 /proto
parent6c0a7174af459d62a52e97d15da29528169a68f9 (diff)
downloadbird-a769a180d77b88fbfc77cae3e895a320007f6e30.tar
bird-a769a180d77b88fbfc77cae3e895a320007f6e30.zip
Provide rip_get_attr, how do I test it?
Diffstat (limited to 'proto')
-rw-r--r--proto/rip/rip.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 22223d3..ba19a79 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -13,22 +13,12 @@
FIXME (nonurgent): fold rip_connection into rip_interface?
- We are not going to honour requests for sending part of
- routing table. That would need to turn split horizon off,
- etc.
-
- Triggered updates. When triggered update was sent, don't send
- new one for something between 1 and 5 seconds (and send one
- after that), says RFC. We do something else: once in 5 second
- we look for any changed routes and broadcast them.
-
FIXME: (nonurgent) allow bigger frequencies than 1 regular update in 6 seconds (?)
FIXME: propagation of metric=infinity into main routing table may or may not be good idea.
FIXME: mj wants us to be able to format attributes:
- Each protocol can now register its own attribute class (protocol->attr_class,
- set to EAP_xxx) and also a callback for naming and formatting of attributes.
+ and also a callback for naming and formatting of attributes.
The callback can return one of the following results:
GA_UNKNOWN Attribute not recognized.
@@ -468,6 +458,28 @@ rip_timer(timer *t)
DBG( "RIP: tick tock done\n" );
}
+/**
+ * rip_start - initialize instance of rip
+ *
+ * Rip is pretty simple protocol so half of this code is interface
+ * with core. We maintain our own linklist of &rip_entry - it serves
+ * as our small routing table. Within rip_tx(), this list is
+ * walked, and packet is generated using rip_tx_prepare(). This gets
+ * tricky because we may need to send more than one packet to one
+ * destination. Struct &rip_connection is used to hold info such as how
+ * many of &rip_entry ies we already send, and is also used to protect
+ * from two concurrent sends to one destination. Each &rip_interface has
+ * at most one &rip_connection.
+ *
+ * We are not going to honour requests for sending part of
+ * routing table. That would need to turn split horizon off,
+ * etc.
+ *
+ * Triggered updates. RFC says: when triggered update was sent, don't send
+ * new one for something between 1 and 5 seconds (and send one
+ * after that). We do something else: once in 5 second
+ * we look for any changed routes and broadcast them.
+ */
static int
rip_start(struct proto *p)
{
@@ -834,12 +846,26 @@ rip_preconfig(struct protocol *x, struct config *c)
DBG( "RIP: preconfig\n" );
}
+static int
+rip_get_attr(eattr *a, byte *buf)
+{
+ unsigned int i = EA_ID(a->id);
+ struct attr_desc *d;
+
+ switch (a->id) {
+ case EA_RIP_METRIC: buf += bsprintf( buf, "metric: %d", a->u.data ); return GA_FULL;
+ case EA_RIP_TAG: buf += bsprintf( buf, "tag: %d", a->u.data ); return GA_FULL;
+ default: return GA_UNKNOWN;
+ }
+}
+
struct protocol proto_rip = {
name: "RIP",
template: "rip%d",
attr_class: EAP_RIP,
preconfig: rip_preconfig,
get_route_info: rip_get_route_info,
+ get_attr: rip_get_attr,
init: rip_init,
dump: rip_dump,