diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-05-16 09:38:22 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-05-16 09:38:22 +0000 |
commit | c205fdc51a2e8e699314195c69a0bf1a9a61d9e1 (patch) | |
tree | a6787e960a6e9dbf02bc1c773001957d5cbce354 /usr.sbin/bgpd | |
parent | 73998de138fbb870acb29796b6e63f138689a094 (diff) |
Simplify the code to clamp the TCP send and recv buffer to 64k.
We don't really care if it works or not and we don't want to clamp it
down further then 64k. So just call setsockopt() once and ignore the error.
OK tb@ sthen@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/session.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index df990438254..6ab57978f1e 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.475 2024/05/15 09:09:38 job Exp $ */ +/* $OpenBSD: session.c,v 1.476 2024/05/16 09:38:21 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -1212,13 +1212,8 @@ session_setup_socket(struct peer *p) /* limit bufsize. no biggie if it fails */ bsize = 65535; - while (bsize > 8192 && setsockopt(p->fd, SOL_SOCKET, SO_RCVBUF, - &bsize, sizeof(bsize)) == -1 && errno != EINVAL) - bsize /= 2; - bsize = 65535; - while (bsize > 8192 && setsockopt(p->fd, SOL_SOCKET, SO_SNDBUF, - &bsize, sizeof(bsize)) == -1 && errno != EINVAL) - bsize /= 2; + setsockopt(p->fd, SOL_SOCKET, SO_RCVBUF, &bsize, sizeof(bsize)); + setsockopt(p->fd, SOL_SOCKET, SO_SNDBUF, &bsize, sizeof(bsize)); return (0); } |