* [Sec 3610] process_control() should bail earlier on short packets. stenn@
- Reported by Philippe Antoine
+* [Bug 3619] Honour drefid setting in cooked mode and sysinfo <perlinger@ntp.org>
+ - applied patch by Gerry Garvey
* [Bug 3615] accelerate refclock startup <perlinger@ntp.org>
* [Bug 3613] Propagate noselect to mobilized pool servers <stenn@ntp.org>
- Reported by Martin Burnicki
int match;
u_long ul;
int vtype;
+ sockaddr_u sau;
ZERO(vl);
for (pvdc = table; pvdc->tag != NULL; pvdc++) {
}
}
/* fallthru */
+ case NTP_REFID: /* fallthru */
case NTP_MODE: /* fallthru */
case NTP_2BIT:
pvdc->v.str = estrdup(val);
leapbits[ul & 0x3]);
break;
+ case NTP_REFID:
+ if (!decodenetnum(pvdc->v.str, &sau)) {
+ fprintf(fp, "%s %s\n", pvdc->display, /* Text fmt */
+ pvdc->v.str);
+ } else if (drefid == REFID_IPV4) {
+ fprintf(fp, "%s %s\n", pvdc->display, /* IPv4 fmt */
+ stoa(&sau));
+ } else {
+ fprintf (fp, "%s 0x%08x\n", pvdc->display, /* Hex / hash */
+ ntohl(addr2refid(&sau)));
+ }
+ free(pvdc->v.str);
+ pvdc->v.str = NULL;
+ break;
+
default:
xprintf(stderr, "unexpected vdc type %d for %s\n",
pvdc->type, pvdc->tag);
VDC_INIT("precision", "log2 precision: ", NTP_STR),
VDC_INIT("rootdelay", "root delay: ", NTP_STR),
VDC_INIT("rootdisp", "root dispersion: ", NTP_STR),
- VDC_INIT("refid", "reference ID: ", NTP_STR),
+ VDC_INIT("refid", "reference ID: ", NTP_REFID),
VDC_INIT("reftime", "reference time: ", NTP_LFP),
VDC_INIT("sys_jitter", "system jitter: ", NTP_STR),
VDC_INIT("clk_jitter", "clock jitter: ", NTP_STR),
refid_buf[i] = (isprint(str[i]) ? str[i] : '?');
refid_buf[i] = 0; /* Null terminator */
output(fp, name, refid_buf);
- } else if (ISREFCLOCKADR(&hval))
- output(fp, name,
- refnumtoa(&hval));
- else
- output(fp, name, stoa(&hval));
+ } else if (ISREFCLOCKADR(&hval)) {
+ output(fp, name, refnumtoa(&hval));
+ } else {
+ if (drefid == REFID_IPV4) {
+ output(fp, name, stoa(&hval));
+ } else {
+ char refid_buf[12];
+ snprintf (refid_buf, sizeof(refid_buf),
+ "0x%08x", ntohl(addr2refid(&hval)));
+ output(fp, name, refid_buf);
+ }
+ }
} else if (strlen(value) <= 4) {
output(fp, name, value);
} else {