diff options
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r-- | usr.sbin/bgpd/session.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 4beadcaa934..ab72afdfa3c 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.163 2004/05/06 09:11:18 henning Exp $ */ +/* $OpenBSD: session.c,v 1.164 2004/05/06 11:57:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -892,6 +892,7 @@ session_setup_socket(struct peer *p) int ttl = p->conf.distance; int pre = IPTOS_PREC_INTERNETCONTROL; int nodelay = 1; + int bsize; if (p->conf.ebgp && p->sa_remote.ss_family == AF_INET) /* set TTL to foreign router's distance - 1=direct n=multihop */ @@ -927,6 +928,19 @@ session_setup_socket(struct peer *p) return (-1); } + /* only increase bufsize (and thus window) if md5 or ipsec is in use */ + if (p->conf.auth.method != AUTH_NONE) { + /* try to increase bufsize. no biggie if it fails */ + bsize = 65535; + while (setsockopt(p->fd, SOL_SOCKET, SO_RCVBUF, &bsize, + sizeof(bsize)) == -1) + bsize /= 2; + bsize = 65535; + while (setsockopt(p->fd, SOL_SOCKET, SO_SNDBUF, &bsize, + sizeof(bsize)) == -1) + bsize /= 2; + } + return (0); } |