From 4a323eb5ee18d181983a6d5081f961706e42cb76 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 16 May 2024 09:38:21 +0000 Subject: [PATCH] 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@ --- usr.sbin/bgpd/session.c | 11 +++-------- 1 file 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 @@ -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); } -- 2.20.1