Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2469012rdg; Mon, 14 Aug 2023 03:44:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHbzO+K7kUCgKlhxtEdbYAV0yfXQ+kAECRhP/c1hyulT4bsWkvs/qGjlmFIyYJJgV2Vt0O X-Received: by 2002:a17:907:a069:b0:99b:ed44:1a79 with SMTP id ia9-20020a170907a06900b0099bed441a79mr7485846ejc.3.1692009868310; Mon, 14 Aug 2023 03:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692009868; cv=none; d=google.com; s=arc-20160816; b=aI+IXF5bni8baFkBx1m0GBT3asmSFdU8SYzYhew9ZjUSF4bhFfWPmYLIxeEZuMztBI TCSGnv8YxjX90QjIRaEuhSVauJYu1km6kaselgaDOolpbGxMq2Ucn7JGdaCGgPE7Jiwv 95xMw9kyoetFyZNuRGzVOJbqXMCQJ6ZmCQ2qYZn7xb4GZq9hET1YAggS3Ov/9puMre5l fpyRC2c7YtRzOcVJf+6sbwP4QgDPwvOLD3G2RRS8N9EIjKIE5zEFx8EmDzZwJXvuHvxB KOwwPczdzkMe/mognxWTrDYF3KZzD1ni3ybc42INJX/JnhKWh7aNJ5iwNWq4RhuNzwh5 VH0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FEq4tMvABy02Aj9KhKkOBmN5DwD6++P6cc/KYaesST8=; fh=hDtqhl5hZRZUMNX77Ut7nWTt2wbQOrsqEO+SNHSS+54=; b=viWoeqlu4F6Q+KCD+7odJdwhrxzHOIHct1odo6D05L0165Iq6no50+fOYqbQi4GGEa VaBxvJNiQ61yq7N3lqgHQ2i/eEM+t7K5OJdolHs3cAEffb2z5TzMQNPfz0hMve3BgPXW zJG1OflEc+h+bGMojPF4hHwFg65WuhV0s1uMvuU9lbIN86MKU9aBaqco4K9Frb2hPJy4 epokDxvCSrL6QWHJdvYh+LQy/7Ki/zjoKl0igwxRWkIYc35a5/MZKUkcuQjEj/TDNZPp 6N3wtvGugo0MQ6uBsuLjhcKCIccXpgLoq3l496fd0MjuZhF/RnLJznihwLoiNvkiWPga eaww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kwJW+qTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gg15-20020a170906e28f00b0098b0feb8935si7095480ejb.1035.2023.08.14.03.44.04; Mon, 14 Aug 2023 03:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kwJW+qTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235644AbjHNJY6 (ORCPT + 99 others); Mon, 14 Aug 2023 05:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235523AbjHNJY1 (ORCPT ); Mon, 14 Aug 2023 05:24:27 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48960D7; Mon, 14 Aug 2023 02:24:25 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fe9f226cdbso2387471e87.0; Mon, 14 Aug 2023 02:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692005063; x=1692609863; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FEq4tMvABy02Aj9KhKkOBmN5DwD6++P6cc/KYaesST8=; b=kwJW+qTe7U7dR7ZSg1LyK1C3o89JFyEyaFt1UAYxszT7fWnRwYnXIomXUCuxDp55XB BU/B0DmyB3KlHrvIh5Yf3ltNlW5TUBqYFJhH6SYgRbIucYFZIbpGs7DL8U6NFrap05oI knmO+wvsQKcPXvq1HaIZm6+xzAOD4lRy5tz4xRhHFgxKdZqPCHn62GNWjht/XE0f83oj rElHr5iLIJdYTAoAVXWUhSt5h0Euwh6UOfSClUA2iCCnfYtFMYSM9Uxx1HUdq3dEIo9w XewgyAcJXgCs2brD+cKd7HoIJomWNAn7K4b9pisaHWyy8u8Kp/CFyFNYkyjT8rUiijN5 EvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692005063; x=1692609863; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FEq4tMvABy02Aj9KhKkOBmN5DwD6++P6cc/KYaesST8=; b=WEUkl1IIgzSDFvIvb2U3Dgzi+1qXj+jOh5PDAuyyaylXU89N4o8uG7/gpMJV/P1/CY yMwX0g/AYYpZeJUXCdkUaAa5S1+CbSil4pvUPQYVtLzKd5iRxiP4eswjy5JfSSQvidIo SAqtP4oATnKBvf6ZKcdBpGz1TcwGNGYQs/fzZNn/16lObFdXbJ+z86hzyYtokv9UOs0A Fz2dzFe4eTdhG3117ytz30VzbOZV848mfTpimskc1bUhUAPaXhY6iQETUIb8i9/Ieq0m sDK3DHFU92LcjuXIBOgu14c0jf3HgOdbWdf1En7hYyhHaDXb03kpcIyJc/YAX9sT+1Sd n6Mg== X-Gm-Message-State: AOJu0YyNbtMlwcQiymKew+GUdYA+aQIJ9fpFgBa89AGZKF+NiiHXRRGU TG8kyLNmEyuCXZOqs6WxYYw= X-Received: by 2002:ac2:5bc8:0:b0:4fb:9d61:db44 with SMTP id u8-20020ac25bc8000000b004fb9d61db44mr4791668lfn.12.1692005063397; Mon, 14 Aug 2023 02:24:23 -0700 (PDT) Received: from micheledallerive.home ([2a02:1210:6051:ec00:61e9:3767:83a6:9bd9]) by smtp.gmail.com with ESMTPSA id b5-20020aa7c6c5000000b005224d960e66sm5314879eds.96.2023.08.14.02.24.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 02:24:23 -0700 (PDT) From: Michele Dalle Rive To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , "David S. Miller" Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Alice Ryhl , Davide Rovelli , rust-for-linux@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Michele Dalle Rive Subject: [RFC PATCH 0/7] Rust Socket abstractions Date: Mon, 14 Aug 2023 11:22:55 +0200 Message-ID: <20230814092302.1903203-1-dallerivemichele@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series is intended to create Rust abstractions for Sockets and other fundamental network entities. Specifically, it was added: - Ip address and Socket address wrappers (for `in_addr`, `in6_addr`, `sockaddr_in`, `sockaddr_in6`, `sockaddr_storage`). - Socket wrapper. - Socket flags and options enums. - TCP and UDP specific abstractions over the Rust Socket structure. This series is a RFC because I would appreciate some feedback about: - The structure of the module: is the division of the files and modules appropriate or should it be more or less fine-grained? Also, should the `net` module export all the structures of its submodules? I noticed that it is done in the standard library. - Whether the documentation is comprehensive enough. - A few other specific questions, written in the individual patches. I would greatly appreciate any kind of feedback or opinion. I am pretty new to the patch/mailing list world, so please point out any mistake I might make. The changes in this patch series are based on top of the latest commit of `rust-next` in the Rust git tree: 19cd7b5d229c ("btf, scripts: rust: drop is_rust_module.sh") Michele Dalle Rive (7): rust: net: add net module files and shared enums. rust: net: add ip and socket address bindings. rust: net: add socket-related flags and flagset. rust: net: add socket wrapper. rust: net: implement socket options API. rust: net: add socket TCP wrappers. rust: net: add socket UDP wrappers. rust/bindings/bindings_helper.h | 3 + rust/kernel/lib.rs | 2 + rust/kernel/net.rs | 185 +++++ rust/kernel/net/addr.rs | 1215 ++++++++++++++++++++++++++++++ rust/kernel/net/ip.rs | 73 ++ rust/kernel/net/socket.rs | 641 ++++++++++++++++ rust/kernel/net/socket/flags.rs | 467 ++++++++++++ rust/kernel/net/socket/opts.rs | 1222 +++++++++++++++++++++++++++++++ rust/kernel/net/tcp.rs | 252 +++++++ rust/kernel/net/udp.rs | 182 +++++ 10 files changed, 4242 insertions(+) create mode 100644 rust/kernel/net.rs create mode 100644 rust/kernel/net/addr.rs create mode 100644 rust/kernel/net/ip.rs create mode 100644 rust/kernel/net/socket.rs create mode 100644 rust/kernel/net/socket/flags.rs create mode 100644 rust/kernel/net/socket/opts.rs create mode 100644 rust/kernel/net/tcp.rs create mode 100644 rust/kernel/net/udp.rs -- 2.41.0