Date: Sun, 26 Dec 2021 11:14:24 -0800 From: Gleb Smirnoff <glebius@freebsd.org> To: Jessica Clarke <jrtc27@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: eb8dcdeac22d - main - jail: network epoch protection for IP address lists Message-ID: <Yci/ELekUUKuQ%2BwX@FreeBSD.org> In-Reply-To: <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org> References: <202112261846.1BQIkYd8075256@gitrepo.freebsd.org> <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
  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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Yci/ELekUUKuQ%2BwX>
