summaryrefslogtreecommitdiffstats
path: root/proto/ospf/lsack.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/lsack.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/lsack.c')
-rw-r--r--proto/ospf/lsack.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c
index bb1afa0..4652825 100644
--- a/proto/ospf/lsack.c
+++ b/proto/ospf/lsack.c
@@ -10,6 +10,25 @@
char *s_queue[] = { "direct", "delayed" };
+
+static void ospf_dump_lsack(struct proto *p, struct ospf_lsack_packet *pkt)
+{
+ struct ospf_packet *op = &pkt->ospf_packet;
+
+ ASSERT(op->type == LSACK_P);
+ ospf_dump_common(p, op);
+
+ struct ospf_lsa_header *plsa = (void *) (pkt + 1);
+ int i, j;
+
+ j = (ntohs(op->length) - sizeof(struct ospf_lsack_packet)) /
+ sizeof(struct ospf_lsa_header);
+
+ for (i = 0; i < j; i++)
+ ospf_dump_lsahdr(p, plsa + i);
+}
+
+
/*
* =====================================
* Note, that h is in network endianity!
@@ -42,8 +61,6 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
if (EMPTY_LIST(n->ackl[queue]))
return;
- OSPF_TRACE(D_PACKETS, "LS ack sent to %I (%s)", n->ip, s_queue[queue]);
-
if (ifa->type == OSPF_IT_BCAST)
sk = ifa->hello_sk;
else
@@ -74,6 +91,10 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
i * sizeof(struct ospf_lsa_header);
op->length = htons(len);
DBG("Sending and continuing! Len=%u\n", len);
+
+ OSPF_PACKET(ospf_dump_lsack, (struct ospf_lsack_packet *) sk->tbuf,
+ "LSACK packet sent via %s", ifa->iface->name);
+
if (ifa->type == OSPF_IT_BCAST)
{
if ((ifa->state == OSPF_IS_DR) || (ifa->state == OSPF_IS_BACKUP))
@@ -98,6 +119,10 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
len = sizeof(struct ospf_lsack_packet) + i * sizeof(struct ospf_lsa_header);
op->length = htons(len);
DBG("Sending! Len=%u\n", len);
+
+ OSPF_PACKET(ospf_dump_lsack, (struct ospf_lsack_packet *) sk->tbuf,
+ "LSACK packet sent via %s", ifa->iface->name);
+
if (ifa->type == OSPF_IT_BCAST)
{
if ((ifa->state == OSPF_IS_DR) || (ifa->state == OSPF_IS_BACKUP))
@@ -125,7 +150,8 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
struct proto *p = &ifa->oa->po->proto;
unsigned int size = ntohs(ps->ospf_packet.length), i;
- OSPF_TRACE(D_PACKETS, "Received LS ack from %I", n->ip);
+ OSPF_PACKET(ospf_dump_lsack, ps, "LSACK packet received from %I via %s", n->ip, ifa->iface->name);
+
ospf_neigh_sm(n, INM_HELLOREC);
if (n->state < NEIGHBOR_EXCHANGE)