From 688a779b157c6c87fb3da7931d18178ca95997ad Mon Sep 17 00:00:00 2001 From: yanxiaojia Date: Wed, 27 Jul 2022 14:53:29 +0800 Subject: [PATCH 1/2] fix NULL pointer reference --- src/common/pf_lldp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/pf_lldp.c b/src/common/pf_lldp.c index 0037d010..16551dd2 100644 --- a/src/common/pf_lldp.c +++ b/src/common/pf_lldp.c @@ -1968,6 +1968,10 @@ int pf_lldp_recv ( pf_lldp_peer_info_t peer_data; int err = 0; + if (net->lldp_mutex == NULL) { + return -1; + } + err = pf_lldp_parse_packet (buf, buf_len, &peer_data); if (!err) From 0df6039a0dd4ad28e889c2112b5686d1b8865734 Mon Sep 17 00:00:00 2001 From: Ivan <2827138147@qq.com> Date: Wed, 3 Jul 2024 15:22:15 +0800 Subject: [PATCH 2/2] add sleep to wait init finish --- src/ports/linux/pnal_eth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ports/linux/pnal_eth.c b/src/ports/linux/pnal_eth.c index 832129bb..ff899f44 100644 --- a/src/ports/linux/pnal_eth.c +++ b/src/ports/linux/pnal_eth.c @@ -31,6 +31,7 @@ #include #include +#include struct pnal_eth_handle { @@ -59,6 +60,9 @@ static void os_eth_task (void * thread_arg) pnal_buf_t * p = pnal_buf_alloc (PNAL_BUF_MAX_SIZE); assert (p != NULL); + // Wait to init finish + sleep(1); + while (1) { readlen = recv (eth_handle->socket, p->payload, PNAL_BUF_MAX_SIZE, 0);