int curr_include_level; /* The current include level */
struct FILE_INFO *fp[MAXINCLUDELEVEL+1];
config_tree cfgt; /* Parser output stored here */
-config_tree *cfg_tree_history; /* History of configs */
+struct config_tree_tag *cfg_tree_history; /* History of configs */
char *sys_phone[MAXPHONE] = {NULL}; /* ACTS phone numbers */
char default_keysdir[] = NTP_KEYSDIR;
char *keysdir = default_keysdir; /* crypto keys directory */
static void destroy_restrict_node(restrict_node *my_node);
static int is_sane_resolved_address(sockaddr_u *peeraddr, int hmode);
-static u_char get_correct_host_mode(int token);
-static int peerflag_bits(peer_node *);
static void save_and_apply_config_tree(void);
static void destroy_int_fifo(int_fifo *);
#define FREE_INT_FIFO(pf) \
destroy_addr_opts_fifo(pf); \
(pf) = NULL; \
} while (0)
-#if !defined(SIM)
-static sockaddr_u *get_next_address(address_node *addr);
-#endif
-static void config_other_modes(config_tree *);
-static void config_auth(config_tree *);
static void config_tos(config_tree *);
static void config_monitor(config_tree *);
-static void config_access(config_tree *);
static void config_tinker(config_tree *);
static void config_system_opts(config_tree *);
static void config_logconfig(config_tree *);
+static void config_vars(config_tree *);
+#ifdef SIM
+static sockaddr_u *get_next_address(address_node *addr);
+static void config_sim(config_tree *);
+static void config_ntpdsim(config_tree *);
+#else /* !SIM follows */
+static void config_ntpd(config_tree *);
+static void config_other_modes(config_tree *);
+static void config_auth(config_tree *);
+static void config_access(config_tree *);
static void config_phone(config_tree *);
static void config_qos(config_tree *);
static void config_setvar(config_tree *);
static void config_ttl(config_tree *);
static void config_trap(config_tree *);
static void config_fudge(config_tree *);
-static void config_vars(config_tree *);
static void config_peers(config_tree *);
static void config_unpeers(config_tree *);
static void config_nic_rules(config_tree *);
-
-#ifdef SIM
-static void config_sim(config_tree *);
-static void config_ntpdsim(config_tree *);
-#else
-static void config_ntpd(config_tree *);
-#endif
+static u_char get_correct_host_mode(int token);
+static int peerflag_bits(peer_node *);
+#endif /* !SIM */
#ifdef WORKER
void peer_name_resolved(int, int, void *, const char *, const char *,
static unsigned long get_pfxmatch(char **s, struct masks *m);
static unsigned long get_match(char *s, struct masks *m);
static unsigned long get_logmask(char *s);
+#ifndef SIM
static int getnetnum(const char *num, sockaddr_u *addr, int complain,
enum gnn_type a_type);
+#endif
/* FUNCTIONS FOR INITIALIZATION
* ------------------------------------------
*/
+#ifndef SIM
static void
config_other_modes(
config_tree * ptree
proto_config(PROTO_MULTICAST_ADD, 1, 0., NULL);
}
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_auth(
config_tree *ptree
sys_revoke = 1 << ptree->auth.revoke;
#endif /* AUTOKEY */
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_access(
config_tree *ptree
freeaddrinfo(ai_list);
}
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
/*
* config_nic_rules - apply interface listen/ignore/drop items
*/
+#ifndef SIM
void
config_nic_rules(
config_tree *ptree
free(if_name);
}
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_phone(
config_tree *ptree
if (i)
sys_phone[i] = NULL;
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_qos(
config_tree *ptree
*/
}
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_setvar(
config_tree *ptree
if (str != NULL)
free(str);
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_ttl(
config_tree *ptree
}
sys_ttlmax = i - 1;
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_trap(
config_tree *ptree
*
* Callback invoked when config_trap()'s DNS lookup completes.
*/
-#ifdef WORKER
+# ifdef WORKER
void
trap_name_resolved(
int rescode,
latoa(localaddr), stoa(&peeraddr));
free(pstp);
}
-#endif /* WORKER */
+# endif /* WORKER */
+#endif /* !SIM */
#ifdef FREE_CFG_T
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_fudge(
config_tree *ptree
exit(curr_opt->attr ? curr_opt->attr : 1);
}
}
-#ifdef REFCLOCK
+# ifdef REFCLOCK
if (!err_flag)
refclock_control(&addr_sock, &clock_stat, NULL);
-#endif
+# endif
}
}
+#endif /* !SIM */
#ifdef FREE_CFG_T
}
+#ifndef SIM
static u_char
get_correct_host_mode(
int token
(u_char *)"*");
} else {
/* we have a hostname to resolve */
-#ifdef WORKER
+# ifdef WORKER
ctx = emalloc(sizeof(*ctx));
ctx->family = AF_UNSPEC;
ctx->host_mode = T_Server;
INITIAL_DNS_RETRY,
&peer_name_resolved,
(void *)ctx);
-#else /* !WORKER follows */
+# else /* !WORKER follows */
msyslog(LOG_ERR,
"hostname %s can not be used, please use IP address instead.\n",
curr_peer->addr->address);
-#endif
+# endif
}
}
(u_char *)"*");
} else {
/* we have a hostname to resolve */
-#ifdef WORKER
+# ifdef WORKER
ctx = emalloc(sizeof(*ctx));
ctx->family = curr_peer->addr->type;
ctx->host_mode = curr_peer->host_mode;
"ntp", &hints,
INITIAL_DNS_RETRY,
&peer_name_resolved, ctx);
-#else /* !WORKER follows */
+# else /* !WORKER follows */
msyslog(LOG_ERR,
"hostname %s can not be used, please use IP address instead.\n",
curr_peer->addr->address);
-#endif
+# endif
}
}
}
-
+#endif /* !SIM */
/*
* peer_name_resolved()
#endif /* FREE_CFG_T */
+#ifndef SIM
static void
config_unpeers(
config_tree *ptree
unpeer(p);
}
/* Resolve the hostname to address(es). */
-#ifdef WORKER
+# ifdef WORKER
memset(&hints, 0, sizeof(hints));
hints.ai_family = curr_unpeer->addr->type;
hints.ai_socktype = SOCK_DGRAM;
getaddrinfo_sometime(name, "ntp", &hints,
INITIAL_DNS_RETRY,
&unpeer_name_resolved, NULL);
-#else /* !WORKER follows */
+# else /* !WORKER follows */
msyslog(LOG_ERR,
"hostname %s can not be used, please use IP address instead.\n",
name);
-#endif
+# endif
}
}
+#endif /* !SIM */
/*
* returns 1 for success, and mysteriously, 0 for most failures, and
* -1 if the address found is IPv6 and we believe IPv6 isn't working.
*/
+#ifndef SIM
static int
getnetnum(
const char *num,
memset(addr, 0, sizeof(*addr));
AF(addr) = (u_short)ipaddr.family;
-#ifdef ISC_PLATFORM_HAVESALEN
+# ifdef ISC_PLATFORM_HAVESALEN
addr->sa.sa_len = SIZEOF_SOCKADDR(AF(addr));
-#endif
+# endif
if (IS_IPV4(addr))
memcpy(&addr->sa4.sin_addr, &ipaddr.type.in,
sizeof(addr->sa4.sin_addr));
return 1;
}
+#endif /* !SIM */