summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/dbdes.c2
-rw-r--r--proto/ospf/hello.c2
-rw-r--r--proto/ospf/lsack.c12
-rw-r--r--proto/ospf/lsreq.c36
-rw-r--r--proto/ospf/lsupd.c20
-rw-r--r--proto/ospf/ospf.h2
-rw-r--r--proto/ospf/topology.c12
7 files changed, 64 insertions, 22 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c
index ecffbe6..4706883 100644
--- a/proto/ospf/dbdes.c
+++ b/proto/ospf/dbdes.c
@@ -149,7 +149,7 @@ rxmt_timer_hook(timer *timer)
n=(struct ospf_neighbor *)timer->data;
ifa=n->ifa;
p=(struct proto *)(ifa->proto);
- debug("%s: RXMT timer fired on interface %s for neigh: %I.\n",
+ DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n",
p->name, ifa->iface->name, n->rid);
if(n->state<NEIGHBOR_LOADING) ospf_dbdes_tx(n);
else
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index f3bd3d5..4535c5e 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -183,7 +183,7 @@ hello_timer_hook(timer *timer)
ifa=(struct ospf_iface *)timer->data;
p=(struct proto *)(ifa->proto);
- debug("%s: Hello timer fired on interface %s.\n",
+ DBG("%s: Hello timer fired on interface %s.\n",
p->name, ifa->iface->name);
/* Now we should send a hello packet */
/* First a common packet header */
diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c
index 764df62..3479f3a 100644
--- a/proto/ospf/lsack.c
+++ b/proto/ospf/lsack.c
@@ -15,6 +15,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
struct ospf_packet *op;
struct ospf_lsack_packet *pk;
sock *sk=n->ifa->ip_sk;
+ struct proto *p=&n->ifa->proto->proto;
u16 len;
DBG("Sending direct ACK to %I for Type: %u, ID: %I, RT: %I\n",n->rid,
@@ -30,6 +31,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
op->length=htons(len);
ospf_pkt_finalize(n->ifa, op);
sk_send_to(sk,len, n->ip, OSPF_PROTO);
+ debug("%s: LS ack sent to %I\n", p->name, n->ip);
}
void
@@ -160,13 +162,16 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
if((n=find_neigh(ifa, nrid))==NULL)
{
- debug("%s: Received lsack from unknown neigbor! (%I)\n", p->name,
+ debug("%s: Received LS ack from unknown neigbor! (%I)\n", p->name,
nrid);
return ;
}
if(n->state<NEIGHBOR_EXCHANGE) return;
-
+
+ debug("%s: Received LS ack from %I\n", p->name,
+ n->ip);
+
nolsa=(ntohs(ps->ospf_packet.length)-sizeof(struct ospf_lsack_packet))/
sizeof(struct ospf_lsa_header);
DBG("Received %d lsa ack(s)\n",nolsa);
@@ -180,6 +185,9 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
if(lsa_comp(&lsa,&en->lsa)!=CMP_SAME)
{
log("Strange LS acknoledgement from %I",n->rid);
+ log("Id: %I, Rt: %I, Type: %u",lsa.id, lsa.rt, lsa.type);
+ log("I have: Age: %u, Seqno: %u", en->lsa.age, en->lsa.sn);
+ log("He has: Age: %u, Seqno: %u", lsa.age, lsa.sn);
continue;
}
diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c
index 85d6e39..4a78d06 100644
--- a/proto/ospf/lsreq.c
+++ b/proto/ospf/lsreq.c
@@ -18,6 +18,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
struct ospf_lsreq_header *lsh;
u16 length;
int i,j;
+ struct proto *p=&n->ifa->proto->proto;
pk=(struct ospf_lsreq_packet *)n->ifa->ip_sk->tbuf;
op=(struct ospf_packet *)n->ifa->ip_sk->tbuf;
@@ -54,7 +55,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
op->length=htons(length);
ospf_pkt_finalize(n->ifa, op);
sk_send_to(n->ifa->ip_sk,length, n->ip, OSPF_PROTO);
- DBG("Lsreq send to: %I\n", n->rid);
+ debug("%s: LS request sent to: %I\n", p->name, n->rid);
}
void
@@ -63,16 +64,39 @@ lsrr_timer_hook(timer *timer)
struct ospf_iface *ifa;
struct proto *p;
struct ospf_neighbor *n;
+ struct top_hash_entry *en;
n=(struct ospf_neighbor *)timer->data;
ifa=n->ifa;
p=(struct proto *)(ifa->proto);
- debug("%s: LSRR timer fired on interface %s for neigh: %I.\n",
+
+ DBG("%s: LSRR timer fired on interface %s for neigh: %I.\n",
p->name, ifa->iface->name, n->rid);
if(n->state<NEIGHBOR_FULL) ospf_lsreq_tx(n);
else
{
- int i; /* FIXME Retransmit lsupd again */
+ if(!EMPTY_SLIST(n->lsrtl))
+ {
+ list uplist;
+ slab *upslab;
+ struct l_lsr_head *llsh;
+
+ init_list(&uplist);
+ upslab=sl_new(p->pool,sizeof(struct l_lsr_head));
+
+ WALK_SLIST(SNODE en,n->lsrtl)
+ {
+ if((SNODE en)->next==(SNODE en)) die("BUGGGGGG");
+ llsh=sl_alloc(upslab);
+ llsh->lsh.id=en->lsa.id;
+ llsh->lsh.rt=en->lsa.rt;
+ llsh->lsh.type=en->lsa.type;
+ DBG("Working on ID: %I, RT: %I, Type: %u\n",en->lsa.id,en->lsa.rt,en->lsa.type);
+ add_tail(&uplist, NODE llsh);
+ }
+ ospf_lsupd_tx_list(n, &uplist);
+ rfree(upslab);
+ }
}
}
@@ -95,11 +119,13 @@ ospf_lsreq_rx(struct ospf_lsreq_packet *ps, struct proto *p,
if((n=find_neigh(ifa, nrid))==NULL)
{
- debug("%s: Received lsreq from unknown neigbor! (%I)\n", p->name,
+ debug("%s: Received lsreq from unknown neighbor! (%I)\n", p->name,
nrid);
return ;
}
- if(n->state<NEIGHBOR_EXCHANGE) debug("%s: Ignoring it.\n", p->name);
+ if(n->state<NEIGHBOR_EXCHANGE) return;
+
+ debug("%s: Received LS req from neighbor: %I\n",p->name, n->ip);
length=htons(ps->ospf_packet.length);
lsh=(void *)(ps+1);
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index 7ea891e..9009b17 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -69,9 +69,18 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
}
}
if(nn==n) continue;
- en=ospf_hash_get_header(nn->lsrth, hh);
+ if((en=ospf_hash_find_header(nn->lsrth, hh))==NULL)
+ {
+ en=ospf_hash_get_header(nn->lsrth, hh);
+ }
+ else
+ {
+ s_rem_node(SNODE en);
+ }
s_add_tail(&nn->lsrtl, SNODE en);
ret=1;
+ DBG("Adding LSA lsrt RT: %I, Id: %I, Type: %u for n: %I\n",
+ en->lsa.rt,en->lsa.id, en->lsa.type, nn->ip);
}
if(ret==0) continue;
if(ifa==iff)
@@ -147,6 +156,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
struct top_hash_entry *en;
struct ospf_lsupd_packet *pk;
struct ospf_packet *op;
+ struct proto *p=&n->ifa->oa->po->proto;
void *pktpos;
u8 ii;
u8 *jj=n->ifa->ip_sk->tbuf;
@@ -174,10 +184,8 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
op->length=htons(len);
ospf_pkt_finalize(n->ifa, op);
- for(ii=0;ii<(len-SIPH);ii+=4)
- DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3));
-
sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
+ debug("%s: LS upd sent to %I\n", p->name, n->ip);
DBG("LSupd: next packet\n");
fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
@@ -201,7 +209,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3));
sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
- DBG("LSupd: sent\n");
+ debug("%s: LS upd sent to %I\n", p->name, n->ip);
}
void
@@ -233,6 +241,8 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
return;
}
+ debug("%s: Received LS upd from (%I)\n", p->name, n->ip);
+
lsa=(struct ospf_lsa_header *)(ps+1);
area=htonl(ps->ospf_packet.areaid);
oa=ospf_find_area((struct proto_ospf *)p,area);
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index e761bdf..614032f 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -27,8 +27,6 @@
#include "conf/conf.h"
#include "lib/string.h"
-#define LOCAL_DEBUG
-
#define OSPF_PROTO 89
#ifndef IPV6
#define OSPF_VERSION 2
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index b391be5..2fc74d4 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -7,8 +7,6 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
-#define LOCAL_DEBUG
-
#include "nest/bird.h"
#include "lib/string.h"
@@ -34,9 +32,10 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p)
struct top_hash_entry *old;
struct proto_ospf *po=(struct proto_ospf *)p;
- DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name, oa->areaid);
+ DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name,
+ oa->areaid);
- WALK_LIST (ifa, p->iface_list) i++;
+ WALK_LIST (ifa, p->iface_list)
{
if((ifa->an==oa->areaid) && (ifa->state!=OSPF_IS_DOWN))
{
@@ -226,7 +225,7 @@ originate_rt_lsa(struct ospf_area *oa, struct proto_ospf *po)
struct top_hash_entry *en;
void *body;
- DBG("%s: Originating RT_lsa for area \"%I\".\n", po->proto.name, oa->areaid);
+ debug("%s: Originating RT_lsa for area \"%I\".\n",po->proto.name,oa->areaid);
lsa.age=0;
lsa.id=rtid;
@@ -287,7 +286,8 @@ originate_net_lsa(struct ospf_iface *ifa, struct proto_ospf *po)
if(ifa->state!=OSPF_IS_DR) return;
- DBG("%s: Originating Net lsa for iface \"%s\".\n", po->proto.name, ifa->iface->name);
+ debug("%s: Originating Net lsa for iface \"%s\".\n", po->proto.name,
+ ifa->iface->name);
if(ifa->fadj==0)
{