diff options
author | 2004-05-06 11:57:55 +0000 | |
---|---|---|
committer | 2004-05-06 11:57:55 +0000 | |
commit | fa1582b4f1f200eac6f13f1c02d8d66bfb0fabea (patch) | |
tree | dc5465a2f94902489a729e3b86216fb42c9605f7 | |
parent | whitespace; (diff) | |
download | wireguard-openbsd-fa1582b4f1f200eac6f13f1c02d8d66bfb0fabea.tar.xz wireguard-openbsd-fa1582b4f1f200eac6f13f1c02d8d66bfb0fabea.zip |
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
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 44ecdbd2b84..752d52bb461 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.119 2004/04/29 19:56:04 deraadt Exp $ */ +/* $OpenBSD: bgpd.h,v 1.120 2004/05/06 11:57:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -147,7 +147,8 @@ struct filter_set { }; enum auth_method { - AUTH_MD5SIG = 1, + AUTH_NONE, + AUTH_MD5SIG, AUTH_IPSEC_MANUAL_ESP, AUTH_IPSEC_MANUAL_AH, AUTH_IPSEC_IKE_ESP, 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); } |