summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-07-07 17:06:52 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-07-07 17:06:52 +0000
commitea216f90f426a5ff8058ae9b1145dcd0aa8f1896 (patch)
tree49827334f08d654cc0a4b1471dc10ace36cb3a23 /usr.sbin/ospf6d
parent1b920c977c5815ac4a209c285ef4e80322c411bf (diff)
Only send interface address changes to the ospfe/rde if the interface
is actually used by the config. This should fix the exits caused when interfaces are dynamically added to the kernel.
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r--usr.sbin/ospf6d/kroute.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index 4462c9ba09a..18522e208eb 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.33 2011/07/07 03:56:59 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.34 2011/07/07 17:06:51 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -899,12 +899,15 @@ if_newaddr(u_short ifindex, struct sockaddr_in6 *ifa, struct sockaddr_in6 *mask,
}
TAILQ_INSERT_TAIL(&iface->ifa_list, ia, entry);
- ifc.addr = ia->addr;
- ifc.dstbrd = ia->dstbrd;
- ifc.prefixlen = ia->prefixlen;
- ifc.ifindex = ifindex;
- main_imsg_compose_ospfe(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc));
- main_imsg_compose_rde(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc));
+ /* inform engine and rde if interface is used */
+ if (iface->cflags & F_IFACE_CONFIGURED) {
+ ifc.addr = ia->addr;
+ ifc.dstbrd = ia->dstbrd;
+ ifc.prefixlen = ia->prefixlen;
+ ifc.ifindex = ifindex;
+ main_imsg_compose_ospfe(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc));
+ main_imsg_compose_rde(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc));
+ }
}
void
@@ -944,14 +947,17 @@ if_deladdr(u_short ifindex, struct sockaddr_in6 *ifa, struct sockaddr_in6 *mask,
log_debug("if_deladdr: ifindex %u, addr %s/%d",
ifindex, log_in6addr(&ia->addr), ia->prefixlen);
TAILQ_REMOVE(&iface->ifa_list, ia, entry);
- ifc.addr = ia->addr;
- ifc.dstbrd = ia->dstbrd;
- ifc.prefixlen = ia->prefixlen;
- ifc.ifindex = ifindex;
- main_imsg_compose_ospfe(IMSG_IFADDRDEL, 0, &ifc,
- sizeof(ifc));
- main_imsg_compose_rde(IMSG_IFADDRDEL, 0, &ifc,
- sizeof(ifc));
+ /* inform engine and rde if interface is used */
+ if (iface->cflags & F_IFACE_CONFIGURED) {
+ ifc.addr = ia->addr;
+ ifc.dstbrd = ia->dstbrd;
+ ifc.prefixlen = ia->prefixlen;
+ ifc.ifindex = ifindex;
+ main_imsg_compose_ospfe(IMSG_IFADDRDEL, 0, &ifc,
+ sizeof(ifc));
+ main_imsg_compose_rde(IMSG_IFADDRDEL, 0, &ifc,
+ sizeof(ifc));
+ }
free(ia);
return;
}