commit 5cfc6e513d5f9743e6531be5513662f1cb6ab9ea
parent 467b6341d83df7368592fa774f42ac51708c1951
Author: Denis Kenzior <denkenz@gmail.com>
Date: Tue, 16 Apr 2019 14:23:43 -0500
netdev: Fix crash
src/netdev.c:netdev_create_from_genl() Skipping duplicate netdev wlp2s0[3]
Aborting (signal 11) [/home/denkenz/iwd/src/iwd]
++++++++ backtrace ++++++++
#0 0x7fc4c7a4e930 in /lib64/libc.so.6
#1 0x40ea13 in netdev_getlink_cb() at src/netdev.c:4654
#2 0x468cab in process_message() at ell/netlink.c:183
#3 0x4690a3 in can_read_data() at ell/netlink.c:289
#4 0x46681d in io_callback() at ell/io.c:126
#5 0x4651cd in l_main_iterate() at ell/main.c:473
#6 0x46530e in l_main_run() at ell/main.c:516
#7 0x465626 in l_main_run_with_signal() at ell/main.c:642
#8 0x403df8 in main() at src/main.c:513
#9 0x7fc4c7a39bde in /lib64/libc.so.6
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -4649,10 +4649,14 @@ static void netdev_getlink_cb(int error, uint16_t type, const void *data,
l_netlink_command_func_t cb;
bool powered;
- if (error != 0 || ifi->ifi_type != ARPHRD_ETHER ||
- type != RTM_NEWLINK) {
- l_error("RTM_GETLINK error %i ifi_type %i type %i",
- error, (int) ifi->ifi_type, (int) type);
+ if (error != 0) {
+ l_error("RTM_GETLINK error %i: %s", error, strerror(-error));
+ return;
+ }
+
+ if (ifi->ifi_type != ARPHRD_ETHER || type != RTM_NEWLINK) {
+ l_debug("Non-ethernet address or not newlink message -- "
+ "ifi_type: %i, type: %i", ifi->ifi_type, type);
return;
}