PUD: nwif: only evaluatie IPv4 and IPv6 addresses
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 5 Jun 2012 20:37:13 +0000 (22:37 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 7 Jun 2012 22:30:04 +0000 (00:30 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/networkInterfaces.c

index 7619c35..11cefea 100644 (file)
@@ -656,9 +656,7 @@ bool createNetworkInterfaces(socket_handler_func rxSocketHandlerFunction,
        /* loop over all interfaces */
        for (ifAddr = ifAddrs; ifAddr != NULL; ifAddr = ifAddr->ifa_next) {
                union olsr_sockaddr * addr = (union olsr_sockaddr *)ifAddr->ifa_addr;
-               if (addr != NULL) {
-                       int addrFamily = addr->in.sa_family;
-                       if (addrFamily == olsr_cnf->ip_version) {
+               if ((addr != NULL) && ((addr->in.sa_family == AF_INET) || (addr->in.sa_family == AF_INET6))) {
                                char * ifName = ifAddr->ifa_name;
 
                                struct interface * olsrIntf = ((addr->in.sa_family != olsr_cnf->ip_version) ?
@@ -700,7 +698,6 @@ bool createNetworkInterfaces(socket_handler_func rxSocketHandlerFunction,
                                        /* creating a transmit interface failed */
                                        goto end;
                                }
-                       }
                }
        }