diff options
author | roberto <roberto@FreeBSD.org> | 2004-07-20 15:01:56 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2004-07-20 15:01:56 +0000 |
commit | 118e757284cbb8fc4f43a713e892b41504b50a5f (patch) | |
tree | 528d12dda44ebdc3ffcc38050f159ac553a69c17 /contrib/ntp/libntp/refnumtoa.c | |
parent | a85d9ae25e8e8696677bc30feb6eaf7fc150e529 (diff) | |
download | FreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.zip FreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.tar.gz |
Virgin import of ntpd 4.2.0
Diffstat (limited to 'contrib/ntp/libntp/refnumtoa.c')
-rw-r--r-- | contrib/ntp/libntp/refnumtoa.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/contrib/ntp/libntp/refnumtoa.c b/contrib/ntp/libntp/refnumtoa.c index a102015..7c5d96e 100644 --- a/contrib/ntp/libntp/refnumtoa.c +++ b/contrib/ntp/libntp/refnumtoa.c @@ -9,23 +9,28 @@ char * refnumtoa( - u_int32 num + struct sockaddr_storage* num ) { register u_int32 netnum; register char *buf; register const char *rclock; - - netnum = ntohl(num); - + LIB_GETBUF(buf); - rclock = clockname((int)((u_long)netnum >> 8) & 0xff); + if(num->ss_family == AF_INET) { + netnum = ntohl(((struct sockaddr_in*)num)->sin_addr.s_addr); + rclock = clockname((int)((u_long)netnum >> 8) & 0xff); + + if (rclock != NULL) + (void)sprintf(buf, "%s(%lu)", rclock, (u_long)netnum & 0xff); + else + (void)sprintf(buf, "REFCLK(%lu,%lu)", + ((u_long)netnum >> 8) & 0xff, (u_long)netnum & 0xff); - if (rclock != NULL) - (void)sprintf(buf, "%s(%lu)", rclock, (u_long)netnum & 0xff); - else - (void)sprintf(buf, "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; } |