summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/kroute.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index b32b012bc5e..e5a78cc69b6 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.8 2008/05/09 12:55:48 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.9 2009/01/04 18:20:22 stsp Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -854,18 +854,32 @@ if_newaddr(u_short ifindex, struct sockaddr_in6 *ifa, struct sockaddr_in6 *mask,
ia->addr = ifa->sin6_addr;
if (mask)
- ia->prefixlen = 64; // XXX mask2prefixlen(&mask->sin6_addr);
+ ia->prefixlen = mask2prefixlen(mask);
else
ia->prefixlen = 0;
-#if 0 /* XXX fix me */
- if (brd)
- ka->dstbrd = brd->sin6_addr;
+ if (brd && brd->sin6_family == AF_INET6)
+ ia->dstbrd = brd->sin6_addr;
else
- bzero(&ka->dstbrd, sizeof(ka->dstbrd));
-#endif
+ bzero(&ia->dstbrd, sizeof(ia->dstbrd));
- log_debug("if_newaddr: ifindex %u, addr %s", ifindex,
- log_in6addr(&ia->addr));
+ switch (iface->type) {
+ case IF_TYPE_BROADCAST:
+ case IF_TYPE_NBMA:
+ log_debug("if_newaddr: ifindex %u, addr %s/%d",
+ ifindex, log_in6addr(&ia->addr), ia->prefixlen);
+ break;
+ case IF_TYPE_VIRTUALLINK: /* FIXME */
+ break;
+ case IF_TYPE_POINTOPOINT:
+ case IF_TYPE_POINTOMULTIPOINT:
+ log_debug("if_newaddr: ifindex %u, addr %s/%d, "
+ "dest %s", ifindex, log_in6addr(&ia->addr),
+ ia->prefixlen, log_in6addr(&ia->dstbrd));
+ break;
+ default:
+ fatalx("if_newaddr: unknown interface type");
+ }
+
TAILQ_INSERT_TAIL(&iface->ifa_list, ia, entry);
}