]> git.meshlink.io Git - catta/blobdiff - src/iface-windows.c
change some int declarations that should have said CattaIfIndex
[catta] / src / iface-windows.c
index 5624f739fed2c2644fbb3aa7e91c302c5f505831..5ad14606d9b1f0821e5d3c2f5743ba23360cccda 100644 (file)
@@ -39,6 +39,12 @@ static void ip_adapter_unicast_address(CattaInterfaceMonitor *m,
     CattaInterfaceAddress *ifaddr;
     struct sockaddr *sa = a->Address.lpSockaddr;
 
+    // skip transient addresses; to quote MSDN: "The IP address is a cluster
+    // address and should not be used by most applications."
+    // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366066(v=vs.85).aspx
+    if(a->Flags & IP_ADAPTER_ADDRESS_TRANSIENT)
+        return;
+
     // fill addr struct for address lookup
     switch(sa->sa_family) {
     case AF_INET:
@@ -68,6 +74,10 @@ static void ip_adapter_unicast_address(CattaInterfaceMonitor *m,
     }
 
     // set global scope flag
+    // XXX should we use the IP_ADAPTER_ADDRESS_DNS_ELIGIBLE flag for this?
+    //     it looks like it gets set for IPv4 addresses that are not localhost
+    //     and for IPv6 addresses with global scope. not sure about multicast
+    //     addresses.
     if(addr.proto == CATTA_PROTO_INET6)
         ifaddr->global_scope = !(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr.data.data)
                                  || IN6_IS_ADDR_MULTICAST((struct in6_addr *)addr.data.data));
@@ -78,9 +88,11 @@ static void ip_adapter_unicast_address(CattaInterfaceMonitor *m,
     {
         char s[CATTA_ADDRESS_STR_MAX];
         catta_log_debug(" address: %s\n"
-                        "   global_scope: %d",
+                        "   global_scope: %d\n"
+                        "   flags: 0x%.4x",
             catta_address_snprint(s, sizeof(s), &addr),
-            ifaddr->global_scope);
+            ifaddr->global_scope,
+            (unsigned int)a->Flags);
     }
 }