tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: py-cares structure packing woes (cffi)



Greg Troxel <gdt%lexort.com@localhost> writes:

> It turns out the cffi def is
>
>    struct in_addr {
>        uint32_t s_addr;
>    };
>
> while the NetBSD 9 /usr/include/netinet/in.h definition is:
>
>   struct in_addr {
>           in_addr_t s_addr;
>   } __packed;
>
> and yes in_addr_t is uint32_t.
>
> [snip]
>
> Our sources seem to call this packed since:
>
>   revision 1.43
>   date: 1999-11-19 19:37:59 -0500;  author: thorpej;  state: Exp;  lines: +2 -2;
>   Add the `packed' attribute to structures which describe wire protocol data.
>
> with a change in packed expression in 2007 by perry.

This builds and works on NetBSD 10, because:

  revision 1.112
  date: 2021-02-03 00:51:40 -0500;  author: roy;  state: Exp;  lines: +2 -2;  commitid: Ejsas7gYBOHG6eGC;
  Remove __packed from various network structures

  They are already network aligned and adding the __packed attribute
  just causes needless compiler warnings about accssing members of packed
  objects.

I applied this to my netbsd-9 system and then py-cares builds and works,
from pkgsrc, and with venv/pip within Home Assistant.


Perhaps this should be pulled up to 9, but I don't want to own the
fallout.  I'll leave a  pointer to this note in pkgsrc py-cares.


Home | Main Index | Thread Index | Old Index