summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/sd-lldp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network/sd-lldp.c')
-rw-r--r--src/libsystemd-network/sd-lldp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index 65cfa4e184..3af6133a4e 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -28,6 +28,7 @@
#include "lldp-neighbor.h"
#include "lldp-network.h"
#include "socket-util.h"
+#include "ether-addr-util.h"
#define LLDP_DEFAULT_NEIGHBORS_MAX 128U
@@ -99,6 +100,11 @@ static int lldp_add_neighbor(sd_lldp *lldp, sd_lldp_neighbor *n) {
if (n->ttl <= 0)
return changed;
+ /* Filter out the filter address */
+ if (!ether_addr_is_null(&lldp->filter_address) &&
+ ether_addr_equal(&lldp->filter_address, &n->source_address))
+ return changed;
+
/* Only add if the neighbor has a capability we are interested in. Note that we also store all neighbors with
* no caps field set. */
if (n->has_capabilities &&
@@ -438,3 +444,18 @@ _public_ int sd_lldp_match_capabilities(sd_lldp *lldp, uint16_t mask) {
return 0;
}
+
+_public_ int sd_lldp_set_filter_address(sd_lldp *lldp, const struct ether_addr *addr) {
+ assert_return(lldp, -EINVAL);
+
+ /* In order to deal nicely with bridges that send back our own packets, allow one address to be filtered, so
+ * that our own can be filtered out here. */
+
+ if (!addr) {
+ zero(lldp->filter_address);
+ return 0;
+ }
+
+ lldp->filter_address = *addr;
+ return 0;
+}