From owner-freebsd-net@freebsd.org Fri Jul 10 11:10:58 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAF9D366B71 for ; Fri, 10 Jul 2020 11:10:58 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B39MQ25tnz4TNP; Fri, 10 Jul 2020 11:10:57 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mb.fritz.box (ip4d15f5fc.dynamic.kabel-deutschland.de [77.21.245.252]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id E36B2721BE00B; Fri, 10 Jul 2020 13:10:44 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: making SCTP loadable and removing it from GENERIC From: Michael Tuexen In-Reply-To: <081C36F7-190F-489E-9100-E5B78A911710@mail.sermon-archive.info> Date: Fri, 10 Jul 2020 13:10:41 +0200 Cc: Eugene Grosbein , Mark Johnston , freebsd-net@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <011CF79D-2696-49DA-91AF-47D4823FDE04@freebsd.org> References: <20200709151300.GC8947@raichu> <63F4446F-DECF-4DE8-99CA-EC8755A5D4A1@mail.sermon-archive.info> <44d21cf7-e154-f7f4-12ee-6dce1c3f9a63@grosbein.net> <4B6A707F-88C4-43B8-96BF-24BC32E2C9A9@freebsd.org> <081C36F7-190F-489E-9100-E5B78A911710@mail.sermon-archive.info> To: Doug Hardie X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4B39MQ25tnz4TNP X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:680, ipnet:2001:638::/32, country:DE]; local_wl_from(0.00)[freebsd.org] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 11:10:58 -0000 > On 10. Jul 2020, at 12:29, Doug Hardie wrote: >=20 >> On 10 July 2020, at 02:39, Michael Tuexen wrote: >>=20 >> Hi Eugene, >>=20 >> you are completely right. However, it requires that the program needs = to run >> with root privileges just to be able to communicate. >> In the context of userland stack, this is one of the most important = issues. >> In case of SCTP, this is needed to open a raw socket to send/recv = SCTP packets. >> This is one of the reasons why you use UDP encapsulation... >=20 > I see RFC 6951 on UDP encapsulation and understand there are = situations where that would be needed. However, my replication = processes do run as root. Just for fun, I started them as non-root and = SCTP worked just fine. I didn't see any raw sockets in a ktrace of the = processes. >=20 > 76330 replicate CALL = socket(PF_INET6,0x5,IPPROTO_SCTP) > 76330 replicate RET socket 5 Hi Doug, sorry, I wasn't clear. If you use an SCTP kernel stack, you don't need root privileges, except = for binding to a port smaller than 1024. This is the same for TCP and UDP. If you want to use a userland SCTP stack, the program must be able to = send and receive SCTP packets. That is done via a raw socket, which need root privileges = to be opened. Since you are using a kernel stack, you don't see any raw socket = interactions, but the opening of an SCTP socket. The FreeBSD SCTP sources are also the basis of the SCTP userland stack = usrsctp. That is why I have some experience with people running userland SCTP stacks. = One of the issues they report, is that they don't want to run an application with = root privileges just to do communication. I agree with that. To avoid using root privileges just for network communication, the = solution is to use a kernel stack or a userland stack with raw sockets, which can be = realised by using UDP encapsulation. If you run you application as root due to other constraints, there is no = problem for you to also load a kernel module. So you do not have the problem I was = referring to. Best regards Michael >=20 > -- Doug >=20