mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 09:40:14 +00:00
ospf6d: add warning log for late hello packets
On transmit and receive calculate the time since the last hello was seen and log a warning if it is late by more than the hello period. Signed-off-by: Pat Ruddy <pat@voltanet.io>
This commit is contained in:
parent
432b7daf3d
commit
bb382e24f1
@ -121,6 +121,9 @@ struct ospf6_interface {
|
|||||||
|
|
||||||
struct ospf6_route_table *route_connected;
|
struct ospf6_route_table *route_connected;
|
||||||
|
|
||||||
|
/* last hello sent */
|
||||||
|
struct timeval last_hello;
|
||||||
|
|
||||||
/* prefix-list name to filter connected prefix */
|
/* prefix-list name to filter connected prefix */
|
||||||
char *plist_name;
|
char *plist_name;
|
||||||
|
|
||||||
|
@ -396,7 +396,10 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
int neighborchange = 0;
|
int neighborchange = 0;
|
||||||
int neighbor_ifindex_change = 0;
|
int neighbor_ifindex_change = 0;
|
||||||
int backupseen = 0;
|
int backupseen = 0;
|
||||||
|
int64_t latency = 0;
|
||||||
|
struct timeval timestamp;
|
||||||
|
|
||||||
|
monotime(×tamp);
|
||||||
hello = (struct ospf6_hello *)((caddr_t)oh
|
hello = (struct ospf6_hello *)((caddr_t)oh
|
||||||
+ sizeof(struct ospf6_header));
|
+ sizeof(struct ospf6_header));
|
||||||
|
|
||||||
@ -438,6 +441,17 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
on->priority = hello->priority;
|
on->priority = hello->priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check latency against hello period */
|
||||||
|
if (on->hello_in)
|
||||||
|
latency = monotime_since(&on->last_hello, NULL)
|
||||||
|
- (oi->hello_interval * 1000000);
|
||||||
|
/* log if latency exceeds the hello period */
|
||||||
|
if (latency > (oi->hello_interval * 1000000))
|
||||||
|
zlog_warn("%s RX %pI4 high latency %" PRId64 "us.", __func__,
|
||||||
|
&on->router_id, latency);
|
||||||
|
on->last_hello = timestamp;
|
||||||
|
on->hello_in++;
|
||||||
|
|
||||||
/* Always override neighbor's source address */
|
/* Always override neighbor's source address */
|
||||||
memcpy(&on->linklocal_addr, src, sizeof(struct in6_addr));
|
memcpy(&on->linklocal_addr, src, sizeof(struct in6_addr));
|
||||||
|
|
||||||
@ -1940,6 +1954,8 @@ static int ospf6_write(struct thread *thread)
|
|||||||
struct iovec iovector[2];
|
struct iovec iovector[2];
|
||||||
int pkt_count = 0;
|
int pkt_count = 0;
|
||||||
int len;
|
int len;
|
||||||
|
int64_t latency = 0;
|
||||||
|
struct timeval timestamp;
|
||||||
|
|
||||||
if (ospf6->fd < 0) {
|
if (ospf6->fd < 0) {
|
||||||
zlog_warn("ospf6_write failed to send, fd %d", ospf6->fd);
|
zlog_warn("ospf6_write failed to send, fd %d", ospf6->fd);
|
||||||
@ -1984,6 +2000,17 @@ static int ospf6_write(struct thread *thread)
|
|||||||
}
|
}
|
||||||
switch (oh->type) {
|
switch (oh->type) {
|
||||||
case OSPF6_MESSAGE_TYPE_HELLO:
|
case OSPF6_MESSAGE_TYPE_HELLO:
|
||||||
|
monotime(×tamp);
|
||||||
|
if (oi->hello_out)
|
||||||
|
latency = monotime_since(&oi->last_hello, NULL)
|
||||||
|
- (oi->hello_interval * 1000000);
|
||||||
|
|
||||||
|
/* log if latency exceeds the hello period */
|
||||||
|
if (latency > (oi->hello_interval * 1000000))
|
||||||
|
zlog_warn("%s hello TX high latency %" PRId64
|
||||||
|
"us.",
|
||||||
|
__func__, latency);
|
||||||
|
oi->last_hello = timestamp;
|
||||||
oi->hello_out++;
|
oi->hello_out++;
|
||||||
ospf6_hello_print(oh, OSPF6_ACTION_SEND);
|
ospf6_hello_print(oh, OSPF6_ACTION_SEND);
|
||||||
break;
|
break;
|
||||||
|
@ -47,6 +47,10 @@ struct ospf6_neighbor {
|
|||||||
uint32_t state_change;
|
uint32_t state_change;
|
||||||
struct timeval last_changed;
|
struct timeval last_changed;
|
||||||
|
|
||||||
|
/* last received hello */
|
||||||
|
struct timeval last_hello;
|
||||||
|
uint32_t hello_in;
|
||||||
|
|
||||||
/* Neighbor Router ID */
|
/* Neighbor Router ID */
|
||||||
in_addr_t router_id;
|
in_addr_t router_id;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user