make interface update libnl1 compatible

With libnl1 its not possible to get from the message the same notice of
the interface being added or removed as with libnl3. This code has to be
reserved for libnl3 only. Make compilation of this code conditionsal.

Bug: 15981
Change-Id: I2588fd2ba6508a8544bdd4eac46436b4f78ee524
Reviewed-on: https://code.wireshark.org/review/34242
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jaap Keuter 2019-08-07 19:31:41 +02:00 committed by Anders Broman
parent 7bd3edccf1
commit 486efaedb1
1 changed files with 7 additions and 1 deletions

View File

@ -82,7 +82,6 @@ iface_mon_handler2(struct nl_object *obj, void *arg)
return;
}
int msg_type = nl_object_get_msgtype(obj);
link_obj = (struct rtnl_link *) obj;
flags = rtnl_link_get_flags (link_obj);
ifname = rtnl_link_get_name(link_obj);
@ -100,6 +99,11 @@ iface_mon_handler2(struct nl_object *obj, void *arg)
*/
up = (flags & IFF_UP) ? 1 : 0;
#ifdef HAVE_LIBNL1
cb(ifname, 0, up);
#else
int msg_type = nl_object_get_msgtype(obj);
switch (msg_type) {
case RTM_NEWLINK:
cb(ifname, 1, up);
@ -111,6 +115,8 @@ iface_mon_handler2(struct nl_object *obj, void *arg)
/* Ignore other events */
break;
}
#endif
rtnl_link_put(filter);
return;