summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2009-04-23 16:20:40 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2009-04-23 16:20:40 +0000
commita1922ecb3dacc7756b30e7bb77fb3d3dc96d6117 (patch)
tree77f9e92cca3b3b503455f1cf86ad956fd23c609b
parentab83a2a0add60b455db120505f68bf69b30cf267 (diff)
allow bgpctl and bgpd.conf to contain 32-bit ASN written in ASPLAIN
format (RFC5396). ok claudio@ henning@
-rw-r--r--usr.sbin/bgpctl/parser.c4
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/parse.y6
3 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index c60164cd926..a1ce55e2f2c 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.51 2008/08/31 08:29:35 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.52 2009/04/23 16:20:39 sthen Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -686,7 +686,7 @@ parse_asnum(const char *word, u_int32_t *asnum)
if (errstr)
errx(1, "AS number is %s: %s", errstr, word);
} else {
- uval = strtonum(word, 0, USHRT_MAX - 1, &errstr);
+ uval = strtonum(word, 0, ASNUM_MAX - 1, &errstr);
if (errstr)
errx(1, "AS number is %s: %s", errstr, word);
}
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 92186d896c9..07554af27d9 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.228 2009/03/26 13:59:30 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.229 2009/04/23 16:20:39 sthen Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -40,6 +40,8 @@
#define IPSEC_ENC_KEY_LEN 32
#define IPSEC_AUTH_KEY_LEN 20
+#define ASNUM_MAX 0xffffffff
+
#define MAX_PKTSIZE 4096
#define MIN_HOLDTIME 3
#define READ_BUF_SIZE 65535
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 08e909d321b..54851ca8269 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.223 2009/03/31 21:03:48 tobias Exp $ */
+/* $OpenBSD: parse.y,v 1.224 2009/04/23 16:20:39 sthen Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -207,8 +207,8 @@ grammar : /* empty */
;
asnumber : NUMBER {
- if ($1 < 0 || $1 >= USHRT_MAX) {
- yyerror("AS too big: max %u", USHRT_MAX - 1);
+ if ($1 < 0 || $1 >= ASNUM_MAX) {
+ yyerror("AS too big: max %u", ASNUM_MAX - 1);
YYERROR;
}
}