From 2bf59bf4d3e4fcaff489d3445134e5e2e2af9cf6 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Thu, 21 Feb 2013 00:44:59 +0100 Subject: Hotfix to solve an issue with delaying timers reported by Aleksey Chudov. --- proto/rip/rip.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 281296a5..4b303305 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -596,8 +596,12 @@ rip_start(struct proto *p) init_list( &P->interfaces ); P->timer = tm_new( p->pool ); P->timer->data = p; - P->timer->randomize = 5; - P->timer->recurrent = (P_CF->period / 6)+1; + P->timer->randomize = 2; + P->timer->recurrent = (P_CF->period / 6) - 1; + if (P_CF->period < 12) { + log(L_WARN "Period %d is too low. So I am using 12 which is the lowest possible value.", P_CF->period); + P->timer->recurrent = 1; + } P->timer->hook = rip_timer; tm_start( P->timer, 5 ); rif = new_iface(p, NULL, 0, NULL); /* Initialize dummy interface */ @@ -956,9 +960,11 @@ rip_rte_insert(net *net UNUSED, rte *rte) static void rip_rte_remove(net *net UNUSED, rte *rte) { - // struct proto *p = rte->attrs->proto; +#ifdef LOCAL_DEBUG + struct proto *p = rte->attrs->proto; CHK_MAGIC; DBG( "rip_rte_remove: %p\n", rte ); +#endif rem_node( &rte->u.rip.garbage ); } -- cgit v1.2.3 From 04ddefb357b2b8759be16633f7bb1df49b0405ea Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Fri, 22 Feb 2013 07:15:27 +0100 Subject: Use BIRD's ASSERT instead of assert.h --- proto/rip/rip.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 4b303305..35a151ad 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -59,7 +59,6 @@ #include "lib/string.h" #include "rip.h" -#include #define P ((struct rip_proto *) p) #define P_CF ((struct rip_proto_config *)p->cf) @@ -583,9 +582,9 @@ rip_start(struct proto *p) struct rip_interface *rif; DBG( "RIP: starting instance...\n" ); - assert( sizeof(struct rip_packet_heading) == 4); - assert( sizeof(struct rip_block) == 20); - assert( sizeof(struct rip_block_auth) == 20); + ASSERT(sizeof(struct rip_packet_heading) == 4); + ASSERT(sizeof(struct rip_block) == 20); + ASSERT(sizeof(struct rip_block_auth) == 20); #ifdef LOCAL_DEBUG P->magic = RIP_MAGIC; -- cgit v1.2.3 From a9c38203bdcad92f7ac0a8a912241d2acb483f2c Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sun, 24 Feb 2013 00:43:08 +0100 Subject: Allow 1 sec RIP update. --- proto/rip/rip.c | 26 +++++++++++++------------- proto/rip/rip.h | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 35a151ad..5007715d 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -7,14 +7,13 @@ * Can be freely distributed and used under the terms of the GNU GPL. * FIXME: IpV6 support: packet size - FIXME: (nonurgent) IpV6 support: receive "route using" blocks - FIXME: (nonurgent) IpV6 support: generate "nexthop" blocks + FIXME: (nonurgent) IPv6 support: receive "route using" blocks + FIXME: (nonurgent) IPv6 support: generate "nexthop" blocks next hops are only advisory, and they are pretty ugly in IpV6. I suggest just forgetting about them. FIXME: (nonurgent): fold rip_connection into rip_interface? - 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. */ @@ -162,7 +161,7 @@ rip_tx( sock *s ) FIB_ITERATE_START(&P->rtable, &c->iter, z) { struct rip_entry *e = (struct rip_entry *) z; - if (!rif->triggered || (!(e->updated < now-5))) { + if (!rif->triggered || (!(e->updated < now-2))) { /* FIXME: Should be probably 1 or some different algorithm */ nullupdate = 0; i = rip_tx_prepare( p, packet->block + i, e, rif, i ); if (i >= maxi) { @@ -557,17 +556,23 @@ rip_timer(timer *t) DBG( "RIP: Broadcasting routing tables\n" ); { struct rip_interface *rif; + + if ( P_CF->period > 2 ) { /* Bring some randomness into sending times */ + if (! (P->tx_count % P_CF->period)) P->rnd_count = random_u32() % 2; + } else P->rnd_count = P->tx_count % P_CF->period; + WALK_LIST( rif, P->interfaces ) { struct iface *iface = rif->iface; if (!iface) continue; if (rif->mode & IM_QUIET) continue; if (!(iface->flags & IF_UP)) continue; + rif->triggered = P->rnd_count; - rif->triggered = (P->tx_count % 6); rip_sendto( p, IPA_NONE, 0, rif ); } - P->tx_count ++; + P->tx_count++; + P->rnd_count--; } DBG( "RIP: tick tock done\n" ); @@ -595,14 +600,9 @@ rip_start(struct proto *p) init_list( &P->interfaces ); P->timer = tm_new( p->pool ); P->timer->data = p; - P->timer->randomize = 2; - P->timer->recurrent = (P_CF->period / 6) - 1; - if (P_CF->period < 12) { - log(L_WARN "Period %d is too low. So I am using 12 which is the lowest possible value.", P_CF->period); - P->timer->recurrent = 1; - } + P->timer->recurrent = 1; P->timer->hook = rip_timer; - tm_start( P->timer, 5 ); + tm_start( P->timer, 2 ); rif = new_iface(p, NULL, 0, NULL); /* Initialize dummy interface */ add_head( &P->interfaces, NODE rif ); CHK_MAGIC; diff --git a/proto/rip/rip.h b/proto/rip/rip.h index 896fab64..e0816d0e 100644 --- a/proto/rip/rip.h +++ b/proto/rip/rip.h @@ -162,6 +162,7 @@ struct rip_proto { int magic; #endif int tx_count; /* Do one regular update once in a while */ + int rnd_count; /* Randomize sending time */ }; #ifdef LOCAL_DEBUG -- cgit v1.2.3 From de41dcd13d6f9d4785c80e6234ac38f2a15f5429 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 26 Feb 2013 14:13:11 +0100 Subject: Redundant lines removed. --- proto/rip/rip.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 5007715d..8d9271d4 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -531,13 +531,10 @@ rip_timer(timer *t) WALK_LIST_DELSAFE( e, et, P->garbage ) { rte *rte; rte = SKIP_BACK( struct rte, u.rip.garbage, e ); -#ifdef LOCAL_DEBUG - { - struct proto *p = rte->attrs->proto; - CHK_MAGIC; - } + + CHK_MAGIC; + DBG( "Garbage: (%p)", rte ); rte_dump( rte ); -#endif if (now - rte->lastmod > P_CF->timeout_time) { TRACE(D_EVENTS, "entry is too old: %I", rte->net->n.prefix ); -- cgit v1.2.3 From a9fc659b840e13323aa43e92eb8f39ceb19b5ed6 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 26 Feb 2013 14:29:53 +0100 Subject: Small typos fixed. --- proto/rip/rip.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 8d9271d4..341df7eb 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -6,10 +6,10 @@ * * Can be freely distributed and used under the terms of the GNU GPL. * - FIXME: IpV6 support: packet size + FIXME: IPv6 support: packet size FIXME: (nonurgent) IPv6 support: receive "route using" blocks FIXME: (nonurgent) IPv6 support: generate "nexthop" blocks - next hops are only advisory, and they are pretty ugly in IpV6. + next hops are only advisory, and they are pretty ugly in IPv6. I suggest just forgetting about them. FIXME: (nonurgent): fold rip_connection into rip_interface? @@ -46,6 +46,7 @@ */ #undef LOCAL_DEBUG +#define LOCAL_DEBUG 1 #include "nest/bird.h" #include "nest/iface.h" @@ -357,26 +358,26 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme, struct static void process_block( struct proto *p, struct rip_block *block, ip_addr whotoldme, struct iface *iface ) { + int metric, pxlen; + #ifndef IPV6 - int metric = ntohl( block->metric ); + metric = ntohl( block->metric ); + pxlen = ipa_mklen(block->netmask); #else - int metric = block->metric; + metric = block->metric; + pxlen = block->pxlen; #endif ip_addr network = block->network; CHK_MAGIC; -#ifdef IPV6 - TRACE(D_ROUTES, "block: %I tells me: %I/%d available, metric %d... ", - whotoldme, network, block->pxlen, metric ); -#else + TRACE(D_ROUTES, "block: %I tells me: %I/%d available, metric %d... ", - whotoldme, network, ipa_mklen(block->netmask), metric ); -#endif + whotoldme, network, pxlen, metric ); if ((!metric) || (metric > P_CF->infinity)) { -#ifdef IPV6 /* Someone is sedning us nexthop and we are ignoring it */ +#ifdef IPV6 /* Someone is sending us nexthop and we are ignoring it */ if (metric == 0xff) - { DBG( "IpV6 nexthop ignored" ); return; } + { DBG( "IPv6 nexthop ignored" ); return; } #endif log( L_WARN "%s: Got metric %d from %I", p->name, metric, whotoldme ); return; -- cgit v1.2.3 From ef4a50be10c6dd0abffd957132cd146029c3d79d Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 24 Jun 2013 16:37:30 +0200 Subject: Better packet priority and traffic class handling. Implements support for IPv6 traffic class, sets higher priority for OSPF and RIP outgoing packets by default and allows to configure ToS/DS/TClass IP header field and the local priority of outgoing packets. --- doc/bird.sgml | 48 +++++++++++++++++++++++++++++++++++++++++------- lib/ipv6.h | 7 +------ lib/socket.h | 4 +++- nest/config.Y | 8 ++++++-- proto/ospf/config.Y | 6 +++++- proto/ospf/iface.c | 8 ++++++-- proto/ospf/ospf.h | 2 ++ proto/rip/config.Y | 6 +++++- proto/rip/rip.c | 7 +++++-- proto/rip/rip.h | 2 ++ sysdep/bsd/sysio.h | 9 +++++++++ sysdep/linux/sysio.h | 19 +++++++++++++++++++ sysdep/unix/io.c | 11 +++++++++-- 13 files changed, 113 insertions(+), 24 deletions(-) (limited to 'proto/rip') diff --git a/doc/bird.sgml b/doc/bird.sgml index 0681bd53..7277b2b9 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -567,6 +567,22 @@ to zero to disable it. An empty is equivalent to interface "eth*" 192.168.1.0/24; - start the protocol on all ethernet interfaces that have address from 192.168.1.0/24. +