From: claudio Date: Thu, 16 May 2024 09:38:21 +0000 (+0000) Subject: Simplify the code to clamp the TCP send and recv buffer to 64k. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4a323eb5ee18d181983a6d5081f961706e42cb76;p=openbsd 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@ --- 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 @@ -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); }