ISC dhcp server on NetBSD
dhcp.50.CHRIS94561 at spamgourmet.com
dhcp.50.CHRIS94561 at spamgourmet.com
Sun Apr 25 02:58:28 UTC 2004
On Sat, 24 Apr 2004, Greg Troxel - gdt at ir.bbn.com wrote:
> parse.c: In function `parse_lease_time':
> parse.c:425: warning: passing arg 1 of `ntohl' as unsigned due to
> prototype
> *** Error code 1
>
> Stop.
> make: stopped in /share/projects/dhcp/dhcp-3.0pl2/work.netbsd/common
>
> This error doesn't come up on the Linux compile. Best I can tell time_t
> is signed on both systems. Why the warning? I know this is relatively
> minor and I can remove "-Werror" to avoid it but I'd like some clarity.
>
> I'd say that it is reasonable for ntohl to be unsigned, since a 32-bit
> quantity in non-native byte order shouldn't be treated as signed
> (which implies native byte order). time_t might become 64 bits in the
> future, too.
Problem is that time_t is a signed, not unsigned.
> The code is really unpacking 32 bits in network order into *timep, and
> then byteswapping it. I suspect that if one uses a uint32_t for the
> output of convert_num, and then passes that variable to ntohl all will
> be ok.
While that all may be true. Part of the question I'm asking is: Why does
the same code compile on Linux and not NetBSD? In both cases ntohl is
unsigned and time_t is signed. So why the discrepancy in the compiler
behavior?
Chris
More information about the dhcp-hackers
mailing list