From 3e0bfbf5ee552b20aaf956dc7c6c51aebe9eab54 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 6 Oct 2010 14:01:01 +0200 Subject: [PATCH] Skip interfaces without IP addresses --- src/ip_addr_helper.cpp | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/ip_addr_helper.cpp b/src/ip_addr_helper.cpp index 5d49a21..56100bb 100644 --- a/src/ip_addr_helper.cpp +++ b/src/ip_addr_helper.cpp @@ -218,6 +218,10 @@ string IPAddrHelper::get_local_wan_nic_ip() const // Iterate through the linked list. for ( ifa = if_addr_struct; ifa != NULL; ifa = ifa->ifa_next) { + // Skip interfaces without IP addresses + if (!ifa->ifa_addr) + continue; + // Get the address family of the actual address. address_family = ifa->ifa_addr->sa_family; -- 1.7.1