From nobody Mon Nov 29 12:51:03 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A3D7618CA922 for ; Mon, 29 Nov 2021 12:51:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J2lZv44pnz4fTs for ; Mon, 29 Nov 2021 12:51:03 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62AEC225D0 for ; Mon, 29 Nov 2021 12:51:03 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1ATCp3UQ081069 for ; Mon, 29 Nov 2021 12:51:03 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1ATCp37d081068 for bugs@FreeBSD.org; Mon, 29 Nov 2021 12:51:03 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260114] [sctp] SO_SNDLOWAT is not accounted for when sending data Date: Mon, 29 Nov 2021 12:51:03 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: albin.hellqvist@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638190263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OWM9FWDOyDq5h1fM5N/yArOqCZmrwzThfwGKGbmzzL0=; b=tKjmPnMaZwnPJbwlvqySvx1Gy40Oh1uvNnhb2AoPRYQFOm+fzXu86/cV+g1dqQH+Q0unBh giMQljcHJfQVBhYVsBpDiWTZP696E5xiCjxeRyjOra7TstBk1l1vpenqkl1h6+vBrZpyCr j8kbpGaIHrlRTOyeeLLUn0kZgfJJs9e8Xnh9V46PzuWh3QJqDZztB6mQZ4wsaJjwvO8VG2 DLFh6Q7YWeJU9H+hfcC5JertufQT95skFjXN14+SxdGJIbvTCG9qTun3dXqQitziqXbgBQ PuHF/vr89ipypm/oHknvbLF5okwvfh86pFOu4NeADDAIgaz2m/aqDlEnIFLbQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638190263; a=rsa-sha256; cv=none; b=Czjif6KHOKvkxDj3KQ15CSHnGZuyaFKAGof211XVW5ml6OLDP0PkZ3tBJ2lKZ6n5b6OfpJ iQo3VWxMiFArspSII38aHy6gnK14drURE0oHbwI0kS1aiABucAfy+BJg0WWJjPyvpf0baE 5SvaOz2tVN+1HdvzATfRFHR5saRVG025S3ByvzjOD8P2MO2jVzHW1wp5b5x1mSkTLvWZVe iJ69hei294C6PZQi83t+74CtMhVYjjBtZfF+9FfZYsAqQyeDCSnSwOXq7lT8VsY8Df12Xl qF62XhlmJf1K+lgyQiFguCBRiJoFanLSRQB0WKQvajHOaCZuIUf/ToZcpt1hJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260114 Bug ID: 260114 Summary: [sctp] SO_SNDLOWAT is not accounted for when sending data Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: albin.hellqvist@gmail.com When sending data over SCTP and using e.g., sctp_sendv(), SO_SNDLOWAT is not accounted for. For example, let's say that I have a socket send buffer of 32768 bytes and I have set SO_SNDLOWAT to 10000 bytes. If the send buffer is filled up to say 25000 bytes, then I shouldn't be able to send anything until there are SO_SNDLOWAT (1000) amount of bytes (+ 1?) bytes free in the socket send buf= fer. From (https://www.freebsd.org/cgi/man.cgi?query=3Dsetsockopt&sektion=3D2): SO_SNDLOWAT is an option to set the minimum count for output operations. Mo= st output operations process all of the data supplied by the call, delivering = data to the protocol for transmission and blocking as necessary for flow control= .=20=20=20 Nonblocking output operations will process as much data as permitted subj= ect to flow control without blocking, but will process no data if flow control = does not allow the smaller of the low water mark value or the entire request to = be processed. This has been tested on FreeBSD 12.2-RELEASE and FreeBSD 13.0-RELEASE as we= ll as on Linux (lksctp). The FreeBSD releases have the same behavior while it works in Linux. I have only tested this for non-blocking sockets so I don't know the behavi= or of blocking sockets. I guess it should block until the same criterion has happened. At least for non-blocking sockets, I believe that this can be fixed by addi= ng a line in the sctp_lower_sosend() function in (sys/netinet/sctp_output.c). More specifically, these lines can be changed: if ((SCTP_SB_LIMIT_SND(so) < (amount + inqueue_bytes + stcb->asoc.sb_send_resv)) || (stcb->asoc.chunks_on_out_queue >=3D SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { To include this (or something similar): || (so->so_snd.sb_hiwat - so->so_snd.sb_acc) <=3D (u_int)so->so_snd.sb_lowa= t) Sorry for not uploading a patch, but I am unsure if my fix is of use or not. --=20 You are receiving this mail because: You are the assignee for the bug.=