summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-10-16 09:33:04 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-10-16 09:33:04 +0000
commit19b5a93c830ea89844cac4214dd093f77c929008 (patch)
treed0ad04c7f540a4b7f05a521ba000e032477566de
parent9c64f03447e536c8941a8db7e250a2ea47a1a244 (diff)
prefixlen 0 is a special case for prefixlen2mask() as well, claudio ok
-rw-r--r--usr.sbin/bgpd/kroute.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 7fe17b7db7b..05f845fc609 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.107 2004/08/19 10:38:34 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.108 2004/10/16 09:33:03 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -400,6 +400,19 @@ kr_show_route(struct imsg *imsg)
send_imsg_session(IMSG_CTL_END, imsg->hdr.pid, NULL, 0);
}
+void
+kr_ifinfo(char *ifname)
+{
+ struct kif_node *kif;
+
+ RB_FOREACH(kif, kif_tree, &kit)
+ if (!strcmp(ifname, kif->k.ifname)) {
+ send_imsg_session(IMSG_IFINFO, 0,
+ &kif->k, sizeof(kif->k));
+ return;
+ }
+}
+
/*
* RB-tree compare functions
*/
@@ -875,6 +888,9 @@ mask2prefixlen6(struct in6_addr *in6a)
in_addr_t
prefixlen2mask(u_int8_t prefixlen)
{
+ if (prefixlen == 0)
+ return (0);
+
return (0xffffffff << (32 - prefixlen));
}
@@ -949,6 +965,8 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.media_type = ifd->ifi_type;
kif->k.baudrate = ifd->ifi_baudrate;
+ send_imsg_session(IMSG_IFINFO, 0, &kif->k, sizeof(kif->k));
+
if ((reachable = (flags & IFF_UP) &&
(ifd->ifi_link_state != LINK_STATE_DOWN)) == kif->k.nh_reachable)
return; /* nothing changed wrt nexthop validity */