[dns-operations] dnscap -s
Anand Buddhdev
anandb at ripe.net
Sun Jul 22 22:30:55 UTC 2007
On Jul 22, 2007, at 7:29, Paul Vixie wrote:
>> 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)
On both CentOS 4.4 (glibc 2.3.4), and Ubuntu 7.04 (glibc 2.5), this
macro looks like this:
#define NS_GET32(l, cp) do { \
register u_char *t_cp = (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?
I don't quite understand what you are trying to explain here, but I
hope that what I've pasted above helps you understand the source of
the error message.
Regards,
--
Anand
More information about the dns-operations
mailing list