summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-09-04 11:50:29 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-09-04 11:50:29 +0000
commite7818438928ef9141170a051d718d21908020059 (patch)
tree32925be8626444fc386373c2b4b264b81dbe416a
parent00603db1c169affae230b22ff5aa4347dd6ae2df (diff)
Use the address familiy of the neighbor IP to decide which MP type to use.
IPv4 session will still default to only announce inet unicast but now IPv6 session will by default use announce inet6 unicast. The defaults can be overridden on groups and in the neighbor itself but this new behaviour is way more sane then the old one. OK henning, sthen
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y26
2 files changed, 25 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index b6a03723b26..193b1b98348 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.244 2009/08/31 13:03:31 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.245 2009/09/04 11:50:28 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -698,6 +698,7 @@ extern struct rib_names ribnames;
#define SAFI_NONE 0x00
#define SAFI_UNICAST 0x01
#define SAFI_MULTICAST 0x02
+#define SAFI_MPLS 0x04
#define SAFI_ALL 0xff
/* 4-byte magic AS number */
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 14afa6318a3..6bf3eba966b 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.234 2009/08/31 13:03:31 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.235 2009/09/04 11:50:28 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -717,6 +717,20 @@ neighbor : { curpeer = new_peer(); }
if (($3.prefix.af == AF_INET && $3.len != 32) ||
($3.prefix.af == AF_INET6 && $3.len != 128))
curpeer->conf.template = 1;
+ switch (curpeer->conf.remote_addr.af) {
+ case AF_INET:
+ if (curpeer->conf.capabilities.mp_v4 !=
+ SAFI_ALL)
+ break;
+ curpeer->conf.capabilities.mp_v4 = SAFI_UNICAST;
+ break;
+ case AF_INET6:
+ if (curpeer->conf.capabilities.mp_v6 !=
+ SAFI_ALL)
+ break;
+ curpeer->conf.capabilities.mp_v6 = SAFI_UNICAST;
+ break;
+ }
if (get_id(curpeer)) {
yyerror("get_id failed");
YYERROR;
@@ -2570,8 +2584,8 @@ alloc_peer(void)
p->conf.distance = 1;
p->conf.announce_type = ANNOUNCE_UNDEF;
p->conf.announce_capa = 1;
- p->conf.capabilities.mp_v4 = SAFI_UNICAST;
- p->conf.capabilities.mp_v6 = SAFI_NONE;
+ p->conf.capabilities.mp_v4 = SAFI_ALL;
+ p->conf.capabilities.mp_v6 = SAFI_ALL;
p->conf.capabilities.refresh = 1;
p->conf.capabilities.restart = 0;
p->conf.capabilities.as4byte = 0;
@@ -2915,6 +2929,12 @@ neighbor_consistent(struct peer *p)
return (-1);
}
+ /* the default MP capability is NONE */
+ if (p->conf.capabilities.mp_v4 == SAFI_ALL)
+ p->conf.capabilities.mp_v4 = SAFI_NONE;
+ if (p->conf.capabilities.mp_v6 == SAFI_ALL)
+ p->conf.capabilities.mp_v6 = SAFI_NONE;
+
return (0);
}