summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-15 13:58:22 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-07-15 13:58:22 -0700
commitbf8348ea70903ba154a45a5fab78051ccbf50a37 (patch)
treeba0949bc7d1aa8d79a58abb809a1daecdff51361
parent4aa99fc5eed24b64e05d5a49cc39d4ffab9b2c83 (diff)
downloadconnman-bf8348ea70903ba154a45a5fab78051ccbf50a37.tar.gz
connman-bf8348ea70903ba154a45a5fab78051ccbf50a37.tar.bz2
connman-bf8348ea70903ba154a45a5fab78051ccbf50a37.zip
Provide unique identifier along with the interface callbacks
-rw-r--r--include/technology.h3
-rw-r--r--src/connman.h4
-rw-r--r--src/rtnl.c17
-rw-r--r--src/technology.c6
4 files changed, 21 insertions, 9 deletions
diff --git a/include/technology.h b/include/technology.h
index 256a2eb5..e45474df 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -43,7 +43,8 @@ struct connman_technology_driver {
int (*probe) (struct connman_technology *technology);
void (*remove) (struct connman_technology *technology);
void (*add_interface) (struct connman_technology *technology,
- int index, const char *name);
+ int index, const char *name,
+ const char *ident);
void (*remove_interface) (struct connman_technology *technology,
int index);
int (*set_tethering) (struct connman_technology *technology,
diff --git a/src/connman.h b/src/connman.h
index 5f231721..d2696d90 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -302,9 +302,9 @@ int __connman_technology_update_rfkill(unsigned int index,
int __connman_technology_remove_rfkill(unsigned int index);
void __connman_technology_add_interface(enum connman_service_type type,
- int index, const char *name);
+ int index, const char *name, const char *ident);
void __connman_technology_remove_interface(enum connman_service_type type,
- int index, const char *name);
+ int index, const char *name, const char *ident);
int __connman_technology_enable_tethering(void);
int __connman_technology_disable_tethering(void);
diff --git a/src/rtnl.c b/src/rtnl.c
index 1f5c6c30..7e8d3b6c 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -59,6 +59,7 @@ static guint update_timeout = 0;
struct interface_data {
int index;
char *name;
+ char *ident;
enum connman_service_type type;
};
@@ -69,8 +70,9 @@ static void free_interface(gpointer data)
struct interface_data *interface = data;
__connman_technology_remove_interface(interface->type,
- interface->index, interface->name);
+ interface->index, interface->name, interface->ident);
+ g_free(interface->ident);
g_free(interface->name);
g_free(interface);
}
@@ -371,12 +373,20 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
unsigned char operstate = 0xff;
const char *ifname = NULL;
unsigned int mtu = 0;
- char str[18];
+ char ident[13], str[18];
GSList *list;
memset(&stats, 0, sizeof(stats));
extract_link(msg, bytes, &address, &ifname, &mtu, &operstate, &stats);
+ snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
+ address.ether_addr_octet[0],
+ address.ether_addr_octet[1],
+ address.ether_addr_octet[2],
+ address.ether_addr_octet[3],
+ address.ether_addr_octet[4],
+ address.ether_addr_octet[5]);
+
snprintf(str, 18, "%02X:%02X:%02X:%02X:%02X:%02X",
address.ether_addr_octet[0],
address.ether_addr_octet[1],
@@ -410,6 +420,7 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
interface = g_new0(struct interface_data, 1);
interface->index = index;
interface->name = g_strdup(ifname);
+ interface->ident = g_strdup(ident);
g_hash_table_insert(interface_list,
GINT_TO_POINTER(index), interface);
@@ -418,7 +429,7 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
read_uevent(interface);
__connman_technology_add_interface(interface->type,
- interface->index, interface->name);
+ interface->index, interface->name, interface->ident);
}
for (list = rtnl_list; list; list = list->next) {
diff --git a/src/technology.c b/src/technology.c
index 34c50be6..8d1be5c0 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -101,7 +101,7 @@ void connman_technology_driver_unregister(struct connman_technology_driver *driv
}
void __connman_technology_add_interface(enum connman_service_type type,
- int index, const char *name)
+ int index, const char *name, const char *ident)
{
GSList *list;
@@ -133,12 +133,12 @@ void __connman_technology_add_interface(enum connman_service_type type,
if (technology->driver->add_interface)
technology->driver->add_interface(technology,
- index, name);
+ index, name, ident);
}
}
void __connman_technology_remove_interface(enum connman_service_type type,
- int index, const char *name)
+ int index, const char *name, const char *ident)
{
GSList *list;