summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2005-09-15 19:42:51 +0000
committerclaudio <claudio@openbsd.org>2005-09-15 19:42:51 +0000
commit18cd8ae7b2fa8adf4059aba38915dcea0dd2200e (patch)
treea914bd74f1a6b19650b0baa4c4db96a1ef26a464
parentget rid of MD m68k_trunc_page and m68k_round_page and replace by MI (diff)
downloadwireguard-openbsd-18cd8ae7b2fa8adf4059aba38915dcea0dd2200e.tar.xz
wireguard-openbsd-18cd8ae7b2fa8adf4059aba38915dcea0dd2200e.zip
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@
-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;