diff options
Diffstat (limited to 'libntp/refnumtoa.c')
-rw-r--r-- | libntp/refnumtoa.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libntp/refnumtoa.c b/libntp/refnumtoa.c index 7c5d96e..c52bc28 100644 --- a/libntp/refnumtoa.c +++ b/libntp/refnumtoa.c @@ -3,13 +3,13 @@ */ #include <stdio.h> -#include "ntp_fp.h" +#include "ntp_net.h" #include "lib_strbuf.h" #include "ntp_stdlib.h" char * refnumtoa( - struct sockaddr_storage* num + sockaddr_u *num ) { register u_int32 netnum; @@ -18,19 +18,19 @@ refnumtoa( LIB_GETBUF(buf); - if(num->ss_family == AF_INET) { - netnum = ntohl(((struct sockaddr_in*)num)->sin_addr.s_addr); + if (ISREFCLOCKADR(num)) { + netnum = SRCADR(num); rclock = clockname((int)((u_long)netnum >> 8) & 0xff); if (rclock != NULL) - (void)sprintf(buf, "%s(%lu)", rclock, (u_long)netnum & 0xff); + snprintf(buf, LIB_BUFLENGTH, "%s(%lu)", + rclock, (u_long)netnum & 0xff); else - (void)sprintf(buf, "REFCLK(%lu,%lu)", - ((u_long)netnum >> 8) & 0xff, (u_long)netnum & 0xff); + snprintf(buf, LIB_BUFLENGTH, "REFCLK(%lu,%lu)", + ((u_long)netnum >> 8) & 0xff, + (u_long)netnum & 0xff); } - else { - (void)sprintf(buf, "refclock address type not implemented yet, use IPv4 refclock address."); - } + return buf; } |