Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Dec 2021 19:15:58 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Gleb Smirnoff <glebius@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:  <7905A4B0-3308-41E9-BA29-73006E55ED53@freebsd.org>
In-Reply-To: <Yci/ELekUUKuQ%2BwX@FreeBSD.org>
References:  <202112261846.1BQIkYd8075256@gitrepo.freebsd.org> <04FFE80E-388E-4028-A6D8-FE6F725C1B5B@freebsd.org> <Yci/ELekUUKuQ%2BwX@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 26 Dec 2021, at 19:14, Gleb Smirnoff <glebius@freebsd.org> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7905A4B0-3308-41E9-BA29-73006E55ED53>