On Sun, Dec 12, 2010 at 06:50:39PM +0100, Josip Rodin wrote:
> > Actually, we've had [the udpfromto stuff] enabled since 2005,
> > -- Paul Hampson <[email protected]> Fri, 4 Mar 2005 09:30:40 +1100
> Looking at the code, it's supposed to make allowances for IPv6... the only
> recent change is:
>
> % git log -1 src/lib/udpfromto.c
> commit 50b90d2b4deeb0a24a30fc04ecd963cfa85d22c9
> Date: Sat Mar 6 12:40:23 2010 +0100
>
> This must have enabled that code path, since the new version looks like a
> no-op - it's always defined in src/include/missing.h if missing...
Yep, that's it. This code path then enters into a bit of ifdef hell (no
fallbacks or asserts, dammit!), which opens up another problem generated by
these sibling checks:
FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo],
ipi_addr)
FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo],
ipi6_addr)
The first test works, but the second doesn't. The second one should actually
work, but the problem is in the definition:
% cat foo.c
#include <netinet/in.h>
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
#endif
int
main ()
{
int foo = offsetof(struct in6_pktinfo, ipi6_addr)
;
return 0;
}
% make foo
cc foo.c -o foo
foo.c: In function 'main':
foo.c:10: error: dereferencing pointer to incomplete type
make: *** [foo] Error 1
The test for IPv4 is analogous, but on compile it just warns:
foo.c:9: warning: cast from pointer to integer of different size
The test code is not immediately obvious to me, but it seems fairly obvious
to me that you can cast this:
struct in_addr {
__be32 s_addr;
};
to an int and expect to get away with it, whereas the other one is:
struct in6_addr
{
union
{
uint8_t __u6_addr8[16];
#if defined __USE_MISC || defined __USE_GNU
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
#endif
} __in6_u;
#define s6_addr __in6_u.__u6_addr8
#if defined __USE_MISC || defined __USE_GNU
# define s6_addr16 __in6_u.__u6_addr16
# define s6_addr32 __in6_u.__u6_addr32
#endif
};
Casting a union of differently-sized integers to a single int... Which one
should it return? :)
This test did actually work at some point with some old, more lax compiler,
https://buildd.debian.org/status/fetch.php?pkg=freeradius&arch=amd64&ver=2.0.4-1&stamp=1210449572
says:
checking for ipi_addr in struct in_pktinfo... yes
checking for ipi6_addr in struct in6_pktinfo... yes
But not since ca. 2009,
https://buildd.debian.org/status/fetch.php?pkg=freeradius&arch=amd64&ver=2.0.4%2Bdfsg-6%2Bb1&stamp=1239143149
says:
checking for ipi_addr in struct in_pktinfo... yes
checking for ipi6_addr in struct in6_pktinfo... no
--
2. That which causes joy or happiness.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]