Re: git: eb8dcdeac22d - main - jail: network epoch protection for IP address lists
Date: Sun, 26 Dec 2021 19:14:24 UTC
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