utils: ifa_addr may be NULL, skip such entries
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 11 Aug 2014 17:42:59 +0000 (19:42 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 11 Aug 2014 17:42:59 +0000 (19:42 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
utils.c

diff --git a/utils.c b/utils.c
index d8a881c7552369150aa8da2c80bd68175301d765..cb478bb81c7a95eb97f9650bbb6f541ec32194e0 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -529,7 +529,7 @@ write_zone_uci(struct uci_context *ctx, struct fw3_zone *z,
 
                for (ifa = ifaddr; ifa; ifa = ifa->ifa_next)
                {
-                       if (strcmp(dev->name, ifa->ifa_name))
+                       if (!ifa->ifa_addr || strcmp(dev->name, ifa->ifa_name))
                                continue;
 
                        if (ifa->ifa_addr->sa_family == AF_INET)
@@ -852,7 +852,7 @@ fw3_flush_conntrack(void *state)
                        {
                                for (ifa = ifaddr; ifa && !found; ifa = ifa->ifa_next)
                                {
-                                       if (strcmp(dev->name, ifa->ifa_name))
+                                       if (!ifa->ifa_addr || strcmp(dev->name, ifa->ifa_name))
                                                continue;
 
                                        sin = (struct sockaddr_in *)ifa->ifa_addr;