IPv6 const addresses
Lewis Donzis
lew at perftech.com
Tue Oct 13 12:50:42 UTC 2020
Hello.
It appears that there are some missing definitions for a couple of the "const struct in6_addr" values that are included in in6.h.
Here are the relevant declarations in /usr/include/netinet6/in6.h:
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
extern const struct in6_addr in6addr_nodelocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allrouters;
extern const struct in6_addr in6addr_linklocal_allv2routers;
However, here are the definitions in /usr/src/lib/libc/net/vars.c:
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
As you can see, in6addr_linklocal_allrouters and in6addr_linklocal_allv2routers are missing. Attempting to use the missing definitions results in a linker error because they are declared properly.
The static initializer values are defined in /usr/include/netinet6/in6.h:
#define IN6ADDR_ANY_INIT \
#define IN6ADDR_LOOPBACK_INIT \
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
So it seems a simple matter of adding the two missing ones to /usr/src/lib/libc/net/vars.c.
Thanks,
lew
More information about the freebsd-net
mailing list