From nobody Sun Dec 26 19:15:58 2021 X-Original-To: dev-commits-src-all@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 3F4C419177C2 for ; Sun, 26 Dec 2021 19:16:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JMVrl6CNsz3nvl for ; Sun, 26 Dec 2021 19:16:07 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f48.google.com with SMTP id a9so28404747wrr.8 for ; Sun, 26 Dec 2021 11:16:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Gk96TXkgKcPsOGwyyUrKJ36rcxOI2Vh0m3pq1v6XKjc=; b=t0L6/KdOUgHqErvuvwuQwjtfym7mj9EHDH7vnEEexUbvnQwxEQHuHRZVW0s/T05qBI pQgvurQe/KO9RzdZ54oHLs/B7nJIOZvhDZY00Fs13V3ETFLdQThzkkhnIT9bLK1kX+Q1 SJDh5Cm6Ge3GxiY1i5gH7L/lByQdJYmdYox8lwV3f6jpdB+4NVLnzWw2CG6GouzjMhnd obd0QQdquCmpA+m/bpd0ujKx3vZfgfk1D22Ey6v4yBtn6WR9wxwolynpjCzlsw7YVahH j9ANXrS51jIBUTHkNaFUm4R4JcRBlNzeZT9Y9wCq21Qn0fBXdqDxxUjGIJuK6OaGVplr GufA== X-Gm-Message-State: AOAM533aT+0NgLmo/Oi5oDTY19gkV4qka4hFvoBPkU9w1pZoqYYpzlMb xkKfnbY+ySLWybsNwH/fvKe3Yg== X-Google-Smtp-Source: ABdhPJxCt1m5h2ZABxFgxRF337TbRutz+jn5vj5XQjIXQLxdnZojoBWpxZYkuWNLCefy+Qn/3l9Wqw== X-Received: by 2002:a05:6000:91:: with SMTP id m17mr10473071wrx.250.1640546160808; Sun, 26 Dec 2021 11:16:00 -0800 (PST) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id n12sm7123010wmq.30.2021.12.26.11.16.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Dec 2021 11:16:00 -0800 (PST) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: eb8dcdeac22d - main - jail: network epoch protection for IP address lists From: Jessica Clarke In-Reply-To: Date: Sun, 26 Dec 2021 19:15:58 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <7905A4B0-3308-41E9-BA29-73006E55ED53@freebsd.org> References: <202112261846.1BQIkYd8075256@gitrepo.freebsd.org> <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4JMVrl6CNsz3nvl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 26 Dec 2021, at 19:14, Gleb Smirnoff wrote: >=20 > Jessica, >=20 > On Sun, Dec 26, 2021 at 07:07:06PM +0000, Jessica Clarke wrote: > J> > +struct prison_ip { > J> > + struct epoch_context ctx; > J> > + uint32_t ips; > J> > +#ifdef FUTURE_C > J> > + union { > J> > + struct in_addr pr_ip4[]; > J> > + struct in6_addr pr_ip6[]; > J> > + }; > J> > +#else /* No future C :( */ > J> > +#define PR_IP(pip, i) ((const char *)((pip) + 1) + = pr_families[af].size * (i)) > J> > +#define PR_IPD(pip, i) ((char *)((pip) + 1) + = pr_families[af].size * (i)) > J> > +#endif > J> > +}; > J>=20 > J> You can make this work with a prison_ip base and prison_ipv[46] = derived > J> structs. > J>=20 > J> As it stands this is quite gross, you=E2=80=99re assuming things = about > J> alignment, and don=E2=80=99t even have a flexible char[] at the end = to > J> represent the extra data. >=20 > Will adding char [] to the end be sufficient to guarantee proper = alignment? No. > Using prison_ipv[46] derived structs won't work as most functions are = now > made protocol independent. Why not? Just cast from prison_ip * to prison_ipv4 * when known/needed? Jess