mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 00:56:19 +00:00
Merge pull request #8839 from volta-networks/fix_ospf6_flags_for_error_logs
ospf6d: move error logs out from behind debug flags
This commit is contained in:
commit
a61bbb35a5
@ -974,11 +974,12 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from,
|
|||||||
/* if no database copy, should go above state (5) */
|
/* if no database copy, should go above state (5) */
|
||||||
assert(old);
|
assert(old);
|
||||||
|
|
||||||
if (is_debug) {
|
zlog_warn(
|
||||||
zlog_debug(
|
"Received is not newer, on the neighbor %s request-list",
|
||||||
"Received is not newer, on the neighbor's request-list");
|
from->name);
|
||||||
zlog_debug("BadLSReq, discard the received LSA");
|
zlog_warn(
|
||||||
}
|
"BadLSReq, discard the received LSA lsa %s send badLSReq",
|
||||||
|
new->name);
|
||||||
|
|
||||||
/* BadLSReq */
|
/* BadLSReq */
|
||||||
thread_add_event(master, bad_lsreq, from, 0, NULL);
|
thread_add_event(master, bad_lsreq, from, 0, NULL);
|
||||||
|
@ -701,9 +701,7 @@ int interface_up(struct thread *thread)
|
|||||||
|
|
||||||
/* check physical interface is up */
|
/* check physical interface is up */
|
||||||
if (!if_is_operative(oi->interface)) {
|
if (!if_is_operative(oi->interface)) {
|
||||||
if (IS_OSPF6_DEBUG_INTERFACE)
|
zlog_warn("Interface %s is down, can't execute [InterfaceUp]",
|
||||||
zlog_debug(
|
|
||||||
"Interface %s is down, can't execute [InterfaceUp]",
|
|
||||||
oi->interface->name);
|
oi->interface->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -711,8 +709,7 @@ int interface_up(struct thread *thread)
|
|||||||
/* check interface has a link-local address */
|
/* check interface has a link-local address */
|
||||||
if (!(ospf6_interface_get_linklocal_address(oi->interface)
|
if (!(ospf6_interface_get_linklocal_address(oi->interface)
|
||||||
|| if_is_loopback_or_vrf(oi->interface))) {
|
|| if_is_loopback_or_vrf(oi->interface))) {
|
||||||
if (IS_OSPF6_DEBUG_INTERFACE)
|
zlog_warn(
|
||||||
zlog_debug(
|
|
||||||
"Interface %s has no link local address, can't execute [InterfaceUp]",
|
"Interface %s has no link local address, can't execute [InterfaceUp]",
|
||||||
oi->interface->name);
|
oi->interface->name);
|
||||||
return 0;
|
return 0;
|
||||||
@ -731,7 +728,7 @@ int interface_up(struct thread *thread)
|
|||||||
|
|
||||||
/* If no area assigned, return */
|
/* If no area assigned, return */
|
||||||
if (oi->area == NULL) {
|
if (oi->area == NULL) {
|
||||||
zlog_debug(
|
zlog_warn(
|
||||||
"%s: Not scheduleing Hello for %s as there is no area assigned yet",
|
"%s: Not scheduleing Hello for %s as there is no area assigned yet",
|
||||||
__func__, oi->interface->name);
|
__func__, oi->interface->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -289,8 +289,7 @@ int ospf6_router_lsa_originate(struct thread *thread)
|
|||||||
if ((caddr_t)lsdesc
|
if ((caddr_t)lsdesc
|
||||||
== (caddr_t)router_lsa
|
== (caddr_t)router_lsa
|
||||||
+ sizeof(struct ospf6_router_lsa)) {
|
+ sizeof(struct ospf6_router_lsa)) {
|
||||||
if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
|
zlog_warn(
|
||||||
zlog_debug(
|
|
||||||
"Size limit setting for Router-LSA too short");
|
"Size limit setting for Router-LSA too short");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -442,34 +442,34 @@ static void ospf6_dbdesc_recv_master(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_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Master/Slave bit mismatch");
|
"DbDesc recv: Master/Slave bit mismatch Nbr %s",
|
||||||
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
|
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn("DbDesc recv: Initialize bit mismatch Nbr %s",
|
||||||
zlog_debug("Initialize bit mismatch");
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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_HDR))
|
zlog_warn("DbDesc recv: Option field mismatch Nbr %s",
|
||||||
zlog_debug("Option field mismatch");
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum) {
|
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn(
|
||||||
zlog_debug(
|
"DbDesc recv: Sequence number mismatch Nbr %s (%#lx expected)",
|
||||||
"Sequence number mismatch (%#lx expected)",
|
on->name, (unsigned long)on->dbdesc_seqnum);
|
||||||
(unsigned long)on->dbdesc_seqnum);
|
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
@ -488,9 +488,9 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Not duplicate dbdesc in state %s",
|
"DbDesc recv: Not duplicate dbdesc in state %s Nbr %s",
|
||||||
ospf6_neighbor_state_str[on->state]);
|
ospf6_neighbor_state_str[on->state], on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
|
thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -663,34 +663,36 @@ 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_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Master/Slave bit mismatch");
|
"DbDesc slave recv: Master/Slave bit mismatch Nbr %s",
|
||||||
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
|
if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Initialize bit mismatch");
|
"DbDesc slave recv: Initialize bit mismatch Nbr %s",
|
||||||
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Option field mismatch");
|
"DbDesc slave recv: Option field mismatch Nbr %s",
|
||||||
|
on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum + 1) {
|
if (ntohl(dbdesc->seqnum) != on->dbdesc_seqnum + 1) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn(
|
||||||
zlog_debug(
|
"DbDesc slave recv: Sequence number mismatch Nbr %s (%#lx expected)",
|
||||||
"Sequence number mismatch (%#lx expected)",
|
on->name, (unsigned long)on->dbdesc_seqnum + 1);
|
||||||
(unsigned long)on->dbdesc_seqnum + 1);
|
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0,
|
thread_add_event(master, seqnumber_mismatch, on, 0,
|
||||||
NULL);
|
NULL);
|
||||||
return;
|
return;
|
||||||
@ -712,9 +714,9 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
|
zlog_warn(
|
||||||
zlog_debug("Not duplicate dbdesc in state %s",
|
"DbDesc slave recv: Not duplicate dbdesc in state %s Nbr %s",
|
||||||
ospf6_neighbor_state_str[on->state]);
|
ospf6_neighbor_state_str[on->state], on->name);
|
||||||
thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
|
thread_add_event(master, seqnumber_mismatch, on, 0, NULL);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -888,12 +890,10 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
/* Find database copy */
|
/* Find database copy */
|
||||||
lsa = ospf6_lsdb_lookup(e->type, e->id, e->adv_router, lsdb);
|
lsa = ospf6_lsdb_lookup(e->type, e->id, e->adv_router, lsdb);
|
||||||
if (lsa == NULL) {
|
if (lsa == NULL) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) {
|
zlog_warn(
|
||||||
zlog_debug(
|
"Can't find requested lsa [%s Id:%pI4 Adv:%pI4] send badLSReq",
|
||||||
"Can't find requested [%s Id:%pI4 Adv:%pI4]",
|
|
||||||
ospf6_lstype_name(e->type), &e->id,
|
ospf6_lstype_name(e->type), &e->id,
|
||||||
&e->adv_router);
|
&e->adv_router);
|
||||||
}
|
|
||||||
thread_add_event(master, bad_lsreq, on, 0, NULL);
|
thread_add_event(master, bad_lsreq, on, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -923,17 +923,13 @@ 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,
|
zlog_warn("%s: undersized IPv6 prefix header",
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug("%s: undersized IPv6 prefix header",
|
|
||||||
__func__);
|
__func__);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
/* 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,
|
zlog_warn("%s: invalid PrefixLength (%u bits)",
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug("%s: invalid PrefixLength (%u bits)",
|
|
||||||
__func__, current->prefix_length);
|
__func__, current->prefix_length);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -942,10 +938,7 @@ static unsigned ospf6_prefixes_examin(
|
|||||||
OSPF6_PREFIX_MIN_SIZE
|
OSPF6_PREFIX_MIN_SIZE
|
||||||
+ 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,
|
zlog_warn("%s: undersized IPv6 prefix", __func__);
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug("%s: undersized IPv6 prefix",
|
|
||||||
__func__);
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
/* next prefix */
|
/* next prefix */
|
||||||
@ -955,9 +948,7 @@ 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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
|
||||||
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);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
@ -988,10 +979,7 @@ 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,
|
zlog_warn("%s: undersized (%u B) LSA", __func__, lsalen);
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug("%s: undersized (%u B) LSA", __func__,
|
|
||||||
lsalen);
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
switch (lsatype) {
|
switch (lsatype) {
|
||||||
@ -1001,10 +989,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
|||||||
by N>=0 interface descriptions. */
|
by N>=0 interface descriptions. */
|
||||||
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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
"%s: Router LSA interface description alignment error",
|
||||||
zlog_debug(
|
|
||||||
"%s: interface description alignment error",
|
|
||||||
__func__);
|
__func__);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1015,10 +1001,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
|||||||
if ((lsalen - OSPF6_LSA_HEADER_SIZE
|
if ((lsalen - OSPF6_LSA_HEADER_SIZE
|
||||||
- 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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
"%s: Network LSA router description alignment error",
|
||||||
zlog_debug(
|
|
||||||
"%s: router description alignment error",
|
|
||||||
__func__);
|
__func__);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1040,10 +1024,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
|||||||
/* RFC5340 A.4.6, fixed-size LSA. */
|
/* RFC5340 A.4.6, fixed-size LSA. */
|
||||||
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,
|
zlog_warn("%s: Inter Router LSA oversized (%u B) LSA",
|
||||||
RECV_HDR))
|
__func__, lsalen);
|
||||||
zlog_debug("%s: oversized (%u B) LSA", __func__,
|
|
||||||
lsalen);
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1069,9 +1051,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
|||||||
IPv6
|
IPv6
|
||||||
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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
"%s: AS External undersized (%u B) LSA header",
|
||||||
zlog_debug("%s: undersized (%u B) LSA header",
|
|
||||||
__func__, lsalen);
|
__func__, lsalen);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1088,9 +1069,8 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
|||||||
I.e.,
|
I.e.,
|
||||||
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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
"%s: AS External undersized (%u B) LSA header",
|
||||||
zlog_debug("%s: undersized (%u B) LSA header",
|
|
||||||
__func__, lsalen);
|
__func__, lsalen);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1157,9 +1137,7 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
|
|||||||
while (length) {
|
while (length) {
|
||||||
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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
|
||||||
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);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
@ -1167,9 +1145,7 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
|
|||||||
/* save on ntohs() calls here and in the LSA validator */
|
/* save on ntohs() calls here and in the LSA validator */
|
||||||
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,
|
zlog_warn(
|
||||||
RECV_HDR))
|
|
||||||
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);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
@ -1177,13 +1153,9 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
|
|||||||
if (headeronly) {
|
if (headeronly) {
|
||||||
/* 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(
|
zlog_warn(
|
||||||
OSPF6_MESSAGE_TYPE_UNKNOWN,
|
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug(
|
|
||||||
"%s: anomaly in header-only %s LSA #%u",
|
"%s: anomaly in header-only %s LSA #%u",
|
||||||
__func__,
|
__func__, ospf6_lstype_name(lsah->type),
|
||||||
ospf6_lstype_name(lsah->type),
|
|
||||||
counted_lsas);
|
counted_lsas);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1195,23 +1167,14 @@ ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */
|
|||||||
/* make sure the input buffer is deep enough before
|
/* make sure the input buffer is deep enough before
|
||||||
* further checks */
|
* further checks */
|
||||||
if (lsalen > length) {
|
if (lsalen > length) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(
|
zlog_warn(
|
||||||
OSPF6_MESSAGE_TYPE_UNKNOWN,
|
|
||||||
RECV_HDR))
|
|
||||||
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__, ospf6_lstype_name(lsah->type),
|
||||||
ospf6_lstype_name(lsah->type),
|
|
||||||
counted_lsas, lsalen, length);
|
counted_lsas, lsalen, length);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 0)) {
|
if (MSG_OK != ospf6_lsa_examin(lsah, lsalen, 0)) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(
|
zlog_warn("%s: anomaly in %s LSA #%u", __func__,
|
||||||
OSPF6_MESSAGE_TYPE_UNKNOWN,
|
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug(
|
|
||||||
"%s: anomaly in %s LSA #%u",
|
|
||||||
__func__,
|
|
||||||
ospf6_lstype_name(lsah->type),
|
ospf6_lstype_name(lsah->type),
|
||||||
counted_lsas);
|
counted_lsas);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
@ -1224,10 +1187,7 @@ 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,
|
zlog_warn("%s: #LSAs declared (%u) does not match actual (%u)",
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug(
|
|
||||||
"%s: #LSAs declared (%u) does not match actual (%u)",
|
|
||||||
__func__, declared_num_lsas, counted_lsas);
|
__func__, declared_num_lsas, counted_lsas);
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
@ -1243,41 +1203,31 @@ 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,
|
zlog_warn("%s: undersized (%u B) packet", __func__,
|
||||||
RECV_HDR))
|
|
||||||
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,
|
zlog_warn("%s: %s packet length error (%u real, %u declared)",
|
||||||
RECV_HDR))
|
__func__,
|
||||||
zlog_debug(
|
lookup_msg(ospf6_message_type_str, oh->type, NULL),
|
||||||
"%s: %s packet length error (%u real, %u declared)",
|
|
||||||
__func__, lookup_msg(ospf6_message_type_str,
|
|
||||||
oh->type, NULL),
|
|
||||||
bytesonwire, ntohs(oh->length));
|
bytesonwire, ntohs(oh->length));
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
/* version check */
|
/* version check */
|
||||||
if (oh->version != OSPFV3_VERSION) {
|
if (oh->version != OSPFV3_VERSION) {
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN,
|
zlog_warn("%s: invalid (%u) protocol version", __func__,
|
||||||
RECV_HDR))
|
oh->version);
|
||||||
zlog_debug("%s: invalid (%u) protocol version",
|
|
||||||
__func__, oh->version);
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
/* length, 2nd approximation */
|
/* length, 2nd approximation */
|
||||||
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,
|
zlog_warn("%s: undersized (%u B) %s packet", __func__,
|
||||||
RECV_HDR))
|
|
||||||
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, NULL));
|
||||||
NULL));
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
/* type-specific deeper validation */
|
/* type-specific deeper validation */
|
||||||
@ -1290,11 +1240,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,
|
zlog_warn("%s: alignment error in %s packet", __func__,
|
||||||
RECV_HDR))
|
lookup_msg(ospf6_message_type_str, oh->type, NULL));
|
||||||
zlog_debug("%s: alignment error in %s packet", __func__,
|
|
||||||
lookup_msg(ospf6_message_type_str, oh->type,
|
|
||||||
NULL));
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
case OSPF6_MESSAGE_TYPE_DBDESC:
|
case OSPF6_MESSAGE_TYPE_DBDESC:
|
||||||
/* RFC5340 A.3.3, packet header + OSPF6_DB_DESC_MIN_SIZE bytes
|
/* RFC5340 A.3.3, packet header + OSPF6_DB_DESC_MIN_SIZE bytes
|
||||||
@ -1314,11 +1261,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,
|
zlog_warn("%s: alignment error in %s packet", __func__,
|
||||||
RECV_HDR))
|
lookup_msg(ospf6_message_type_str, oh->type, NULL));
|
||||||
zlog_debug("%s: alignment error in %s packet", __func__,
|
|
||||||
lookup_msg(ospf6_message_type_str, oh->type,
|
|
||||||
NULL));
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
case OSPF6_MESSAGE_TYPE_LSUPDATE:
|
case OSPF6_MESSAGE_TYPE_LSUPDATE:
|
||||||
/* RFC5340 A.3.5, packet header + OSPF6_LS_UPD_MIN_SIZE bytes
|
/* RFC5340 A.3.5, packet header + OSPF6_LS_UPD_MIN_SIZE bytes
|
||||||
@ -1343,15 +1287,11 @@ 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,
|
zlog_warn("%s: invalid (%u) message type", __func__, oh->type);
|
||||||
RECV_HDR))
|
|
||||||
zlog_debug("%s: invalid (%u) message type", __func__,
|
|
||||||
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_HDR))
|
zlog_warn("%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;
|
||||||
}
|
}
|
||||||
|
@ -284,9 +284,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
|
|||||||
|
|
||||||
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
||||||
if (oi == NULL) {
|
if (oi == NULL) {
|
||||||
if (IS_OSPF6_DEBUG_SPF(PROCESS))
|
zlog_warn("Can't find interface in SPF: ifindex %d", ifindex);
|
||||||
zlog_debug("Can't find interface in SPF: ifindex %d",
|
|
||||||
ifindex);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,9 +473,7 @@ void ospf6_spf_calculation(uint32_t router_id,
|
|||||||
/* construct root vertex */
|
/* construct root vertex */
|
||||||
lsa = ospf6_create_single_router_lsa(oa, oa->lsdb_self, router_id);
|
lsa = ospf6_create_single_router_lsa(oa, oa->lsdb_self, router_id);
|
||||||
if (lsa == NULL) {
|
if (lsa == NULL) {
|
||||||
if (IS_OSPF6_DEBUG_SPF(PROCESS))
|
zlog_warn("%s: No router LSA for area %s", __func__, oa->name);
|
||||||
zlog_debug("%s: No router LSA for area %s", __func__,
|
|
||||||
oa->name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user