summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-02-09 01:46:35 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-02-09 01:46:35 +0000
commitb708a70d545a6c6391448094ddfe9f87e06ba30b (patch)
tree611efeae8bf76674ad13f3d396094d2d92519b3c /usr.sbin
parent39028756f5ae9140a658dbac42728878af7f9e0b (diff)
make max_prefix an u_int32_t instead of an u_long and change its
meaning as in 0 means no limit insytead of setting it to ULONG_MAX for no limit
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/parse.y3
-rw-r--r--usr.sbin/bgpd/printconf.c6
-rw-r--r--usr.sbin/bgpd/rde.c6
4 files changed, 9 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 43d02ed777f..6a0cdfc768c 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.92 2004/02/07 11:42:30 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.93 2004/02/09 01:46:34 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -131,7 +131,7 @@ struct peer_config {
char descr[PEER_DESCR_LEN];
struct bgpd_addr remote_addr;
struct bgpd_addr local_addr;
- u_long max_prefix;
+ u_int32_t max_prefix;
u_int16_t remote_as;
u_int8_t ebgp; /* 1 = ebgp, 0 = ibgp */
u_int8_t distance; /* 1 = direct, >1 = multihop */
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 5aa9e7438b5..0aee308574d 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.54 2004/02/09 00:00:41 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.55 2004/02/09 01:46:34 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1033,7 +1033,6 @@ alloc_peer(void)
p->next = NULL;
p->conf.distance = 1;
p->conf.announce_type = ANNOUNCE_UNDEF;
- p->conf.max_prefix = ULONG_MAX;
return (p);
}
diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c
index b7c31dc5b7a..5168cfbeb4e 100644
--- a/usr.sbin/bgpd/printconf.c
+++ b/usr.sbin/bgpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.2 2004/02/09 01:38:55 henning Exp $ */
+/* $OpenBSD: printconf.c,v 1.3 2004/02/09 01:46:34 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -101,8 +101,8 @@ print_peer(struct peer_config *p)
printf("%s\tpassive\n", c);
if (p->local_addr.af)
printf("%s\tlocal-address %s\n", c, log_addr(&p->local_addr));
- if (p->max_prefix != ULONG_MAX)
- printf("%s\tmax-prefix %lu\n", c, p->max_prefix);
+ if (p->max_prefix)
+ printf("%s\tmax-prefix %u\n", c, p->max_prefix);
if (p->holdtime)
printf("%s\tholdtime %u\n", c, p->holdtime);
if (p->min_holdtime)
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 48867e9daab..ec07a613c7c 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.74 2004/02/07 11:42:30 henning Exp $ */
+/* $OpenBSD: rde.c,v 1.75 2004/02/09 01:46:34 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -422,7 +422,8 @@ rde_update_dispatch(struct imsg *imsg)
p += pos;
nlri_len -= pos;
rde_update_log("update", peer, &attrs, &prefix, prefixlen);
- if (peer->prefix_cnt >= peer->conf.max_prefix) {
+ if (peer->conf.max_prefix &&
+ peer->prefix_cnt >= peer->conf.max_prefix) {
log_peer_warnx(&peer->conf, "prefix limit reached");
rde_update_err(peer, ERR_UPD_UNSPECIFIC);
break;
@@ -907,7 +908,6 @@ network_init(struct network_head *net_l)
bzero(&peerself, sizeof(peerself));
peerself.state = PEER_UP;
peerself.remote_bgpid = conf->bgpid;
- peerself.conf.max_prefix = ULONG_MAX;
peerself.conf.remote_as = conf->as;
snprintf(peerself.conf.descr, sizeof(peerself.conf.descr),
"LOCAL AS %hu", conf->as);