Committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx> Date: Wed Feb 17 20:05:24 2010 +0100 Revision: 3595 Revision-id: rene.hummen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: packaging Log: getifaddrs also returns so far unhandled addr types on Maemo devices testing of getifaddrs came up with type pseudo_AF_HDRCMPLT, however the cast only processes AF_INET and AF_INET6. Modified: M hipd/netdev.c M lib/core/misc.c === modified file 'hipd/netdev.c' --- hipd/netdev.c 2010-02-17 15:37:02 +0000 +++ hipd/netdev.c 2010-02-17 19:05:24 +0000 @@ -308,6 +308,7 @@ struct netdev_address *n; hip_list_t *tmp, *t; int c; + int err = 0; const struct in6_addr *in6; const struct in_addr *in; @@ -322,11 +323,13 @@ if (mapped) { in6 = (const struct in6_addr * ) hip_cast_sa_addr((struct sockaddr *) (&n->addr)); - _HIP_DEBUG_IN6ADDR("in6:", in6); - in = (const struct in_addr *) hip_cast_sa_addr(addr); - HIP_DEBUG_INADDR("in:", in); + + HIP_IFEL(!(in = (const struct in_addr *) hip_cast_sa_addr(addr)), + -1, "unable to cast address\n"); + addr_match = IPV6_EQ_IPV4(in6, in); family_match = 1; + } else if (!mapped && addr->sa_family == AF_INET6) { addr_match = !memcmp(hip_cast_sa_addr((struct sockaddr *) &n->addr), hip_cast_sa_addr(addr), @@ -347,12 +350,16 @@ if ((n->if_index == ifindex || ifindex == -1) && family_match && addr_match) { HIP_DEBUG("Address exist in the list\n"); - return 1; + + err = 1; + goto out_err; } } HIP_DEBUG("Address does not exists in the list\n"); - return 0; + +out_err: + return err; } /** === modified file 'lib/core/misc.c' --- lib/core/misc.c 2010-02-16 18:34:59 +0000 +++ lib/core/misc.c 2010-02-17 19:05:24 +0000 @@ -1642,7 +1642,7 @@ case AF_INET6: return &(((struct sockaddr_in6 *) sa)->sin6_addr); default: - HIP_ERROR("unknown type, skipping type conversion\n"); + HIP_ERROR("unhandled type: %i, skipping cast\n", sa->sa_family); return NULL; } }