On Mon, Sep 10, 2018 at 05:24:04PM +0200, Klemens Nanni wrote:
> If you find a bug in this diff, dinner is on me.
unfortunately no bug found, just remarks
> +void
> +copy_satopfaddr(struct pf_addr *pfa, struct sockaddr *sa)
> +{
> + if (sa->sa_family == AF_INET6)
> + memcpy(pfa, &((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr,
> + sizeof(struct in6_addr));
I would prefer to access pfa.v6 than to rely on the fact that pf_addr
contains a union as the first field. And the memcpy() is eqivalent
to the following assignment as both structures are aligned.
pfa.v6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
> + else
> + memcpy(pfa, &((struct sockaddr_in *)sa)->sin_addr.s_addr,
> + sizeof(struct in_addr));
pfa.v4 = ((struct sockaddr_in *)sa)->sin_addr;
bluhm