On 02/02/2011 07:55 PM, Mark Rustad wrote:
+static char *
+find_ifname(const struct ifaddrs *ifa, const union sockaddr_u *ss)
+{
+       for (; ifa; ifa = ifa->ifa_next) {


I made one small fix. ifa->ifa_addr can be null, so we need to check

if (!ifa->ifa_addr)
        continue;



+               if (ss->ss.ss_family != ifa->ifa_addr->sa_family)
+                       continue;
+               switch (ss->ss.ss_family) {
+               case AF_INET:
+                       if (inet_cmp_addr(ss, (union sockaddr_u 
*)ifa->ifa_addr) == 0)
+                               return ifa->ifa_name;
+                       break;
+               case AF_INET6:
+                       if (inet6_cmp_addr(ss, (union sockaddr_u 
*)ifa->ifa_addr) == 0)
+                               return ifa->ifa_name;
+                       break;
+               }
+       }
+
+       return NULL;
+}

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to