Hi, Thanks for the reply.
I have one query regarding this: in the function refclock_newpeer() in the file ntp_refclock.c we are setting the flag for each peer in the hash table as peer->flags |= FLAG_REFCLOCK; So, when the NTP packet is received we will iterate through all the hash trees and then deciding the peer is fit or not. Is this flag check is required [if (!(peer->flags & FLAG_REFCLOCK) ] in peer_unfit(), because earlier versions of ntp is not there. I am not quite sure for what reason this flag check has introduced. Coming to actual problem in my scenario, In my conf file i have configured one server address and local[127.127.1.0] address. As for each peer we are setting that flag , when I changed the date and trying to set it " ntpd -q " command , when the first NTP packet is received, for the local address hash iteration this condition[(!(peer->flags & FLAG_REFCLOCK] is failing and returning as fit and trying to synchronize with local server and printing the log "slew +0.0000000sec".. and all NTP packet exchange is stopped after first pair exchange. If I remove this check [(!(peer->flags & FLAG_REFCLOCK] in peer_unfit function, then everything is fine.Time has been reset to the server value. I am not sure why this flag check is required? Thanks, Bhargav On Mon, Jul 23, 2012 at 6:31 PM, Brian Utterback <[email protected] > wrote: > That section of code is examining the root distance, which is the error > introduced by the number of hops between this system and the ultimate > source of time in this NTP network, i.e. the current root refclock. If the > root distance is too large, we reject the source and flag it as failing > test11. If the source of time we are examining is not a peer at all, but is > instead a refclock itself, then by definition the root distance is 0 and > therefore it cannot fail this test. > > > > On 7/23/2012 7:42 AM, bhargav p wrote: > >> Hi, >>> >>> Can anyone explain me this part of code in ntp_proto.c: >>> >>> >>> /* >>> >>> * A distance error for a remote peer occurs if the root >>> >>> * distance is greater than or equal to the distance threshold >>> >>> * plus the increment due to one host poll interval. >>> >>> */ >>> >>> if (!(peer->flags & FLAG_REFCLOCK) && root_distance(peer) >= >>> >>> sys_maxdist + clock_phi * ULOGTOD(peer->hpoll)) >>> >>> rval |= TEST11; /* distance exceeded */ >>> >>> >>> why we are checking the peer->flags & FLAG_REFCLOCK ? >>> >>> >>> -Bhargav >>> lists.ntp.org/listinfo/**questions<http://lists.ntp.org/listinfo/questions> >>> >> > ______________________________**_________________ > questions mailing list > [email protected] > http://lists.ntp.org/listinfo/**questions<http://lists.ntp.org/listinfo/questions> > _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
