[dns-operations] dnscap -s
Paul Vixie
paul at vix.com
Sun Jul 22 17:29:24 UTC 2007
> dnscap.c: In function 'dl_pkt':
> dnscap.c:964: warning: cast discards qualifiers from pointer target type
> make: *** [dnscap.o] Error 1
in your /usr/include/arpa/nameser.h, does your NS_GET32 macro look like this?
#define NS_GET32(l, cp) do { \
register const u_char *t_cp = (const u_char *)(cp); \
(l) = ((u_int32_t)t_cp[0] << 24) \
| ((u_int32_t)t_cp[1] << 16) \
| ((u_int32_t)t_cp[2] << 8) \
| ((u_int32_t)t_cp[3]) \
; \
(cp) += NS_INT32SZ; \
} while (0)
dnscap.c:964 is "NS_GET32(x, pkt);" where "x" is declared as "uint32_t" and
"pkt" is declared as "const u_char *". the only "qualifier" this error msg
could refer to use "const", and this qualifier is present on every cast except
the four (u_int32_t)'s on t_cp, where it's clearly binding to the array deref
or else the array deref would be to a u_int32_t.
so there's something terribly gutshot in your /usr/include/arpa/nameser.h file
and i'd love to see what centos 4.4 has come up with that breaks this otherwise
portable code which tries to use an otherwise portable, and common, interface.
if i'm misreading the error, misunderstanding GCC's intent, or being stupid
about C, i trust that several folks here will step forward to educate me?
More information about the dns-operations
mailing list