1
0

patch-server_c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --- openntpd-3.9p1.orig/server.c 2006-05-14 07:29:21.000000000 +0200
  2. +++ openntpd-3.9p1/server.c 2010-07-02 15:33:05.061342638 +0200
  3. @@ -150,21 +150,33 @@ server_dispatch(int fd, struct ntpd_conf
  4. version = (query.status & VERSIONMASK) >> 3;
  5. bzero(&reply, sizeof(reply));
  6. - if (conf->status.synced)
  7. + if (conf->status.synced || conf->ignore)
  8. reply.status = conf->status.leap;
  9. else
  10. reply.status = LI_ALARM;
  11. +
  12. reply.status |= (query.status & VERSIONMASK);
  13. if ((query.status & MODEMASK) == MODE_CLIENT)
  14. reply.status |= MODE_SERVER;
  15. else
  16. reply.status |= MODE_SYM_PAS;
  17. - reply.stratum = conf->status.stratum;
  18. + if (conf->ignore) {
  19. + reply.stratum = 1;
  20. + reply.precision = -20;
  21. + } else {
  22. + reply.stratum = conf->status.stratum;
  23. + reply.precision = conf->status.precision;
  24. + }
  25. +
  26. reply.ppoll = query.ppoll;
  27. - reply.precision = conf->status.precision;
  28. reply.rectime = d_to_lfp(rectime);
  29. - reply.reftime = d_to_lfp(conf->status.reftime);
  30. +
  31. + if (conf->ignore)
  32. + reply.reftime = d_to_lfp(gettime());
  33. + else
  34. + reply.reftime = d_to_lfp(conf->status.reftime);
  35. +
  36. reply.xmttime = d_to_lfp(gettime());
  37. reply.orgtime = query.xmttime;
  38. reply.rootdelay = d_to_sfp(conf->status.rootdelay);