ospf6d: Make debug logs configurable to only display message headers

This change allows the user to only log the message header and not
include all the LSAs in each packet.   In a large setup printing out
all the LSAs in each packet can make the system very hard to debug.
When the user finds an issue with the adjacency not coming up or in a
specific packet type they can turn on a full dump of the message.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
This commit is contained in:
lynne 2021-04-28 18:35:10 -04:00
parent d8c3daca19
commit f44d0f5eca
2 changed files with 268 additions and 157 deletions

View file

@ -94,7 +94,7 @@ static void ospf6_header_print(struct ospf6_header *oh)
ntohs(oh->checksum), oh->instance_id); ntohs(oh->checksum), oh->instance_id);
} }
void ospf6_hello_print(struct ospf6_header *oh) void ospf6_hello_print(struct ospf6_header *oh, int action)
{ {
struct ospf6_hello *hello; struct ospf6_hello *hello;
char options[16]; char options[16];
@ -115,15 +115,21 @@ void ospf6_hello_print(struct ospf6_header *oh)
ntohs(hello->hello_interval), ntohs(hello->dead_interval)); ntohs(hello->hello_interval), ntohs(hello->dead_interval));
zlog_debug(" DR:%pI4 BDR:%pI4", &hello->drouter, &hello->bdrouter); zlog_debug(" DR:%pI4 BDR:%pI4", &hello->drouter, &hello->bdrouter);
for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); if ((IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)
p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); && action == OSPF6_ACTION_RECV)
p += sizeof(uint32_t)) || (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)
zlog_debug(" Neighbor: %pI4", (in_addr_t *)p); && action == OSPF6_ACTION_SEND)) {
assert(p == OSPF6_MESSAGE_END(oh)); for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello));
p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh);
p += sizeof(uint32_t))
zlog_debug(" Neighbor: %pI4", (in_addr_t *)p);
assert(p == OSPF6_MESSAGE_END(oh));
}
} }
void ospf6_dbdesc_print(struct ospf6_header *oh) void ospf6_dbdesc_print(struct ospf6_header *oh, int action)
{ {
struct ospf6_dbdesc *dbdesc; struct ospf6_dbdesc *dbdesc;
char options[16]; char options[16];
@ -145,34 +151,52 @@ void ospf6_dbdesc_print(struct ospf6_header *oh)
(CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT) ? "m" : "s"), (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT) ? "m" : "s"),
(unsigned long)ntohl(dbdesc->seqnum)); (unsigned long)ntohl(dbdesc->seqnum));
for (p = (char *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); if ((IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)
p + sizeof(struct ospf6_lsa_header) <= OSPF6_MESSAGE_END(oh); && action == OSPF6_ACTION_RECV)
p += sizeof(struct ospf6_lsa_header)) || (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)
ospf6_lsa_header_print_raw((struct ospf6_lsa_header *)p); && action == OSPF6_ACTION_SEND)) {
assert(p == OSPF6_MESSAGE_END(oh)); for (p = (char *)((caddr_t)dbdesc
+ sizeof(struct ospf6_dbdesc));
p + sizeof(struct ospf6_lsa_header)
<= OSPF6_MESSAGE_END(oh);
p += sizeof(struct ospf6_lsa_header))
ospf6_lsa_header_print_raw(
(struct ospf6_lsa_header *)p);
assert(p == OSPF6_MESSAGE_END(oh));
}
} }
void ospf6_lsreq_print(struct ospf6_header *oh) void ospf6_lsreq_print(struct ospf6_header *oh, int action)
{ {
char *p; char *p;
ospf6_header_print(oh); ospf6_header_print(oh);
assert(oh->type == OSPF6_MESSAGE_TYPE_LSREQ); assert(oh->type == OSPF6_MESSAGE_TYPE_LSREQ);
for (p = (char *)((caddr_t)oh + sizeof(struct ospf6_header)); if ((IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)
p + sizeof(struct ospf6_lsreq_entry) <= OSPF6_MESSAGE_END(oh); && action == OSPF6_ACTION_RECV)
p += sizeof(struct ospf6_lsreq_entry)) { || (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)
struct ospf6_lsreq_entry *e = (struct ospf6_lsreq_entry *)p; && action == OSPF6_ACTION_SEND)) {
zlog_debug(" [%s Id:%pI4 Adv:%pI4]", for (p = (char *)((caddr_t)oh + sizeof(struct ospf6_header));
ospf6_lstype_name(e->type), &e->id, &e->adv_router); p + sizeof(struct ospf6_lsreq_entry)
<= OSPF6_MESSAGE_END(oh);
p += sizeof(struct ospf6_lsreq_entry)) {
struct ospf6_lsreq_entry *e =
(struct ospf6_lsreq_entry *)p;
zlog_debug(" [%s Id:%pI4 Adv:%pI4]",
ospf6_lstype_name(e->type), &e->id,
&e->adv_router);
}
assert(p == OSPF6_MESSAGE_END(oh));
} }
assert(p == OSPF6_MESSAGE_END(oh));
} }
void ospf6_lsupdate_print(struct ospf6_header *oh) void ospf6_lsupdate_print(struct ospf6_header *oh, int action)
{ {
struct ospf6_lsupdate *lsupdate; struct ospf6_lsupdate *lsupdate;
unsigned long num; unsigned long num;
@ -187,29 +211,45 @@ void ospf6_lsupdate_print(struct ospf6_header *oh)
num = ntohl(lsupdate->lsa_number); num = ntohl(lsupdate->lsa_number);
zlog_debug(" Number of LSA: %ld", num); zlog_debug(" Number of LSA: %ld", num);
for (p = (char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); if ((IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)
p < OSPF6_MESSAGE_END(oh) && action == OSPF6_ACTION_RECV)
&& p + OSPF6_LSA_SIZE(p) <= OSPF6_MESSAGE_END(oh); || (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)
p += OSPF6_LSA_SIZE(p)) { && action == OSPF6_ACTION_SEND)) {
ospf6_lsa_header_print_raw((struct ospf6_lsa_header *)p);
}
assert(p == OSPF6_MESSAGE_END(oh)); for (p = (char *)((caddr_t)lsupdate
+ sizeof(struct ospf6_lsupdate));
p < OSPF6_MESSAGE_END(oh)
&& p + OSPF6_LSA_SIZE(p) <= OSPF6_MESSAGE_END(oh);
p += OSPF6_LSA_SIZE(p)) {
ospf6_lsa_header_print_raw(
(struct ospf6_lsa_header *)p);
}
assert(p == OSPF6_MESSAGE_END(oh));
}
} }
void ospf6_lsack_print(struct ospf6_header *oh) void ospf6_lsack_print(struct ospf6_header *oh, int action)
{ {
char *p; char *p;
ospf6_header_print(oh); ospf6_header_print(oh);
assert(oh->type == OSPF6_MESSAGE_TYPE_LSACK); assert(oh->type == OSPF6_MESSAGE_TYPE_LSACK);
for (p = (char *)((caddr_t)oh + sizeof(struct ospf6_header)); if ((IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)
p + sizeof(struct ospf6_lsa_header) <= OSPF6_MESSAGE_END(oh); && action == OSPF6_ACTION_RECV)
p += sizeof(struct ospf6_lsa_header)) || (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)
ospf6_lsa_header_print_raw((struct ospf6_lsa_header *)p); && action == OSPF6_ACTION_SEND)) {
assert(p == OSPF6_MESSAGE_END(oh)); for (p = (char *)((caddr_t)oh + sizeof(struct ospf6_header));
p + sizeof(struct ospf6_lsa_header)
<= OSPF6_MESSAGE_END(oh);
p += sizeof(struct ospf6_lsa_header))
ospf6_lsa_header_print_raw(
(struct ospf6_lsa_header *)p);
assert(p == OSPF6_MESSAGE_END(oh));
}
} }
static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst, static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
@ -348,21 +388,21 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
+ sizeof(struct ospf6_header)); + sizeof(struct ospf6_header));
if (on->state < OSPF6_NEIGHBOR_INIT) { if (on->state < OSPF6_NEIGHBOR_INIT) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state less than Init, ignore"); zlog_debug("Neighbor state less than Init, ignore");
return; return;
} }
switch (on->state) { switch (on->state) {
case OSPF6_NEIGHBOR_TWOWAY: case OSPF6_NEIGHBOR_TWOWAY:
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state is 2-Way, ignore"); zlog_debug("Neighbor state is 2-Way, ignore");
return; return;
case OSPF6_NEIGHBOR_INIT: case OSPF6_NEIGHBOR_INIT:
thread_execute(master, twoway_received, on, 0); thread_execute(master, twoway_received, on, 0);
if (on->state != OSPF6_NEIGHBOR_EXSTART) { if (on->state != OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Neighbor state is not ExStart, ignore"); "Neighbor state is not ExStart, ignore");
return; return;
@ -395,14 +435,14 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
sizeof(struct ospf6_dbdesc))) { sizeof(struct ospf6_dbdesc))) {
/* Duplicated DatabaseDescription is dropped by master /* Duplicated DatabaseDescription is dropped by master
*/ */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Duplicated dbdesc discarded by Master, ignore"); "Duplicated dbdesc discarded by Master, ignore");
return; return;
} }
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT)) { if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT)) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Master/Slave bit mismatch"); zlog_debug("Master/Slave bit mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -410,7 +450,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
} }
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) { if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Initialize bit mismatch"); zlog_debug("Initialize bit mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -418,7 +458,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
} }
if (memcmp(on->options, dbdesc->options, sizeof(on->options))) { if (memcmp(on->options, dbdesc->options, sizeof(on->options))) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Option field mismatch"); zlog_debug("Option field mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -426,7 +466,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
} }
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum) { if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Sequence number mismatch (%#lx expected)", "Sequence number mismatch (%#lx expected)",
(unsigned long)on->dbdesc_seqnum); (unsigned long)on->dbdesc_seqnum);
@ -442,13 +482,13 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
sizeof(struct ospf6_dbdesc))) { sizeof(struct ospf6_dbdesc))) {
/* Duplicated DatabaseDescription is dropped by master /* Duplicated DatabaseDescription is dropped by master
*/ */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Duplicated dbdesc discarded by Master, ignore"); "Duplicated dbdesc discarded by Master, ignore");
return; return;
} }
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Not duplicate dbdesc in state %s", zlog_debug("Not duplicate dbdesc in state %s",
ospf6_neighbor_state_str[on->state]); ospf6_neighbor_state_str[on->state]);
thread_add_event(master, seqnumber_mismatch, on, 0, NULL); thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
@ -553,21 +593,21 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
+ sizeof(struct ospf6_header)); + sizeof(struct ospf6_header));
if (on->state < OSPF6_NEIGHBOR_INIT) { if (on->state < OSPF6_NEIGHBOR_INIT) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state less than Init, ignore"); zlog_debug("Neighbor state less than Init, ignore");
return; return;
} }
switch (on->state) { switch (on->state) {
case OSPF6_NEIGHBOR_TWOWAY: case OSPF6_NEIGHBOR_TWOWAY:
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state is 2-Way, ignore"); zlog_debug("Neighbor state is 2-Way, ignore");
return; return;
case OSPF6_NEIGHBOR_INIT: case OSPF6_NEIGHBOR_INIT:
thread_execute(master, twoway_received, on, 0); thread_execute(master, twoway_received, on, 0);
if (on->state != OSPF6_NEIGHBOR_EXSTART) { if (on->state != OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Neighbor state is not ExStart, ignore"); "Neighbor state is not ExStart, ignore");
return; return;
@ -611,7 +651,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
sizeof(struct ospf6_dbdesc))) { sizeof(struct ospf6_dbdesc))) {
/* Duplicated DatabaseDescription causes slave to /* Duplicated DatabaseDescription causes slave to
* retransmit */ * retransmit */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Duplicated dbdesc causes retransmit"); "Duplicated dbdesc causes retransmit");
THREAD_OFF(on->thread_send_dbdesc); THREAD_OFF(on->thread_send_dbdesc);
@ -622,7 +662,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
} }
if (!CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT)) { if (!CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT)) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Master/Slave bit mismatch"); zlog_debug("Master/Slave bit mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -630,7 +670,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
} }
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) { if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Initialize bit mismatch"); zlog_debug("Initialize bit mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -638,7 +678,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
} }
if (memcmp(on->options, dbdesc->options, sizeof(on->options))) { if (memcmp(on->options, dbdesc->options, sizeof(on->options))) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Option field mismatch"); zlog_debug("Option field mismatch");
thread_add_event(master, seqnumber_mismatch, on, 0, thread_add_event(master, seqnumber_mismatch, on, 0,
NULL); NULL);
@ -646,7 +686,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
} }
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum + 1) { if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum + 1) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Sequence number mismatch (%#lx expected)", "Sequence number mismatch (%#lx expected)",
(unsigned long)on->dbdesc_seqnum + 1); (unsigned long)on->dbdesc_seqnum + 1);
@ -662,7 +702,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
sizeof(struct ospf6_dbdesc))) { sizeof(struct ospf6_dbdesc))) {
/* Duplicated DatabaseDescription causes slave to /* Duplicated DatabaseDescription causes slave to
* retransmit */ * retransmit */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Duplicated dbdesc causes retransmit"); "Duplicated dbdesc causes retransmit");
THREAD_OFF(on->thread_send_dbdesc); THREAD_OFF(on->thread_send_dbdesc);
@ -671,7 +711,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
return; return;
} }
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Not duplicate dbdesc in state %s", zlog_debug("Not duplicate dbdesc in state %s",
ospf6_neighbor_state_str[on->state]); ospf6_neighbor_state_str[on->state]);
thread_add_event(master, seqnumber_mismatch, on, 0, NULL); thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
@ -756,7 +796,7 @@ static void ospf6_dbdesc_recv(struct in6_addr *src, struct in6_addr *dst,
on = ospf6_neighbor_lookup(oh->router_id, oi); on = ospf6_neighbor_lookup(oh->router_id, oi);
if (on == NULL) { if (on == NULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor not found, ignore"); zlog_debug("Neighbor not found, ignore");
return; return;
} }
@ -773,7 +813,7 @@ static void ospf6_dbdesc_recv(struct in6_addr *src, struct in6_addr *dst,
} }
if (dbdesc->reserved1 || dbdesc->reserved2) { if (dbdesc->reserved1 || dbdesc->reserved2) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug( zlog_debug(
"Non-0 reserved field in %s's DbDesc, correct", "Non-0 reserved field in %s's DbDesc, correct",
on->name); on->name);
@ -788,7 +828,7 @@ static void ospf6_dbdesc_recv(struct in6_addr *src, struct in6_addr *dst,
else if (ntohl(oi->area->ospf6->router_id) < ntohl(oh->router_id)) else if (ntohl(oi->area->ospf6->router_id) < ntohl(oh->router_id))
ospf6_dbdesc_recv_slave(oh, on); ospf6_dbdesc_recv_slave(oh, on);
else { else {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Can't decide which is master, ignore"); zlog_debug("Can't decide which is master, ignore");
} }
} }
@ -805,7 +845,7 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst,
on = ospf6_neighbor_lookup(oh->router_id, oi); on = ospf6_neighbor_lookup(oh->router_id, oi);
if (on == NULL) { if (on == NULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor not found, ignore"); zlog_debug("Neighbor not found, ignore");
return; return;
} }
@ -813,7 +853,7 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst,
if (on->state != OSPF6_NEIGHBOR_EXCHANGE if (on->state != OSPF6_NEIGHBOR_EXCHANGE
&& on->state != OSPF6_NEIGHBOR_LOADING && on->state != OSPF6_NEIGHBOR_LOADING
&& on->state != OSPF6_NEIGHBOR_FULL) { && on->state != OSPF6_NEIGHBOR_FULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state less than Exchange, ignore"); zlog_debug("Neighbor state less than Exchange, ignore");
return; return;
} }
@ -882,7 +922,7 @@ static unsigned ospf6_prefixes_examin(
while (length) { while (length) {
if (length < OSPF6_PREFIX_MIN_SIZE) { if (length < OSPF6_PREFIX_MIN_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: undersized IPv6 prefix header", zlog_debug("%s: undersized IPv6 prefix header",
__func__); __func__);
return MSG_NG; return MSG_NG;
@ -890,7 +930,7 @@ static unsigned ospf6_prefixes_examin(
/* safe to look deeper */ /* safe to look deeper */
if (current->prefix_length > IPV6_MAX_BITLEN) { if (current->prefix_length > IPV6_MAX_BITLEN) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: invalid PrefixLength (%u bits)", zlog_debug("%s: invalid PrefixLength (%u bits)",
__func__, current->prefix_length); __func__, current->prefix_length);
return MSG_NG; return MSG_NG;
@ -901,7 +941,7 @@ static unsigned ospf6_prefixes_examin(
+ OSPF6_PREFIX_SPACE(current->prefix_length); + OSPF6_PREFIX_SPACE(current->prefix_length);
if (requested_pfx_bytes > length) { if (requested_pfx_bytes > length) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: undersized IPv6 prefix", zlog_debug("%s: undersized IPv6 prefix",
__func__); __func__);
return MSG_NG; return MSG_NG;
@ -913,7 +953,8 @@ static unsigned ospf6_prefixes_examin(
real_num_pfxs++; real_num_pfxs++;
} }
if (real_num_pfxs != req_num_pfxs) { if (real_num_pfxs != req_num_pfxs) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: IPv6 prefix number mismatch (%u required, %u real)", "%s: IPv6 prefix number mismatch (%u required, %u real)",
__func__, req_num_pfxs, real_num_pfxs); __func__, req_num_pfxs, real_num_pfxs);
@ -945,7 +986,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
ltindex = lsatype & OSPF6_LSTYPE_FCODE_MASK; ltindex = lsatype & OSPF6_LSTYPE_FCODE_MASK;
if (ltindex < OSPF6_LSTYPE_SIZE && ospf6_lsa_minlen[ltindex] if (ltindex < OSPF6_LSTYPE_SIZE && ospf6_lsa_minlen[ltindex]
&& lsalen < ospf6_lsa_minlen[ltindex] + OSPF6_LSA_HEADER_SIZE) { && lsalen < ospf6_lsa_minlen[ltindex] + OSPF6_LSA_HEADER_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: undersized (%u B) LSA", __func__, zlog_debug("%s: undersized (%u B) LSA", __func__,
lsalen); lsalen);
return MSG_NG; return MSG_NG;
@ -958,7 +1000,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
if ((lsalen - OSPF6_LSA_HEADER_SIZE - OSPF6_ROUTER_LSA_MIN_SIZE) if ((lsalen - OSPF6_LSA_HEADER_SIZE - OSPF6_ROUTER_LSA_MIN_SIZE)
% OSPF6_ROUTER_LSDESC_FIX_SIZE) { % OSPF6_ROUTER_LSDESC_FIX_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug( zlog_debug(
"%s: interface description alignment error", "%s: interface description alignment error",
__func__); __func__);
@ -972,7 +1014,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
- OSPF6_NETWORK_LSA_MIN_SIZE) - OSPF6_NETWORK_LSA_MIN_SIZE)
% OSPF6_NETWORK_LSDESC_FIX_SIZE) { % OSPF6_NETWORK_LSDESC_FIX_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug( zlog_debug(
"%s: router description alignment error", "%s: router description alignment error",
__func__); __func__);
@ -997,7 +1039,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
if (lsalen if (lsalen
> OSPF6_LSA_HEADER_SIZE + OSPF6_INTER_ROUTER_LSA_FIX_SIZE) { > OSPF6_LSA_HEADER_SIZE + OSPF6_INTER_ROUTER_LSA_FIX_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: oversized (%u B) LSA", __func__, zlog_debug("%s: oversized (%u B) LSA", __func__,
lsalen); lsalen);
return MSG_NG; return MSG_NG;
@ -1026,7 +1068,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
prefix before ospf6_prefix_examin() confirms its sizing. */ prefix before ospf6_prefix_examin() confirms its sizing. */
if (exp_length + OSPF6_PREFIX_MIN_SIZE > lsalen) { if (exp_length + OSPF6_PREFIX_MIN_SIZE > lsalen) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: undersized (%u B) LSA header", zlog_debug("%s: undersized (%u B) LSA header",
__func__, lsalen); __func__, lsalen);
return MSG_NG; return MSG_NG;
@ -1045,7 +1087,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
this check does not include any IPv6 prefix fields. */ this check does not include any IPv6 prefix fields. */
if (exp_length > lsalen) { if (exp_length > lsalen) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug("%s: undersized (%u B) LSA header", zlog_debug("%s: undersized (%u B) LSA header",
__func__, lsalen); __func__, lsalen);
return MSG_NG; return MSG_NG;
@ -1114,7 +1156,7 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
uint16_t lsalen; uint16_t lsalen;
if (length < OSPF6_LSA_HEADER_SIZE) { if (length < OSPF6_LSA_HEADER_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug( zlog_debug(
"%s: undersized (%zu B) trailing (#%u) LSA header", "%s: undersized (%zu B) trailing (#%u) LSA header",
__func__, length, counted_lsas); __func__, length, counted_lsas);
@ -1124,7 +1166,7 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
lsalen = OSPF6_LSA_SIZE(lsah); lsalen = OSPF6_LSA_SIZE(lsah);
if (lsalen < OSPF6_LSA_HEADER_SIZE) { if (lsalen < OSPF6_LSA_HEADER_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV)) RECV_HDR))
zlog_debug( zlog_debug(
"%s: malformed LSA header #%u, declared length is %u B", "%s: malformed LSA header #%u, declared length is %u B",
__func__, counted_lsas, lsalen); __func__, counted_lsas, lsalen);
@ -1134,7 +1176,8 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
/* less checks here and in ospf6_lsa_examin() */ /* less checks here and in ospf6_lsa_examin() */
if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 1)) { if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 1)) {
if (IS_OSPF6_DEBUG_MESSAGE( if (IS_OSPF6_DEBUG_MESSAGE(
OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: anomaly in header-only %s LSA #%u", "%s: anomaly in header-only %s LSA #%u",
__func__, __func__,
@ -1151,7 +1194,8 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
* further checks */ * further checks */
if (lsalen > length) { if (lsalen > length) {
if (IS_OSPF6_DEBUG_MESSAGE( if (IS_OSPF6_DEBUG_MESSAGE(
OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: anomaly in %s LSA #%u: declared length is %u B, buffered length is %zu B", "%s: anomaly in %s LSA #%u: declared length is %u B, buffered length is %zu B",
__func__, __func__,
@ -1161,7 +1205,8 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
} }
if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 0)) { if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 0)) {
if (IS_OSPF6_DEBUG_MESSAGE( if (IS_OSPF6_DEBUG_MESSAGE(
OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: anomaly in %s LSA #%u", "%s: anomaly in %s LSA #%u",
__func__, __func__,
@ -1177,7 +1222,8 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
} }
if (declared_num_lsas && counted_lsas != declared_num_lsas) { if (declared_num_lsas && counted_lsas != declared_num_lsas) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: #LSAs declared (%u) does not match actual (%u)", "%s: #LSAs declared (%u) does not match actual (%u)",
__func__, declared_num_lsas, counted_lsas); __func__, declared_num_lsas, counted_lsas);
@ -1195,14 +1241,16 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
/* length, 1st approximation */ /* length, 1st approximation */
if (bytesonwire < OSPF6_HEADER_SIZE) { if (bytesonwire < OSPF6_HEADER_SIZE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: undersized (%u B) packet", __func__, zlog_debug("%s: undersized (%u B) packet", __func__,
bytesonwire); bytesonwire);
return MSG_NG; return MSG_NG;
} }
/* Now it is safe to access header fields. */ /* Now it is safe to access header fields. */
if (bytesonwire != ntohs(oh->length)) { if (bytesonwire != ntohs(oh->length)) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug( zlog_debug(
"%s: %s packet length error (%u real, %u declared)", "%s: %s packet length error (%u real, %u declared)",
__func__, lookup_msg(ospf6_message_type_str, __func__, lookup_msg(ospf6_message_type_str,
@ -1212,7 +1260,8 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
} }
/* version check */ /* version check */
if (oh->version != OSPFV3_VERSION) { if (oh->version != OSPFV3_VERSION) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: invalid (%u) protocol version", zlog_debug("%s: invalid (%u) protocol version",
__func__, oh->version); __func__, oh->version);
return MSG_NG; return MSG_NG;
@ -1221,7 +1270,8 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
if (oh->type < OSPF6_MESSAGE_TYPE_ALL && ospf6_packet_minlen[oh->type] if (oh->type < OSPF6_MESSAGE_TYPE_ALL && ospf6_packet_minlen[oh->type]
&& bytesonwire && bytesonwire
< OSPF6_HEADER_SIZE + ospf6_packet_minlen[oh->type]) { < OSPF6_HEADER_SIZE + ospf6_packet_minlen[oh->type]) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: undersized (%u B) %s packet", __func__, zlog_debug("%s: undersized (%u B) %s packet", __func__,
bytesonwire, bytesonwire,
lookup_msg(ospf6_message_type_str, oh->type, lookup_msg(ospf6_message_type_str, oh->type,
@ -1238,7 +1288,8 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
== (bytesonwire - OSPF6_HEADER_SIZE - OSPF6_HELLO_MIN_SIZE) == (bytesonwire - OSPF6_HEADER_SIZE - OSPF6_HELLO_MIN_SIZE)
% 4) % 4)
return MSG_OK; return MSG_OK;
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: alignment error in %s packet", __func__, zlog_debug("%s: alignment error in %s packet", __func__,
lookup_msg(ospf6_message_type_str, oh->type, lookup_msg(ospf6_message_type_str, oh->type,
NULL)); NULL));
@ -1261,7 +1312,8 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
== (bytesonwire - OSPF6_HEADER_SIZE - OSPF6_LS_REQ_MIN_SIZE) == (bytesonwire - OSPF6_HEADER_SIZE - OSPF6_LS_REQ_MIN_SIZE)
% OSPF6_LSREQ_LSDESC_FIX_SIZE) % OSPF6_LSREQ_LSDESC_FIX_SIZE)
return MSG_OK; return MSG_OK;
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: alignment error in %s packet", __func__, zlog_debug("%s: alignment error in %s packet", __func__,
lookup_msg(ospf6_message_type_str, oh->type, lookup_msg(ospf6_message_type_str, oh->type,
NULL)); NULL));
@ -1289,13 +1341,14 @@ static unsigned ospf6_packet_examin(struct ospf6_header *oh,
1, 0); 1, 0);
break; break;
default: default:
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: invalid (%u) message type", __func__, zlog_debug("%s: invalid (%u) message type", __func__,
oh->type); oh->type);
return MSG_NG; return MSG_NG;
} }
if (test != MSG_OK if (test != MSG_OK
&& IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) && IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV_HDR))
zlog_debug("%s: anomaly in %s packet", __func__, zlog_debug("%s: anomaly in %s packet", __func__,
lookup_msg(ospf6_message_type_str, oh->type, NULL)); lookup_msg(ospf6_message_type_str, oh->type, NULL));
return test; return test;
@ -1356,7 +1409,7 @@ static void ospf6_lsupdate_recv(struct in6_addr *src, struct in6_addr *dst,
on = ospf6_neighbor_lookup(oh->router_id, oi); on = ospf6_neighbor_lookup(oh->router_id, oi);
if (on == NULL) { if (on == NULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor not found, ignore"); zlog_debug("Neighbor not found, ignore");
return; return;
} }
@ -1364,7 +1417,7 @@ static void ospf6_lsupdate_recv(struct in6_addr *src, struct in6_addr *dst,
if (on->state != OSPF6_NEIGHBOR_EXCHANGE if (on->state != OSPF6_NEIGHBOR_EXCHANGE
&& on->state != OSPF6_NEIGHBOR_LOADING && on->state != OSPF6_NEIGHBOR_LOADING
&& on->state != OSPF6_NEIGHBOR_FULL) { && on->state != OSPF6_NEIGHBOR_FULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state less than Exchange, ignore"); zlog_debug("Neighbor state less than Exchange, ignore");
return; return;
} }
@ -1398,7 +1451,7 @@ static void ospf6_lsack_recv(struct in6_addr *src, struct in6_addr *dst,
on = ospf6_neighbor_lookup(oh->router_id, oi); on = ospf6_neighbor_lookup(oh->router_id, oi);
if (on == NULL) { if (on == NULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor not found, ignore"); zlog_debug("Neighbor not found, ignore");
return; return;
} }
@ -1406,7 +1459,7 @@ static void ospf6_lsack_recv(struct in6_addr *src, struct in6_addr *dst,
if (on->state != OSPF6_NEIGHBOR_EXCHANGE if (on->state != OSPF6_NEIGHBOR_EXCHANGE
&& on->state != OSPF6_NEIGHBOR_LOADING && on->state != OSPF6_NEIGHBOR_LOADING
&& on->state != OSPF6_NEIGHBOR_FULL) { && on->state != OSPF6_NEIGHBOR_FULL) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug("Neighbor state less than Exchange, ignore"); zlog_debug("Neighbor state less than Exchange, ignore");
return; return;
} }
@ -1555,12 +1608,14 @@ int ospf6_receive(struct thread *thread)
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id); oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
if (oi == NULL || oi->area == NULL if (oi == NULL || oi->area == NULL
|| CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) { || CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("Message received on disabled interface"); zlog_debug("Message received on disabled interface");
return 0; return 0;
} }
if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE)) { if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE)) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
RECV_HDR))
zlog_debug("%s: Ignore message on passive interface %s", zlog_debug("%s: Ignore message on passive interface %s",
__func__, oi->interface->name); __func__, oi->interface->name);
return 0; return 0;
@ -1576,7 +1631,7 @@ int ospf6_receive(struct thread *thread)
which can be dismissed in a cleanup-focused review round later. */ which can be dismissed in a cleanup-focused review round later. */
/* Log */ /* Log */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) { if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR)) {
zlog_debug("%s received on %s", zlog_debug("%s received on %s",
lookup_msg(ospf6_message_type_str, oh->type, NULL), lookup_msg(ospf6_message_type_str, oh->type, NULL),
oi->interface->name); oi->interface->name);
@ -1585,19 +1640,19 @@ int ospf6_receive(struct thread *thread)
switch (oh->type) { switch (oh->type) {
case OSPF6_MESSAGE_TYPE_HELLO: case OSPF6_MESSAGE_TYPE_HELLO:
ospf6_hello_print(oh); ospf6_hello_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_DBDESC: case OSPF6_MESSAGE_TYPE_DBDESC:
ospf6_dbdesc_print(oh); ospf6_dbdesc_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSREQ: case OSPF6_MESSAGE_TYPE_LSREQ:
ospf6_lsreq_print(oh); ospf6_lsreq_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSUPDATE: case OSPF6_MESSAGE_TYPE_LSUPDATE:
ospf6_lsupdate_print(oh); ospf6_lsupdate_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSACK: case OSPF6_MESSAGE_TYPE_LSACK:
ospf6_lsack_print(oh); ospf6_lsack_print(oh, OSPF6_ACTION_RECV);
break; break;
default: default:
assert(0); assert(0);
@ -1656,7 +1711,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
oh->reserved = 0; oh->reserved = 0;
/* Log */ /* Log */
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)) { if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND_HDR)) {
if (src) if (src)
inet_ntop(AF_INET6, src, srcname, sizeof(srcname)); inet_ntop(AF_INET6, src, srcname, sizeof(srcname));
else else
@ -1669,19 +1724,19 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
switch (oh->type) { switch (oh->type) {
case OSPF6_MESSAGE_TYPE_HELLO: case OSPF6_MESSAGE_TYPE_HELLO:
ospf6_hello_print(oh); ospf6_hello_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_DBDESC: case OSPF6_MESSAGE_TYPE_DBDESC:
ospf6_dbdesc_print(oh); ospf6_dbdesc_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSREQ: case OSPF6_MESSAGE_TYPE_LSREQ:
ospf6_lsreq_print(oh); ospf6_lsreq_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSUPDATE: case OSPF6_MESSAGE_TYPE_LSUPDATE:
ospf6_lsupdate_print(oh); ospf6_lsupdate_print(oh, OSPF6_ACTION_RECV);
break; break;
case OSPF6_MESSAGE_TYPE_LSACK: case OSPF6_MESSAGE_TYPE_LSACK:
ospf6_lsack_print(oh); ospf6_lsack_print(oh, OSPF6_ACTION_RECV);
break; break;
default: default:
zlog_debug("Unknown message"); zlog_debug("Unknown message");
@ -1719,7 +1774,7 @@ int ospf6_hello_send(struct thread *thread)
oi->thread_send_hello = (struct thread *)NULL; oi->thread_send_hello = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_DOWN) { if (oi->state <= OSPF6_INTERFACE_DOWN) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND_HDR))
zlog_debug("Unable to send Hello on down interface %s", zlog_debug("Unable to send Hello on down interface %s",
oi->interface->name); oi->interface->name);
return 0; return 0;
@ -1758,7 +1813,7 @@ int ospf6_hello_send(struct thread *thread)
if (p - sendbuf + sizeof(uint32_t) > ospf6_packet_max(oi)) { if (p - sendbuf + sizeof(uint32_t) > ospf6_packet_max(oi)) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO,
SEND)) SEND_HDR))
zlog_debug( zlog_debug(
"sending Hello message: exceeds I/F MTU"); "sending Hello message: exceeds I/F MTU");
break; break;
@ -1790,7 +1845,7 @@ int ospf6_dbdesc_send(struct thread *thread)
on->thread_send_dbdesc = (struct thread *)NULL; on->thread_send_dbdesc = (struct thread *)NULL;
if (on->state < OSPF6_NEIGHBOR_EXSTART) { if (on->state < OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_DBDESC, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_DBDESC, SEND_HDR))
zlog_debug( zlog_debug(
"Quit to send DbDesc to neighbor %s state %s", "Quit to send DbDesc to neighbor %s state %s",
on->name, ospf6_neighbor_state_str[on->state]); on->name, ospf6_neighbor_state_str[on->state]);
@ -1918,7 +1973,7 @@ int ospf6_lsreq_send(struct thread *thread)
/* LSReq will be sent only in ExStart or Loading */ /* LSReq will be sent only in ExStart or Loading */
if (on->state != OSPF6_NEIGHBOR_EXCHANGE if (on->state != OSPF6_NEIGHBOR_EXCHANGE
&& on->state != OSPF6_NEIGHBOR_LOADING) { && on->state != OSPF6_NEIGHBOR_LOADING) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSREQ, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSREQ, SEND_HDR))
zlog_debug("Quit to send LSReq to neighbor %s state %s", zlog_debug("Quit to send LSReq to neighbor %s state %s",
on->name, on->name,
ospf6_neighbor_state_str[on->state]); ospf6_neighbor_state_str[on->state]);
@ -2029,11 +2084,12 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread)
on = (struct ospf6_neighbor *)THREAD_ARG(thread); on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_lsupdate = (struct thread *)NULL; on->thread_send_lsupdate = (struct thread *)NULL;
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND_HDR))
zlog_debug("LSUpdate to neighbor %s", on->name); zlog_debug("LSUpdate to neighbor %s", on->name);
if (on->state < OSPF6_NEIGHBOR_EXCHANGE) { if (on->state < OSPF6_NEIGHBOR_EXCHANGE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE,
SEND_HDR))
zlog_debug("Quit to send (neighbor state %s)", zlog_debug("Quit to send (neighbor state %s)",
ospf6_neighbor_state_str[on->state]); ospf6_neighbor_state_str[on->state]);
return 0; return 0;
@ -2190,7 +2246,7 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on,
lsupdate->lsa_number = htonl(lsa_cnt); lsupdate->lsa_number = htonl(lsa_cnt);
if (IS_OSPF6_DEBUG_FLOODING if (IS_OSPF6_DEBUG_FLOODING
|| IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) || IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND_HDR))
zlog_debug("%s: Send lsupdate with lsa %s (age %u)", __func__, zlog_debug("%s: Send lsupdate with lsa %s (age %u)", __func__,
lsa->name, ntohs(lsa->header->age)); lsa->name, ntohs(lsa->header->age));
@ -2212,7 +2268,8 @@ int ospf6_lsupdate_send_interface(struct thread *thread)
oi->thread_send_lsupdate = (struct thread *)NULL; oi->thread_send_lsupdate = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_WAITING) { if (oi->state <= OSPF6_INTERFACE_WAITING) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE,
SEND_HDR))
zlog_debug( zlog_debug(
"Quit to send LSUpdate to interface %s state %s", "Quit to send LSUpdate to interface %s state %s",
oi->interface->name, oi->interface->name,
@ -2299,7 +2356,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread)
on->thread_send_lsack = (struct thread *)NULL; on->thread_send_lsack = (struct thread *)NULL;
if (on->state < OSPF6_NEIGHBOR_EXCHANGE) { if (on->state < OSPF6_NEIGHBOR_EXCHANGE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR))
zlog_debug("Quit to send LSAck to neighbor %s state %s", zlog_debug("Quit to send LSAck to neighbor %s state %s",
on->name, on->name,
ospf6_neighbor_state_str[on->state]); ospf6_neighbor_state_str[on->state]);
@ -2377,7 +2434,7 @@ int ospf6_lsack_send_interface(struct thread *thread)
oi->thread_send_lsack = (struct thread *)NULL; oi->thread_send_lsack = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_WAITING) { if (oi->state <= OSPF6_INTERFACE_WAITING) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR))
zlog_debug( zlog_debug(
"Quit to send LSAck to interface %s state %s", "Quit to send LSAck to interface %s state %s",
oi->interface->name, oi->interface->name,
@ -2440,21 +2497,21 @@ int ospf6_lsack_send_interface(struct thread *thread)
/* Commands */ /* Commands */
DEFUN (debug_ospf6_message, DEFUN(debug_ospf6_message, debug_ospf6_message_cmd,
debug_ospf6_message_cmd, "debug ospf6 message <unknown|hello|dbdesc|lsreq|lsupdate|lsack|all> [<send|recv|send-hdr|recv-hdr>]",
"debug ospf6 message <unknown|hello|dbdesc|lsreq|lsupdate|lsack|all> [<send|recv>]", DEBUG_STR OSPF6_STR
DEBUG_STR "Debug OSPFv3 message\n"
OSPF6_STR "Debug Unknown message\n"
"Debug OSPFv3 message\n" "Debug Hello message\n"
"Debug Unknown message\n" "Debug Database Description message\n"
"Debug Hello message\n" "Debug Link State Request message\n"
"Debug Database Description message\n" "Debug Link State Update message\n"
"Debug Link State Request message\n" "Debug Link State Acknowledgement message\n"
"Debug Link State Update message\n" "Debug All message\n"
"Debug Link State Acknowledgement message\n" "Debug only sending message, entire packet\n"
"Debug All message\n" "Debug only receiving message, entire packet\n"
"Debug only sending message\n" "Debug only sending message, header only\n"
"Debug only receiving message\n") "Debug only receiving message, header only\n")
{ {
int idx_packet = 3; int idx_packet = 3;
int idx_send_recv = 4; int idx_send_recv = 4;
@ -2480,8 +2537,12 @@ DEFUN (debug_ospf6_message,
if (argc == 4) if (argc == 4)
level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV;
else if (!strncmp(argv[idx_send_recv]->arg, "send-h", 6))
level = OSPF6_DEBUG_MESSAGE_SEND_HDR;
else if (!strncmp(argv[idx_send_recv]->arg, "s", 1)) else if (!strncmp(argv[idx_send_recv]->arg, "s", 1))
level = OSPF6_DEBUG_MESSAGE_SEND; level = OSPF6_DEBUG_MESSAGE_SEND;
else if (!strncmp(argv[idx_send_recv]->arg, "recv-h", 6))
level = OSPF6_DEBUG_MESSAGE_RECV_HDR;
else if (!strncmp(argv[idx_send_recv]->arg, "r", 1)) else if (!strncmp(argv[idx_send_recv]->arg, "r", 1))
level = OSPF6_DEBUG_MESSAGE_RECV; level = OSPF6_DEBUG_MESSAGE_RECV;
@ -2494,22 +2555,21 @@ DEFUN (debug_ospf6_message,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_debug_ospf6_message, DEFUN(no_debug_ospf6_message, no_debug_ospf6_message_cmd,
no_debug_ospf6_message_cmd, "no debug ospf6 message <unknown|hello|dbdesc|lsreq|lsupdate|lsack|all> [<send|recv|send-hdr|recv-hdr>]",
"no debug ospf6 message <unknown|hello|dbdesc|lsreq|lsupdate|lsack|all> [<send|recv>]", NO_STR DEBUG_STR OSPF6_STR
NO_STR "Debug OSPFv3 message\n"
DEBUG_STR "Debug Unknown message\n"
OSPF6_STR "Debug Hello message\n"
"Debug OSPFv3 message\n" "Debug Database Description message\n"
"Debug Unknown message\n" "Debug Link State Request message\n"
"Debug Hello message\n" "Debug Link State Update message\n"
"Debug Database Description message\n" "Debug Link State Acknowledgement message\n"
"Debug Link State Request message\n" "Debug All message\n"
"Debug Link State Update message\n" "Debug only sending message, entire pkt\n"
"Debug Link State Acknowledgement message\n" "Debug only receiving message, entire pkt\n"
"Debug All message\n" "Debug only sending message, header only\n"
"Debug only sending message\n" "Debug only receiving message, header only\n")
"Debug only receiving message\n")
{ {
int idx_packet = 4; int idx_packet = 4;
int idx_send_recv = 5; int idx_send_recv = 5;
@ -2534,9 +2594,15 @@ DEFUN (no_debug_ospf6_message,
type = OSPF6_MESSAGE_TYPE_ALL; type = OSPF6_MESSAGE_TYPE_ALL;
if (argc == 5) if (argc == 5)
level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV
| OSPF6_DEBUG_MESSAGE_SEND_HDR
| OSPF6_DEBUG_MESSAGE_RECV_HDR;
else if (!strncmp(argv[idx_send_recv]->arg, "send-h", 6))
level = OSPF6_DEBUG_MESSAGE_SEND_HDR;
else if (!strncmp(argv[idx_send_recv]->arg, "s", 1)) else if (!strncmp(argv[idx_send_recv]->arg, "s", 1))
level = OSPF6_DEBUG_MESSAGE_SEND; level = OSPF6_DEBUG_MESSAGE_SEND;
else if (!strncmp(argv[idx_send_recv]->arg, "recv-h", 6))
level = OSPF6_DEBUG_MESSAGE_RECV_HDR;
else if (!strncmp(argv[idx_send_recv]->arg, "r", 1)) else if (!strncmp(argv[idx_send_recv]->arg, "r", 1))
level = OSPF6_DEBUG_MESSAGE_RECV; level = OSPF6_DEBUG_MESSAGE_RECV;
@ -2554,16 +2620,23 @@ int config_write_ospf6_debug_message(struct vty *vty)
{ {
const char *type_str[] = {"unknown", "hello", "dbdesc", const char *type_str[] = {"unknown", "hello", "dbdesc",
"lsreq", "lsupdate", "lsack"}; "lsreq", "lsupdate", "lsack"};
unsigned char s = 0, r = 0; unsigned char s = 0, r = 0, sh = 0, rh = 0;
int i; int i;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (IS_OSPF6_DEBUG_MESSAGE(i, SEND)) if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND))
s |= 1 << i; s |= 1 << i;
if (IS_OSPF6_DEBUG_MESSAGE(i, RECV)) if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV))
r |= 1 << i; r |= 1 << i;
} }
for (i = 0; i < 6; i++) {
if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND_HDR))
sh |= 1 << i;
if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV_HDR))
rh |= 1 << i;
}
if (s == 0x3f && r == 0x3f) { if (s == 0x3f && r == 0x3f) {
vty_out(vty, "debug ospf6 message all\n"); vty_out(vty, "debug ospf6 message all\n");
return 0; return 0;
@ -2577,6 +2650,14 @@ int config_write_ospf6_debug_message(struct vty *vty)
return 0; return 0;
} }
if (sh == 0x3f && rh == 0) {
vty_out(vty, "debug ospf6 message all send-hdr\n");
return 0;
} else if (sh == 0 && rh == 0x3f) {
vty_out(vty, "debug ospf6 message all recv-hdr\n");
return 0;
}
/* Unknown message is logged by default */ /* Unknown message is logged by default */
if (!IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, SEND) if (!IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, SEND)
&& !IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) && !IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV))
@ -2587,15 +2668,25 @@ int config_write_ospf6_debug_message(struct vty *vty)
vty_out(vty, "no debug ospf6 message unknown recv\n"); vty_out(vty, "no debug ospf6 message unknown recv\n");
for (i = 1; i < 6; i++) { for (i = 1; i < 6; i++) {
if (IS_OSPF6_DEBUG_MESSAGE(i, SEND) if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND)
&& IS_OSPF6_DEBUG_MESSAGE(i, RECV)) && IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV))
vty_out(vty, "debug ospf6 message %s\n", type_str[i]); vty_out(vty, "debug ospf6 message %s\n", type_str[i]);
else if (IS_OSPF6_DEBUG_MESSAGE(i, SEND)) else if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND))
vty_out(vty, "debug ospf6 message %s send\n", vty_out(vty, "debug ospf6 message %s send\n",
type_str[i]); type_str[i]);
else if (IS_OSPF6_DEBUG_MESSAGE(i, RECV)) else if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV))
vty_out(vty, "debug ospf6 message %s recv\n", vty_out(vty, "debug ospf6 message %s recv\n",
type_str[i]); type_str[i]);
else if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND_HDR)
&& IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV_HDR))
vty_out(vty, "debug ospf6 message %s; header only\n",
type_str[i]);
else if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, RECV_HDR))
vty_out(vty, "debug ospf6 message %s recv-hdr\n",
type_str[i]);
else if (IS_OSPF6_DEBUG_MESSAGE_ENABLED(i, SEND_HDR))
vty_out(vty, "debug ospf6 message %s send-hdr\n",
type_str[i]);
} }
return 0; return 0;

View file

@ -25,14 +25,34 @@
/* Debug option */ /* Debug option */
extern unsigned char conf_debug_ospf6_message[]; extern unsigned char conf_debug_ospf6_message[];
#define OSPF6_ACTION_SEND 0x01
#define OSPF6_ACTION_RECV 0x02
#define OSPF6_DEBUG_MESSAGE_SEND 0x01 #define OSPF6_DEBUG_MESSAGE_SEND 0x01
#define OSPF6_DEBUG_MESSAGE_RECV 0x02 #define OSPF6_DEBUG_MESSAGE_RECV 0x02
#define OSPF6_DEBUG_MESSAGE_SEND_HDR 0x04
#define OSPF6_DEBUG_MESSAGE_RECV_HDR 0x08
#define OSPF6_DEBUG_MESSAGE_SEND_BOTH \
OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_SEND_HDR
#define OSPF6_DEBUG_MESSAGE_RECV_BOTH \
OSPF6_DEBUG_MESSAGE_RECV | OSPF6_DEBUG_MESSAGE_RECV_HDR
#define OSPF6_DEBUG_MESSAGE_ON(type, level) \ #define OSPF6_DEBUG_MESSAGE_ON(type, level) \
(conf_debug_ospf6_message[type] |= (level)) (conf_debug_ospf6_message[type] |= (level))
#define OSPF6_DEBUG_MESSAGE_OFF(type, level) \ #define OSPF6_DEBUG_MESSAGE_OFF(type, level) \
(conf_debug_ospf6_message[type] &= ~(level)) (conf_debug_ospf6_message[type] &= ~(level))
#define IS_OSPF6_DEBUG_MESSAGE(t, e) \ #define IS_OSPF6_DEBUG_MESSAGE(t, e) \
(conf_debug_ospf6_message[t] & OSPF6_DEBUG_MESSAGE_##e) ((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_RECV_HDR) \
? (conf_debug_ospf6_message[t] \
& (OSPF6_DEBUG_MESSAGE_RECV_BOTH)) \
: (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_SEND_HDR) \
? (conf_debug_ospf6_message[t] \
& (OSPF6_DEBUG_MESSAGE_SEND_BOTH)) \
: (conf_debug_ospf6_message[t] \
& (OSPF6_DEBUG_MESSAGE_##e)))
#define IS_OSPF6_DEBUG_MESSAGE_ENABLED(type, e) \
(conf_debug_ospf6_message[type] & (OSPF6_DEBUG_MESSAGE_##e))
/* Type */ /* Type */
#define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0 #define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0
@ -110,11 +130,11 @@ struct ospf6_lsupdate {
/* It is just a sequence of LSA Headers */ /* It is just a sequence of LSA Headers */
/* Function definition */ /* Function definition */
extern void ospf6_hello_print(struct ospf6_header *); extern void ospf6_hello_print(struct ospf6_header *, int action);
extern void ospf6_dbdesc_print(struct ospf6_header *); extern void ospf6_dbdesc_print(struct ospf6_header *, int action);
extern void ospf6_lsreq_print(struct ospf6_header *); extern void ospf6_lsreq_print(struct ospf6_header *, int action);
extern void ospf6_lsupdate_print(struct ospf6_header *); extern void ospf6_lsupdate_print(struct ospf6_header *, int action);
extern void ospf6_lsack_print(struct ospf6_header *); extern void ospf6_lsack_print(struct ospf6_header *, int action);
extern int ospf6_iobuf_size(unsigned int size); extern int ospf6_iobuf_size(unsigned int size);
extern void ospf6_message_terminate(void); extern void ospf6_message_terminate(void);