summaryrefslogtreecommitdiff
path: root/sysdep/bsd/krt-sock.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-02-26 12:52:00 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2014-02-26 12:52:00 +0100
commit3216eb03ddddc057bb18fa4dd02b7935a604f71f (patch)
treee41618a34f70579fe3ba7ec93a51526eb28caa6e /sysdep/bsd/krt-sock.c
parentd776540811cdf672dc113f29feef2415465589c6 (diff)
Fixes longstanding issue with interfaces staying in IF_TMP_DOWN.
Thanks to Pierluigi Rolando and others for the bugreport.
Diffstat (limited to 'sysdep/bsd/krt-sock.c')
-rw-r--r--sysdep/bsd/krt-sock.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 176e11ed..aaeb7d90 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -535,7 +535,7 @@ krt_read_ifannounce(struct ks_msg *msg)
}
static void
-krt_read_ifinfo(struct ks_msg *msg)
+krt_read_ifinfo(struct ks_msg *msg, int scan)
{
struct if_msghdr *ifm = (struct if_msghdr *)&msg->rtm;
void *body = (void *)(ifm + 1);
@@ -608,11 +608,14 @@ krt_read_ifinfo(struct ks_msg *msg)
else
f.flags |= IF_MULTIACCESS; /* NBMA */
- if_update(&f);
+ iface = if_update(&f);
+
+ if (!scan)
+ if_end_partial_update(iface);
}
static void
-krt_read_addr(struct ks_msg *msg)
+krt_read_addr(struct ks_msg *msg, int scan)
{
struct ifa_msghdr *ifam = (struct ifa_msghdr *)&msg->rtm;
void *body = (void *)(ifam + 1);
@@ -715,6 +718,9 @@ krt_read_addr(struct ks_msg *msg)
ifa_update(&ifa);
else
ifa_delete(&ifa);
+
+ if (!scan)
+ if_end_partial_update(iface);
}
static void
@@ -734,11 +740,11 @@ krt_read_msg(struct proto *p, struct ks_msg *msg, int scan)
krt_read_ifannounce(msg);
break;
case RTM_IFINFO:
- krt_read_ifinfo(msg);
+ krt_read_ifinfo(msg, scan);
break;
case RTM_NEWADDR:
case RTM_DELADDR:
- krt_read_addr(msg);
+ krt_read_addr(msg, scan);
break;
default:
break;