#include <config.h>
#endif
+#include <net/if.h>
+
+#ifndef IFF_LOWER_UP
+#define IFF_LOWER_UP 0x10000
+#endif
+
#include <gdbus.h>
#include "connman.h"
gint refcount;
int index;
char *interface;
+ unsigned int flags;
enum connman_ipconfig_method method;
};
void __connman_ipconfig_update_link(struct connman_ipconfig *ipconfig,
unsigned flags, unsigned change)
{
- connman_info("%s {update} flags %u change %u", ipconfig->interface,
- flags, change);
+ GString *str;
+
+ if (flags == ipconfig->flags)
+ return;
+
+ ipconfig->flags = flags;
+
+ str = g_string_new(NULL);
+ if (str == NULL)
+ return;
+
+ if (flags & IFF_UP)
+ g_string_append(str, "UP");
+ else
+ g_string_append(str, "DOWN");
+
+ if (flags & IFF_RUNNING)
+ g_string_append(str, ",RUNNING");
+
+ if (flags & IFF_LOWER_UP)
+ g_string_append(str, ",LOWER_UP");
+
+ connman_info("%s {update} flags %u change %u <%s>",
+ ipconfig->interface, flags, change, str->str);
+
+ g_string_free(str, TRUE);
}
void __connman_ipconfig_add_address(struct connman_ipconfig *ipconfig,
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;
}
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;
}
}
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);