CF_DECLS
-CF_KEYWORDS(RIP)
+CF_KEYWORDS(RIP, INFINITY)
CF_GRAMMAR
rip_proto:
rip_proto_start proto_name '{'
| rip_proto proto_item ';'
+ | rip_proto INFINITY expr ';' {
+ if ($3 < 0 || $3 > 64) cf_error("Invalid infinity");
+ ((struct rip_data *) this_proto)->infinity = $3;
+ }
;
CF_CODE
#include "rip.h"
-int infinity = 16;
-
/* FIXME: should be 520 */
#define RIP_PORT 1520
if (ipa_equal(c->sendptr->whotoldme, s->daddr)) {
debug( "(split horizont)" );
/* FIXME: should we do it in all cases? */
- packet->block[i].metric = infinity;
+ packet->block[i].metric = P->infinity;
}
ipa_hton( packet->block[i].network );
ipa_hton( packet->block[i].netmask );
ip_addr network = block->network;
CHK_MAGIC;
- if ((!metric) || (metric > infinity)) {
+ if ((!metric) || (metric > P->infinity)) {
log( L_WARN "Got metric %d from %I\n", metric, whotoldme );
return;
}
/* FIXME: Check if destination looks valid - ie not net 0 or 127 */
/* FIXME: Should add configurable ammount */
- if (metric < infinity)
+ if (metric < P->infinity)
metric++;
debug( "block: %I tells me: %I/%I available, metric %d... ", whotoldme, network, block->netmask, metric );
p->rte_insert = rip_rte_insert;
p->rte_remove = rip_rte_remove;
p->dump = rip_dump;
+ P->infinity = 16;
}
static void