Lines Matching refs:ntp

123 	register struct netinfo *ntp;
269 ntp = NULL;
277 if (!ntp)
278 ntp = (struct netinfo*)malloc(sizeof(struct netinfo));
279 bzero(ntp,sizeof(*ntp));
280 ntp->my_addr=((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
281 ntp->status = NOMASTER;
301 ntp->mask = ((struct sockaddr_in *)
309 ntp->dest_addr = *(struct sockaddr_in *)&ifreq.ifr_broadaddr;
311 * So we cannot just mask ntp->dest_addr. */
312 ntp->net = ntp->my_addr;
313 ntp->net.s_addr &= ntp->mask;
320 ntp->dest_addr = *(struct sockaddr_in *)&ifreq.ifr_dstaddr;
321 ntp->net = ntp->dest_addr.sin_addr;
324 ntp->dest_addr.sin_port = port;
327 if (ntp->net.s_addr == htonl(nt->net))
333 ntp->next = NULL;
335 nettab = ntp;
337 ntip->next = ntp;
339 ntip = ntp;
340 ntp = NULL;
342 if (ntp)
343 (void) free((char *)ntp);
415 for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
416 if (ntp->status == MASTER) {
417 rmnetmachs(ntp);
418 ntp->status = NOMASTER;
473 lookformaster(struct netinfo *ntp)
481 ntp->status = SLAVE;
486 answer = acksend(&resp, &ntp->dest_addr, ANYADDR,
487 TSP_MASTERACK, ntp, 0);
489 suppress(&from, answer->tsp_name, ntp);
490 ntp->status = NOMASTER;
503 answer = readmsg(TSP_MASTERREQ, ANYADDR, &ntime, ntp);
506 suppress(&from, answer->tsp_name, ntp);
507 ntp->status = NOMASTER;
513 answer = readmsg(TSP_MASTERUP, ANYADDR, &ntime, ntp);
516 suppress(&from, answer->tsp_name, ntp);
517 ntp->status = NOMASTER;
523 answer = readmsg(TSP_ELECTION, ANYADDR, &ntime, ntp);
526 suppress(&from, answer->tsp_name, ntp);
527 ntp->status = NOMASTER;
533 ntp->status = MASTER;
535 ntp->status = NOMASTER;
539 ntp->status = SLAVE;
550 answer = readmsg(TSP_MASTERACK, ANYADDR, &ntime, ntp);
574 struct netinfo *ntp;
580 for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
581 switch ((int)ntp->status) {
594 fprintf(fd, "\t%-16s", inet_ntoa(ntp->net));
595 switch ((int)ntp->status) {
610 (int)ntp->status);
615 status |= ntp->status;
627 register struct netinfo *ntp;
629 for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
630 if (ntp->status == SLAVE && ntp != net)
631 ntp->status = IGNORE;
642 register struct netinfo *ntp;
644 for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
645 if (!Mflag && ntp->status == SLAVE)
648 if (ntp->status == IGNORE || ntp->status == NOMASTER) {
649 lookformaster(ntp);
650 if (!Mflag && ntp->status == SLAVE)
662 pickslavenet(struct netinfo *ntp)
669 if (ntp == NULL || ntp->status != SLAVE) {
670 for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
671 if (ntp->status == SLAVE)
675 makeslave(ntp);