summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-06-22 07:22:32 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-06-22 07:22:32 +0000
commit8141831959faa730cb2fa92905eec182a3173e99 (patch)
treeb06c1fbcb4e83341fb83d5f947af8106e3fcfd4b /usr.sbin/bgpd
parent1095a3e00c8783b74afed8a496c82d089f08a85d (diff)
introduce kroute6, which will be used to build a seperate v6 table
(smashing them into the v4 table would raise the memory requirements far too much), and make kroute_nexthop (where we are not under such memory pressure, you don't have a hundred thousand nexthops) v4/v6. change existing callers to use the v4 part, claudio ok
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.h15
-rw-r--r--usr.sbin/bgpd/kroute.c4
-rw-r--r--usr.sbin/bgpd/rde_rib.c6
3 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index f14f50af26a..2f8c42f4be6 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.128 2004/06/20 18:35:12 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.129 2004/06/22 07:22:31 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -355,12 +355,23 @@ struct kroute {
u_short ifindex;
};
+struct kroute6 {
+ struct in6_addr prefix;
+ u_int8_t prefixlen;
+ struct in6_addr nexthop;
+ u_int8_t flags;
+ u_short ifindex;
+};
+
struct kroute_nexthop {
struct bgpd_addr nexthop;
u_int8_t valid;
u_int8_t connected;
struct bgpd_addr gateway;
- struct kroute kr;
+ union {
+ struct kroute kr4;
+ struct kroute6 kr6;
+ } kr;
};
struct kif {
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index e15df88d657..d2440c8ee44 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.96 2004/06/20 19:16:53 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.97 2004/06/22 07:22:31 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -284,7 +284,7 @@ kr_nexthop_add(struct bgpd_addr *addr)
nh.gateway.v4.s_addr =
h->kroute->r.nexthop.s_addr;
}
- memcpy(&nh.kr, &h->kroute->r, sizeof(nh.kr));
+ memcpy(&nh.kr.kr4, &h->kroute->r, sizeof(nh.kr.kr4));
}
send_nexthop_update(&nh);
} else {
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index a069b2af72f..b1793e85ee9 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.46 2004/05/08 19:17:20 henning Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.47 2004/06/22 07:22:31 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -799,9 +799,9 @@ nexthop_update(struct kroute_nexthop *msg)
memcpy(&nh->true_nexthop, &msg->gateway,
sizeof(nh->true_nexthop));
- nh->nexthop_netlen = msg->kr.prefixlen;
+ nh->nexthop_netlen = msg->kr.kr4.prefixlen;
nh->nexthop_net.af = AF_INET;
- nh->nexthop_net.v4.s_addr = msg->kr.prefix.s_addr;
+ nh->nexthop_net.v4.s_addr = msg->kr.kr4.prefix.s_addr;
if (msg->connected)
nh->flags |= NEXTHOP_CONNECTED;