summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c4
-rw-r--r--sysdep/linux/netlink/netlink.c14
-rw-r--r--sysdep/unix/krt-iface.c4
3 files changed, 17 insertions, 5 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 9ae658d..53b30ca 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -456,7 +456,9 @@ krt_read_ifinfo(struct ks_msg *msg)
f.flags = 0;
if (fl & IFF_UP)
- f.flags |= IF_LINK_UP;
+ f.flags |= IF_ADMIN_UP;
+ if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN)
+ f.flags |= IF_LINK_UP; /* up or unknown */
if (fl & IFF_LOOPBACK) /* Loopback */
f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE;
else if (fl & IFF_POINTOPOINT) /* PtP */
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index 2dd0359..79f7210 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <fcntl.h>
-#include <net/if.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
@@ -27,6 +26,7 @@
#include "conf/conf.h"
#include <asm/types.h>
+#include <linux/if.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
@@ -34,6 +34,10 @@
#define MSG_TRUNC 0x20
#endif
+#ifndef IFF_LOWER_UP
+#define IFF_LOWER_UP 0x10000
+#endif
+
/*
* Synchronous Netlink interface
*/
@@ -281,6 +285,8 @@ nl_parse_link(struct nlmsghdr *h, int scan)
u32 mtu;
unsigned int fl;
+ debug("nl_parse_link %d\n", new);
+
if (!(i = nl_checkin(h, sizeof(*i))) || !nl_parse_attrs(IFLA_RTA(i), a, sizeof(a)))
return;
if (!a[IFLA_IFNAME] || RTA_PAYLOAD(a[IFLA_IFNAME]) < 2 ||
@@ -293,6 +299,8 @@ nl_parse_link(struct nlmsghdr *h, int scan)
name = RTA_DATA(a[IFLA_IFNAME]);
memcpy(&mtu, RTA_DATA(a[IFLA_MTU]), sizeof(u32));
+ debug("nl_parse_link name %s index %d flags %x\n", name, i->ifi_index, i->ifi_flags);
+
ifi = if_find_by_index(i->ifi_index);
if (!new)
{
@@ -300,7 +308,7 @@ nl_parse_link(struct nlmsghdr *h, int scan)
if (ifi && !scan)
{
memcpy(&f, ifi, sizeof(struct iface));
- f.flags |= IF_ADMIN_DOWN;
+ f.flags |= IF_SHUTDOWN;
if_update(&f);
}
}
@@ -319,6 +327,8 @@ nl_parse_link(struct nlmsghdr *h, int scan)
f.flags = 0;
fl = i->ifi_flags;
if (fl & IFF_UP)
+ f.flags |= IF_ADMIN_UP;
+ if (fl & IFF_LOWER_UP)
f.flags |= IF_LINK_UP;
if (fl & IFF_LOOPBACK) /* Loopback */
f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE;
diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c
index 5fda0d1..c305d27 100644
--- a/sysdep/unix/krt-iface.c
+++ b/sysdep/unix/krt-iface.c
@@ -78,12 +78,12 @@ scan_ifs(struct ifreq *r, int cnt)
faulty:
log(L_ERR "%s(%s): %m", err, i.name);
bad:
- i.flags = (i.flags & ~IF_LINK_UP) | IF_ADMIN_DOWN;
+ i.flags = (i.flags & ~IF_ADMIN_UP) | IF_SHUTDOWN;
continue;
}
fl = r->ifr_flags;
if (fl & IFF_UP)
- i.flags |= IF_LINK_UP;
+ i.flags |= IF_ADMIN_UP;
if (ioctl(if_scan_sock, SIOCGIFNETMASK, r) < 0)
{ err = "SIOCGIFNETMASK"; goto faulty; }