Browse Source

main: avoid adding redundant interfaces

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Markus 8 years ago
parent
commit
5bd3096cf8
1 changed files with 5 additions and 0 deletions
  1. 5 0
      main.c

+ 5 - 0
main.c

@@ -653,6 +653,11 @@ static struct relayd_interface *alloc_interface(const char *ifname, bool managed
 	if (strlen(ifname) >= IFNAMSIZ)
 		return NULL;
 
+	list_for_each_entry(rif, &interfaces, list) {
+		if (!strncmp(rif->ifname, ifname, IFNAMSIZ))
+			return rif;
+	}
+
 	rif = calloc(1, sizeof(*rif));
 	if (!rif)
 		return NULL;