From 5bd3096cf8309f11d07b8cce5e7a515f526c3674 Mon Sep 17 00:00:00 2001 From: Markus Date: Wed, 3 Feb 2016 14:29:48 +0100 Subject: [PATCH] main: avoid adding redundant interfaces Signed-off-by: Felix Fietkau --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index bd330ee..b3c13f7 100644 --- a/main.c +++ b/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; -- 2.25.1