diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-05-06 11:57:56 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-05-06 11:57:56 +0000 |
commit | 6981d22ef17834ea5cb76e07bcba507aef4139a2 (patch) | |
tree | a25f676478ea2243f1ca06569e057eda6783e810 /usr.sbin/bgpd/session.c | |
parent | bcdea76e1ec77b44db925f3d87c094e457007042 (diff) |
scale socket buffer sizes (and thus window size) up to up to 64k,
but only of tcp md5sig or ipsec is in use. excellent idea by ryan some time
ago, claudio and theo agree
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); } |