diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-28 14:44:12 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-28 14:44:12 +0900 |
commit | 4be699a8dbb85cac1c80f5a1414bc8e4c1bd5035 (patch) | |
tree | d8cce7b4ed44f9c00e611f4204c6f53a94d00f5a | |
parent | 07db7f6bb8a94f8ec3aaaf043b76f5432d477501 (diff) | |
download | systemd-4be699a8dbb85cac1c80f5a1414bc8e4c1bd5035.tar.gz |
sd-lldp-rx: ignore all errors in processing datagram
-rw-r--r-- | src/libsystemd-network/sd-lldp-rx.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/libsystemd-network/sd-lldp-rx.c b/src/libsystemd-network/sd-lldp-rx.c index 8d9b132722..8431412613 100644 --- a/src/libsystemd-network/sd-lldp-rx.c +++ b/src/libsystemd-network/sd-lldp-rx.c @@ -178,16 +178,12 @@ static int lldp_rx_handle_datagram(sd_lldp_rx *lldp_rx, sd_lldp_neighbor *n) { assert(n); r = lldp_neighbor_parse(n); - if (r == -EBADMSG) /* Ignore bad messages */ - return 0; if (r < 0) return r; r = lldp_rx_add_neighbor(lldp_rx, n); - if (r < 0) { - log_lldp_rx_errno(lldp_rx, r, "Failed to add datagram. Ignoring."); - return 0; - } + if (r < 0) + return log_lldp_rx_errno(lldp_rx, r, "Failed to add datagram. Ignoring."); log_lldp_rx(lldp_rx, "Successfully processed LLDP datagram."); return 0; @@ -209,8 +205,10 @@ static int lldp_rx_receive_datagram(sd_event_source *s, int fd, uint32_t revents } n = lldp_neighbor_new(space); - if (!n) - return -ENOMEM; + if (!n) { + log_oom_debug(); + return 0; + } length = recv(fd, LLDP_NEIGHBOR_RAW(n), n->raw_size, MSG_DONTWAIT); if (length < 0) { @@ -232,7 +230,8 @@ static int lldp_rx_receive_datagram(sd_event_source *s, int fd, uint32_t revents else triple_timestamp_get(&n->timestamp); - return lldp_rx_handle_datagram(lldp_rx, n); + (void) lldp_rx_handle_datagram(lldp_rx, n); + return 0; } static void lldp_rx_reset(sd_lldp_rx *lldp_rx) { |