summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-09-15 19:42:52 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-09-15 19:42:52 +0000
commit64393cf110217509a46347626cda13bdde46cf22 (patch)
treeca253c3d5a6907058102e025a7c8844e70629494 /usr.sbin/ospfd
parent506380a7d9fb61033b545861eb521a2dc9d6bf60 (diff)
Correctly handle loopback interfaces. Mark them as point-to-point networks
that are in loopback mode. With this it is possible to use lo1 to hold the loopback address of the router as done often on ciscos etc. Problem found and fix tested by jakob@ OK norby@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/interface.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 78667607590..3c783df5c8f 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.31 2005/08/30 21:07:58 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.32 2005/09/15 19:42:51 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -189,11 +189,15 @@ if_new(struct kif *kif)
err(1, "if_new: socket");
/* get type */
- if ((kif->flags & IFF_POINTOPOINT))
+ if (kif->flags & IFF_POINTOPOINT)
iface->type = IF_TYPE_POINTOPOINT;
- if ((kif->flags & IFF_BROADCAST) &&
- (kif->flags & IFF_MULTICAST))
+ if (kif->flags & IFF_BROADCAST &&
+ kif->flags & IFF_MULTICAST)
iface->type = IF_TYPE_BROADCAST;
+ if (kif->flags & IFF_LOOPBACK) {
+ iface->type = IF_TYPE_POINTOPOINT;
+ iface->state = IF_STA_LOOPBACK;
+ }
/* get mtu, index and flags */
iface->mtu = kif->mtu;
@@ -214,7 +218,7 @@ if_new(struct kif *kif)
iface->mask = sain->sin_addr;
/* get p2p dst address */
- if (iface->type == IF_TYPE_POINTOPOINT) {
+ if (kif->flags & IFF_POINTOPOINT) {
if (ioctl(s, SIOCGIFDSTADDR, (caddr_t)ifr) < 0)
err(1, "if_new: cannot get dst addr");
sain = (struct sockaddr_in *) &ifr->ifr_addr;