summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/kroute.c
diff options
context:
space:
mode:
authorremi <remi@cvs.openbsd.org>2018-06-25 22:16:54 +0000
committerremi <remi@cvs.openbsd.org>2018-06-25 22:16:54 +0000
commit24492ec98a9f26dc69907f48df6290a15b49b3a1 (patch)
treebe1737bf63c101b6857744fe87761174e58c5cd8 /usr.sbin/ospfd/kroute.c
parentd21eeed5ec85d416301e4b956bd04b626d29f2c6 (diff)
Add IMSG_IFADDRADD to ospfe and the master process.
This allows ospfd to recover automatically when an ip address gets removed and re-added as it happens when the netstart script is executed on a running system. previous attempt discussed with friehm@ last year input from sthen@ and jca@ OK jca@
Diffstat (limited to 'usr.sbin/ospfd/kroute.c')
-rw-r--r--usr.sbin/ospfd/kroute.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index dd078776b1b..233e4f9281b 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.109 2018/02/11 02:27:33 benno Exp $ */
+/* $OpenBSD: kroute.c,v 1.110 2018/06/25 22:16:53 remi Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -1072,8 +1072,9 @@ void
if_newaddr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
struct sockaddr_in *brd)
{
- struct kif_node *kif;
- struct kif_addr *ka;
+ struct kif_node *kif;
+ struct kif_addr *ka;
+ struct ifaddrchange ifn;
if (ifa == NULL || ifa->sin_family != AF_INET)
return;
@@ -1094,15 +1095,21 @@ if_newaddr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
ka->dstbrd.s_addr = INADDR_NONE;
TAILQ_INSERT_TAIL(&kif->addrs, ka, entry);
+
+ ifn.addr = ka->addr;
+ ifn.mask = ka->mask;
+ ifn.dst = ka->dstbrd;
+ ifn.ifindex = ifindex;
+ main_imsg_compose_ospfe(IMSG_IFADDRADD, 0, &ifn, sizeof(ifn));
}
void
if_deladdr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
struct sockaddr_in *brd)
{
- struct kif_node *kif;
- struct kif_addr *ka, *nka;
- struct ifaddrdel ifc;
+ struct kif_node *kif;
+ struct kif_addr *ka, *nka;
+ struct ifaddrchange ifc;
if (ifa == NULL || ifa->sin_family != AF_INET)
return;