From nobody Sun Dec 26 19:14:24 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 623B319169E8; Sun, 26 Dec 2021 19:14:27 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JMVpp6mYWz3n6n; Sun, 26 Dec 2021 19:14:26 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 1BQJEO4Z002259 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 26 Dec 2021 11:14:25 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 1BQJEOqg002258; Sun, 26 Dec 2021 11:14:24 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Sun, 26 Dec 2021 11:14:24 -0800 From: Gleb Smirnoff To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: eb8dcdeac22d - main - jail: network epoch protection for IP address lists Message-ID: References: <202112261846.1BQIkYd8075256@gitrepo.freebsd.org> <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org> 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org> X-Rspamd-Queue-Id: 4JMVpp6mYWz3n6n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Jessica, 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> J> You can make this work with a prison_ip base and prison_ipv[46] derived J> structs. J> J> As it stands this is quite gross, you’re assuming things about J> alignment, and don’t even have a flexible char[] at the end to J> represent the extra data. Will adding char [] to the end be sufficient to guarantee proper alignment? Using prison_ipv[46] derived structs won't work as most functions are now made protocol independent. -- Gleb Smirnoff