From 1dde00299bcc90cdfff86ec00e651b51d7bbae2b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 18 Aug 2020 23:00:40 +0200 Subject: [PATCH] Ensure mock-devices which are not assigned to any addresses any more (they have been converted to "real" devices), are removed at this point Signed-off-by: DL6ER --- src/database/network-table.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/database/network-table.c b/src/database/network-table.c index 1c9c83d2..ed2b6b90 100644 --- a/src/database/network-table.c +++ b/src/database/network-table.c @@ -1135,6 +1135,12 @@ void parse_neighbor_cache(void) return; } + // Ensure mock-devices which are not assigned to any addresses any more + // (they have been converted to "real" devices), are removed at this point + dbquery("DELETE FROM network WHERE id NOT IN " + "(SELECT network_id from network_addresses) " + "AND hwaddr LIKE 'ip-%%';"); + // Actually update the database if((rc = dbquery("END TRANSACTION")) != SQLITE_OK) { const char *text;