summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-06-24 14:01:54 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-06-24 14:01:54 +0000
commit52108e084e567f7c1f73598843297d6cd2b7c966 (patch)
tree21414f3724809a29e67111c72432fb4116a5f3c1 /usr.sbin/bgpd
parent118da2d99905916f3510262a50a1cd0887a7863e (diff)
Do not automaticaly announce routes that have RTF_DYNAMIC set. These routes
are e.g. created by the PMTU code and are removed after some time. OK henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.h5
-rw-r--r--usr.sbin/bgpd/kroute.c12
2 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index aafad0280b1..be53391827d 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.168 2005/06/13 21:16:18 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.169 2005/06/24 14:01:52 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -71,9 +71,10 @@
#define F_NEXTHOP 0x0008
#define F_DOWN 0x0010
#define F_STATIC 0x0020
-#define F_LONGER 0x0040
+#define F_DYNAMIC 0x0040
#define F_REJECT 0x0080
#define F_BLACKHOLE 0x0100
+#define F_LONGER 0x0200
enum {
PROC_MAIN,
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index d49c6024178..1b77775683b 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.138 2005/06/14 15:01:51 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.139 2005/06/24 14:01:53 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -617,6 +617,10 @@ kr_redistribute(int type, struct kroute *kr)
if (!(kr->flags & F_KERNEL))
return (0);
+ /* Dynamic routes are not redistributable. */
+ if (kr->flags & F_DYNAMIC)
+ return (0);
+
/*
* We consider the loopback net, multicast and experimental addresses
* as not redistributable.
@@ -1921,6 +1925,8 @@ fetchtable(void)
kr->r.flags |= F_BLACKHOLE;
if (rtm->rtm_flags & RTF_REJECT)
kr->r.flags |= F_REJECT;
+ if (rtm->rtm_flags & RTF_DYNAMIC)
+ kr->r.flags |= F_DYNAMIC;
if (sa_in != NULL) {
if (sa_in->sin_len == 0)
break;
@@ -1953,6 +1959,8 @@ fetchtable(void)
kr6->r.flags |= F_BLACKHOLE;
if (rtm->rtm_flags & RTF_REJECT)
kr6->r.flags |= F_REJECT;
+ if (rtm->rtm_flags & RTF_DYNAMIC)
+ kr6->r.flags |= F_DYNAMIC;
if (sa_in6 != NULL) {
if (sa_in6->sin6_len == 0)
break;
@@ -2154,6 +2162,8 @@ dispatch_rtmsg_addr(struct rt_msghdr *rtm, struct sockaddr *rti_info[RTAX_MAX])
flags |= F_BLACKHOLE;
if (rtm->rtm_flags & RTF_REJECT)
flags |= F_REJECT;
+ if (rtm->rtm_flags & RTF_DYNAMIC)
+ flags |= F_DYNAMIC;
prefix.af = sa->sa_family;
switch (prefix.af) {