diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-21 20:38:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-21 20:58:59 +0100 |
commit | 90dffb2241fa03011b625c26943f36f525e6c323 (patch) | |
tree | 381faded6de261589be452e341eec17a4389c0d6 /src/network | |
parent | d08191a242d51f72e75d41f188b14e67dd8851c4 (diff) |
sd-lldp: beef up callback logic
Instead of just notifying about the fact that something changed in the
database, actually inform the callback what precisely changed. This is useful,
so that the LLDP tx logic can be put into "fast" mode as soon as a previously
unknown peer appears, as suggested by the LLDP spec.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-link.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 86fa4f07f2..85a439b2a5 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1333,12 +1333,23 @@ finish: return r; } -static void lldp_handler(sd_lldp *lldp, void *userdata) { +static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) { Link *link = userdata; + int r; assert(link); (void) link_lldp_save(link); + + if (link_lldp_tx_enabled(link) && event == SD_LLDP_EVENT_ADDED) { + /* If we received information about a new neighbor, restart the LLDP "fast" logic */ + + log_link_debug(link, "Received LLDP datagram from previously unknown neighbor, restarting 'fast' LLDP transmission."); + + r = link_lldp_tx_start(link); + if (r < 0) + log_link_warning_errno(link, r, "Failed to restart LLDP transmission: %m"); + } } static int link_acquire_ipv6_conf(Link *link) { |