summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2004-04-28 02:57:27 +0000
committerclaudio <claudio@openbsd.org>2004-04-28 02:57:27 +0000
commit6921ca90c725bb98c146f60a7dfff49d9e0f242c (patch)
tree5e51b7ffefb147f90179da8aea5f7901caa54e9f
parentkeep track of which ipsec/md5 SAs we inserted - ESRCH on blind removal (diff)
downloadwireguard-openbsd-6921ca90c725bb98c146f60a7dfff49d9e0f242c.tar.xz
wireguard-openbsd-6921ca90c725bb98c146f60a7dfff49d9e0f242c.zip
Enable route refresh in the RDE. Now peer can request route refreshes.
OK henning@
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/rde.c27
2 files changed, 28 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 05e4c423422..3434f775df6 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.116 2004/04/28 01:08:38 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.117 2004/04/28 02:57:27 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -475,11 +475,13 @@ struct rrefresh {
/* Address Family Numbers as per rfc1700 */
#define AFI_IPv4 1
#define AFI_IPv6 2
+#define AFI_ALL 0xffff
/* Subsequent Address Family Identifier as per rfc2858 */
#define SAFI_UNICAST 1
#define SAFI_MULTICAST 2
#define SAFI_BOTH 3
+#define SAFI_ALL 0xff
/* prototypes */
/* bgpd.c */
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index d43677f2cce..2c8d7d94fce 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.105 2004/04/27 04:38:12 deraadt Exp $ */
+/* $OpenBSD: rde.c,v 1.106 2004/04/28 02:57:27 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -63,6 +63,7 @@ void peer_remove(struct rde_peer *);
struct rde_peer *peer_get(u_int32_t);
void peer_up(u_int32_t, struct session_up *);
void peer_down(u_int32_t);
+void peer_dump(u_int32_t, u_int16_t, u_int8_t);
void network_init(struct network_head *);
void network_add(struct network_config *);
@@ -213,6 +214,7 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
{
struct imsg imsg;
struct session_up sup;
+ struct rrefresh r;
pid_t pid;
int n;
@@ -240,6 +242,14 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
case IMSG_SESSION_DOWN:
peer_down(imsg.hdr.peerid);
break;
+ case IMSG_REFRESH:
+ if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(r)) {
+ log_warnx("rde_dispatch: wrong imsg len");
+ break;
+ }
+ memcpy(&r, imsg.data, sizeof(r));
+ peer_dump(imsg.hdr.peerid, r.afi, r.safi);
+ break;
case IMSG_CTL_SHOW_RIB:
if (imsg.hdr.len != IMSG_HEADER_SIZE) {
log_warnx("rde_dispatch: wrong imsg len");
@@ -1015,7 +1025,7 @@ peer_up(u_int32_t id, struct session_up *sup)
*/
return;
- pt_dump(up_dump_upcall, peer);
+ peer_dump(id, AFI_ALL, SAFI_ALL);
}
void
@@ -1043,6 +1053,19 @@ peer_down(u_int32_t id)
peer_remove(peer);
}
+void
+peer_dump(u_int32_t id, u_int16_t afi, u_int8_t safi)
+{
+ if (afi == AFI_ALL | afi == AFI_IPv4)
+ if (safi == SAFI_ALL || safi == SAFI_UNICAST ||
+ safi == SAFI_BOTH) {
+ pt_dump(up_dump_upcall, peer);
+ return;
+ }
+
+ log_peer_warnx(&peer->conf, "unsupported AFI, SAFI combination");
+}
+
/*
* network announcement stuff
*/