Since the interface name is known, send it to the RTNL callbacks.
Right now triggering of RTNL information on rtnl_trigger() is sending
the interface name as NULL since this information is not stored.
For the built-in code RTNL callbacks are registered during
initialization when no devices or networks have yet been created
so this will not be a problem.
---
include/rtnl.h | 4 ++--
src/device.c | 6 ++++--
src/rtnl.c | 6 +++---
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/rtnl.h b/include/rtnl.h
index aa70f4d8..e25b0f57 100644
--- a/include/rtnl.h
+++ b/include/rtnl.h
@@ -47,9 +47,9 @@ void connman_rtnl_remove_watch(unsigned int id);
struct connman_rtnl {
const char *name;
int priority;
- void (*newlink) (unsigned short type, int index,
+ void (*newlink) (unsigned short type, int index, const char *ifname,
unsigned flags, unsigned change);
- void (*dellink) (unsigned short type, int index,
+ void (*dellink) (unsigned short type, int index, const char *ifname,
unsigned flags, unsigned change);
void (*newgateway) (int index, const char *gateway);
void (*delgateway) (int index, const char *gateway);
diff --git a/src/device.c b/src/device.c
index ebed8481..aafe75a1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1410,7 +1410,8 @@ static void cleanup_devices(void)
}
static void device_rtnl_newlink(unsigned short type, int index,
- unsigned flags, unsigned change)
+ const char *interface, unsigned flags,
+ unsigned change)
{
struct connman_device *device;
enum connman_device_type devtype;
@@ -1445,7 +1446,8 @@ static void device_rtnl_newlink(unsigned short type, int index,
}
static void device_rtnl_dellink(unsigned short type, int index,
- unsigned flags, unsigned change)
+ const char *interface, unsigned flags,
+ unsigned change)
{
struct connman_device *device;
diff --git a/src/rtnl.c b/src/rtnl.c
index 0f8b218f..e34aa366 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -268,7 +268,7 @@ static void trigger_rtnl(int index, void *user_data)
unsigned short type = __connman_ipconfig_get_type_from_index(index);
unsigned int flags = __connman_ipconfig_get_flags_from_index(index);
- rtnl->newlink(type, index, flags, 0);
+ rtnl->newlink(type, index, NULL, flags, 0);
}
if (rtnl->newgateway) {
@@ -464,7 +464,7 @@ static void process_newlink(unsigned short type, int index, unsigned
flags,
struct connman_rtnl *rtnl = list->data;
if (rtnl->newlink)
- rtnl->newlink(type, index, flags, change);
+ rtnl->newlink(type, index, ifname, flags, change);
}
/*
@@ -509,7 +509,7 @@ static void process_dellink(unsigned short type, int index, unsigned
flags,
struct connman_rtnl *rtnl = list->data;
if (rtnl->dellink)
- rtnl->dellink(type, index, flags, change);
+ rtnl->dellink(type, index, ifname, flags, change);
}
switch (type) {
--
2.11.0