summaryrefslogtreecommitdiff
path: root/src/rtnl.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-08-08 13:08:57 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-08-08 13:08:57 -0700
commit18fb682a6a072762fc2dd587a299084836e0a1ff (patch)
tree9f2cba269d4a4d5dd8c48eb079fb85d1f3dfe7cd /src/rtnl.c
parent326b5a87ca55dc46578283f2624ee451bdf29f4e (diff)
downloadconnman-18fb682a6a072762fc2dd587a299084836e0a1ff.tar.gz
connman-18fb682a6a072762fc2dd587a299084836e0a1ff.tar.bz2
connman-18fb682a6a072762fc2dd587a299084836e0a1ff.zip
Fix issues with hashing of RTNL interfaces and their flags
Diffstat (limited to 'src/rtnl.c')
-rw-r--r--src/rtnl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rtnl.c b/src/rtnl.c
index 44126307..d7b317c3 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -167,19 +167,21 @@ static void process_newlink(unsigned short type, int index,
case ARPHRD_ETHER:
case ARPHRD_LOOPBACK:
case ARPHRD_NONE:
- ipconfig = g_hash_table_lookup(ipconfig_hash, &index);
+ ipconfig = g_hash_table_lookup(ipconfig_hash,
+ GINT_TO_POINTER(index));
if (ipconfig == NULL) {
ipconfig = connman_ipconfig_create(index);
if (ipconfig != NULL) {
g_hash_table_insert(ipconfig_hash,
- &index, ipconfig);
+ GINT_TO_POINTER(index), ipconfig);
__connman_rtnl_register_ipconfig(ipconfig);
-
- __connman_ipconfig_update_link(ipconfig,
- flags, change);
}
}
+
+ if (ipconfig != NULL)
+ __connman_ipconfig_update_link(ipconfig,
+ flags, change);
break;
}
@@ -217,7 +219,7 @@ static void process_dellink(unsigned short type, int index,
case ARPHRD_ETHER:
case ARPHRD_LOOPBACK:
case ARPHRD_NONE:
- g_hash_table_remove(ipconfig_hash, &index);
+ g_hash_table_remove(ipconfig_hash, GINT_TO_POINTER(index));
break;
}
}
@@ -917,7 +919,7 @@ int __connman_rtnl_init(void)
DBG("");
- ipconfig_hash = g_hash_table_new_full(g_int_hash, g_int_equal,
+ ipconfig_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, free_ipconfig);
sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);