[Olsr-dev] [PATCH v1 3/9] linux: netlink_process_link: always determine the interface name
Ferry Huberts
(spam-protected)
Wed Feb 10 14:35:42 CET 2016
From: Ferry Huberts <(spam-protected)>
This simplifies it a bit more.
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/linux/kernel_routes_nl.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/linux/kernel_routes_nl.c b/src/linux/kernel_routes_nl.c
index 9687b3c..3f363c7 100644
--- a/src/linux/kernel_routes_nl.c
+++ b/src/linux/kernel_routes_nl.c
@@ -117,16 +117,21 @@ static void netlink_process_link(struct nlmsghdr *h)
struct interface_olsr *iface;
struct olsr_if *oif;
char namebuffer[IF_NAMESIZE];
+ char * ifaceName = NULL;
iface = if_ifwithindex(ifi->ifi_index);
oif = NULL;
+ if (!iface) {
+ ifaceName = if_indextoname(ifi->ifi_index, namebuffer);
+ } else {
+ ifaceName = iface->int_name;
+ }
+
if (!iface && ((ifi->ifi_flags & IFF_UP) == IFF_UP)) {
- if (if_indextoname(ifi->ifi_index, namebuffer)) {
- if ((oif = olsrif_ifwithname(namebuffer)) != NULL) {
- /* try to take interface up, will trigger ifchange */
- chk_if_up(oif, 3);
- }
+ if (ifaceName && ((oif = olsrif_ifwithname(ifaceName)) != NULL)) {
+ /* try to take interface up, will trigger ifchange */
+ chk_if_up(oif, 3);
}
}
else if (iface && ((ifi->ifi_flags & IFF_UP) == 0)) {
--
2.5.0
More information about the Olsr-dev
mailing list