summaryrefslogtreecommitdiffstats
path: root/proto/ospf/lsreq.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-04-06 16:17:47 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-04-06 16:17:47 +0200
commit8298d780be5a5b00c31c10a37a5f3a1353d6e234 (patch)
tree649a999a1cd0c44e4be09da8f3e16b6cb574037a /proto/ospf/lsreq.c
parentbcb81251b4e37b96743aa1cdf790f30ef41a465e (diff)
downloadbird-8298d780be5a5b00c31c10a37a5f3a1353d6e234.tar
bird-8298d780be5a5b00c31c10a37a5f3a1353d6e234.zip
Better OSPF packet tracing log messages.
Replaces old OSPF packet tracing messages with uniform messages with packet dumps.
Diffstat (limited to 'proto/ospf/lsreq.c')
-rw-r--r--proto/ospf/lsreq.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c
index f43a08f..e179189 100644
--- a/proto/ospf/lsreq.c
+++ b/proto/ospf/lsreq.c
@@ -8,6 +8,24 @@
#include "ospf.h"
+static void ospf_dump_lsreq(struct proto *p, struct ospf_lsreq_packet *pkt)
+{
+ struct ospf_packet *op = &pkt->ospf_packet;
+
+ ASSERT(op->type == LSREQ_P);
+ ospf_dump_common(p, op);
+
+ struct ospf_lsreq_header *plsr = (void *) (pkt + 1);
+ int i, j;
+
+ j = (ntohs(op->length) - sizeof(struct ospf_dbdes_packet)) /
+ sizeof(struct ospf_lsreq_header);
+
+ for (i = 0; i < j; i++)
+ log(L_TRACE "%s: LSR Id: %I, Rt: %I, Type: %u",
+ p->name, htonl(plsr[i].id), htonl(plsr[i].rt), plsr[i].type);
+}
+
void
ospf_lsreq_send(struct ospf_neighbor *n)
{
@@ -59,8 +77,10 @@ ospf_lsreq_send(struct ospf_neighbor *n)
sizeof(struct ospf_lsreq_packet) + (j -
i) * sizeof(struct ospf_lsreq_header);
op->length = htons(length);
+
+ OSPF_PACKET(ospf_dump_lsreq, (struct ospf_lsreq_packet *) n->ifa->ip_sk->tbuf,
+ "LSREQ packet sent to %I via %s", n->ip, n->ifa->iface->name);
ospf_send_to(n->ifa->ip_sk, n->ip, n->ifa);
- OSPF_TRACE(D_PACKETS, "LS request sent to: %I", n->rid);
}
void
@@ -77,10 +97,11 @@ ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
struct proto_ospf *po = oa->po;
struct proto *p = &po->proto;
+ OSPF_PACKET(ospf_dump_lsreq, ps, "LSREQ packet received from %I via %s", n->ip, ifa->iface->name);
+
if (n->state < NEIGHBOR_EXCHANGE)
return;
- OSPF_TRACE(D_EVENTS, "Received LS req from neighbor: %I", n->ip);
ospf_neigh_sm(n, INM_HELLOREC);
lsh = (void *) (ps + 1);