1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

sd-lldp-rx: ignore all errors in processing datagram

This commit is contained in:
Yu Watanabe 2021-09-28 14:44:12 +09:00
parent 07db7f6bb8
commit 4be699a8db

View File

@ -178,16 +178,12 @@ static int lldp_rx_handle_datagram(sd_lldp_rx *lldp_rx, sd_lldp_neighbor *n) {
assert(n); assert(n);
r = lldp_neighbor_parse(n); r = lldp_neighbor_parse(n);
if (r == -EBADMSG) /* Ignore bad messages */
return 0;
if (r < 0) if (r < 0)
return r; return r;
r = lldp_rx_add_neighbor(lldp_rx, n); r = lldp_rx_add_neighbor(lldp_rx, n);
if (r < 0) { if (r < 0)
log_lldp_rx_errno(lldp_rx, r, "Failed to add datagram. Ignoring."); return log_lldp_rx_errno(lldp_rx, r, "Failed to add datagram. Ignoring.");
return 0;
}
log_lldp_rx(lldp_rx, "Successfully processed LLDP datagram."); log_lldp_rx(lldp_rx, "Successfully processed LLDP datagram.");
return 0; 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); n = lldp_neighbor_new(space);
if (!n) if (!n) {
return -ENOMEM; log_oom_debug();
return 0;
}
length = recv(fd, LLDP_NEIGHBOR_RAW(n), n->raw_size, MSG_DONTWAIT); length = recv(fd, LLDP_NEIGHBOR_RAW(n), n->raw_size, MSG_DONTWAIT);
if (length < 0) { if (length < 0) {
@ -232,7 +230,8 @@ static int lldp_rx_receive_datagram(sd_event_source *s, int fd, uint32_t revents
else else
triple_timestamp_get(&n->timestamp); 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) { static void lldp_rx_reset(sd_lldp_rx *lldp_rx) {