summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/config.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-10-01 15:11:13 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-10-01 15:11:13 +0000
commitc03122d92232d585e67d7a0b23e09bd4fd8d17de (patch)
tree29dd9a7cab49c8f2507a74db5bd9622cb0db7538 /usr.sbin/bgpd/config.c
parent30383e9a19c23204c67e5968f5a5e9eec6d23679 (diff)
if we're opening a socket for a default listener because no "listen on"
stetements were found in the config file, and one fails with EPROTONOSUPPORT (this is the case for the default ::1 listener on machines without INET6), remove that listener and move on instead of bailing out. ok claudio
Diffstat (limited to 'usr.sbin/bgpd/config.c')
-rw-r--r--usr.sbin/bgpd/config.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index b5f67b8e951..fe52c4a4df4 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.39 2004/06/20 17:49:46 henning Exp $ */
+/* $OpenBSD: config.c,v 1.40 2004/10/01 15:11:12 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -228,7 +228,7 @@ host_v6(const char *s, struct bgpd_addr *h)
void
prepare_listeners(struct bgpd_config *conf)
{
- struct listen_addr *la;
+ struct listen_addr *la, *next;
int opt = 1;
if (TAILQ_EMPTY(conf->listen_addrs)) {
@@ -253,10 +253,18 @@ prepare_listeners(struct bgpd_config *conf)
TAILQ_INSERT_TAIL(conf->listen_addrs, la, entry);
}
- TAILQ_FOREACH(la, conf->listen_addrs, entry) {
+ for (la = TAILQ_FIRST(conf->listen_addrs); la != NULL; la = next) {
+ next = TAILQ_NEXT(la, entry);
if ((la->fd = socket(la->sa.ss_family, SOCK_STREAM,
- IPPROTO_TCP)) == -1)
- fatal("socket");
+ IPPROTO_TCP)) == -1) {
+ if (la->flags & DEFAULT_LISTENER && (errno ==
+ EAFNOSUPPORT || errno == EPROTONOSUPPORT)) {
+ TAILQ_REMOVE(conf->listen_addrs, la, entry);
+ free(la);
+ continue;
+ } else
+ fatal("socket");
+ }
opt = 1;
if (setsockopt(la->fd, SOL_SOCKET, SO_REUSEPORT,