]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2715] mdnstries option for ntp.conf from NetBSD
authorHarlan Stenn <stenn@ntp.org>
Tue, 30 Dec 2014 00:28:06 +0000 (00:28 +0000)
committerHarlan Stenn <stenn@ntp.org>
Tue, 30 Dec 2014 00:28:06 +0000 (00:28 +0000)
bk: 54a1f196WqAsMXwFMln3RWCI3B5RQg

ChangeLog
ntpd/keyword-gen.c
ntpd/ntp_config.c
ntpd/ntp_parser.y

index 918890d7b34733b6bdaaeeedda6ab3121c16e6df..94fa2af0d93dcca89f43e47782ac363d6d1cb2c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 * [Bug 2706] libparse/info_trimble.c build dependencies are broken.
 * [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD.
 * [Bug 2714] libevent may need to be built independently of any build of sntp.
+* [Bug 2715]  mdnstries option for ntp.conf from NetBSD.
 ---
 (4.2.8p1-beta2) 2014/12/27 Released by Harlan Stenn <stenn@ntp.org>
 
index d4f77588d60cd56c53fb7f8e6b8818a571e81c9b..bb593aba2e20b9f50caab456829856ae28891d1f 100644 (file)
@@ -97,6 +97,7 @@ struct key_tok ntp_keywords[] = {
 { "iburst",            T_Iburst,               FOLLBY_TOKEN },
 { "key",               T_Key,                  FOLLBY_TOKEN },
 { "maxpoll",           T_Maxpoll,              FOLLBY_TOKEN },
+{ "mdnstries",         T_Mdnstries,            FOLLBY_TOKEN },
 { "minpoll",           T_Minpoll,              FOLLBY_TOKEN },
 { "mode",              T_Mode,                 FOLLBY_TOKEN },
 { "noselect",          T_Noselect,             FOLLBY_TOKEN },
@@ -357,7 +358,7 @@ generate_fsm(void)
                        fprintf(stderr,
                                "keyword-gen sst[%u] too small "
                                "for keyword '%s' id %d\n",
-                               COUNTOF(sst),
+                               (int)COUNTOF(sst),
                                ntp_keywords[i].key,
                                token);
                        exit(4);
index 0f48983f82e5c0531196433de4cb3e52449b0d28..3bb9a15355df941cf581861be0fee186cced055c 100644 (file)
@@ -128,6 +128,8 @@ typedef struct peer_resolved_ctx_tag {
 #define ISEOL(c)       ((c) == '#' || (c) == '\n' || (c) == '\0')
 #define ISSPACE(c)     ((c) == ' ' || (c) == '\t')
 
+#define _UC(str)       ((char *)(intptr_t)(str))
+
 /*
  * Definitions of things either imported from or exported to outside
  */
@@ -316,6 +318,7 @@ 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_mdnstries(config_tree *);
 static void config_phone(config_tree *);
 static void config_setvar(config_tree *);
 static void config_ttl(config_tree *);
@@ -355,6 +358,7 @@ static u_int32 get_logmask(const char *);
 #ifndef SIM
 static int getnetnum(const char *num, sockaddr_u *addr, int complain,
                     enum gnn_type a_type);
+
 #endif
 
 
@@ -392,6 +396,7 @@ init_syntax_tree(
        )
 {
        ZERO(*ptree);
+       ptree->mdnstries = 5;
 }
 
 
@@ -502,7 +507,7 @@ dump_config_tree(
        int_node *counter_set;
        string_node *str_node;
 
-       const char *s;
+       const char *s = NULL;
        char *s1;
        char *s2;
        char timestamp[80];
@@ -1105,7 +1110,7 @@ create_attr_rangeval(
 attr_val *
 create_attr_sval(
        int attr,
-       char *s
+       const char *s
        )
 {
        attr_val *my_val;
@@ -1114,7 +1119,7 @@ create_attr_sval(
        my_val->attr = attr;
        if (NULL == s)                  /* free() hates NULL */
                s = estrdup("");
-       my_val->value.s = s;
+       my_val->value.s = _UC(s);
        my_val->type = T_String;
 
        return my_val;
@@ -1329,7 +1334,7 @@ create_unpeer_node(
         * We treat all valid 16-bit numbers as association IDs.
         */
        pch = addr->address;
-       while (*pch && isdigit(*pch))
+       while (*pch && isdigit((unsigned char)*pch))
                pch++;
 
        if (!*pch
@@ -2457,12 +2462,12 @@ config_access(
 
                /* It would be swell if we could identify the line number */
                if ((RES_KOD & flags) && !(RES_LIMITED & flags)) {
-                       char *kod_where = (my_node->addr)
+                       const char *kod_where = (my_node->addr)
                                          ? my_node->addr->address
                                          : (mflags & RESM_SOURCE)
                                            ? "source"
                                            : "default";
-                       char *kod_warn = "KOD does nothing without LIMITED.";
+                       const char *kod_warn = "KOD does nothing without LIMITED.";
 
                        fprintf(stderr, "restrict %s: %s\n", kod_where, kod_warn);
                        msyslog(LOG_WARNING, "restrict %s: %s", kod_where, kod_warn);
@@ -3033,7 +3038,7 @@ config_phone(
        config_tree *ptree
        )
 {
-       int             i;
+       size_t          i;
        string_node *   sn;
 
        i = 0;
@@ -3045,13 +3050,23 @@ config_phone(
                        sys_phone[i] = NULL;
                } else {
                        msyslog(LOG_INFO,
-                               "phone: Number of phone entries exceeds %lu. Ignoring phone %s...",
-                               (u_long)(COUNTOF(sys_phone) - 1), sn->s);
+                               "phone: Number of phone entries exceeds %zu. Ignoring phone %s...",
+                               (COUNTOF(sys_phone) - 1), sn->s);
                }
        }
 }
 #endif /* !SIM */
 
+static void
+config_mdnstries(
+       config_tree *ptree
+       )
+{
+#ifdef HAVE_DNSREGISTRATION
+       extern int mdnstries;
+       mdnstries = ptree->mdnstries;
+#endif  /* HAVE_DNSREGISTRATION */
+}
 
 #ifdef FREE_CFG_T
 static void
@@ -3110,7 +3125,7 @@ config_ttl(
        config_tree *ptree
        )
 {
-       int i = 0;
+       size_t i = 0;
        int_node *curr_ttl;
 
        curr_ttl = HEAD_PFIFO(ptree->ttl);
@@ -3119,8 +3134,8 @@ config_ttl(
                        sys_ttl[i++] = (u_char)curr_ttl->i;
                else
                        msyslog(LOG_INFO,
-                               "ttl: Number of TTL entries exceeds %lu. Ignoring TTL %d...",
-                               (u_long)COUNTOF(sys_ttl), curr_ttl->i);
+                               "ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...",
+                               COUNTOF(sys_ttl), curr_ttl->i);
        }
        sys_ttlmax = i - 1;
 }
@@ -4286,6 +4301,7 @@ config_ntpd(
        config_system_opts(ptree);
        config_logconfig(ptree);
        config_phone(ptree);
+       config_mdnstries(ptree);
        config_setvar(ptree);
        config_ttl(ptree);
        config_trap(ptree);
@@ -4886,7 +4902,7 @@ ntp_rlimit(
        int     rl_what,
        rlim_t  rl_value,
        int     rl_scale,
-       char *  rl_sstr
+       const char *    rl_sstr
        )
 {
        struct rlimit   rl;
index e75bffe4f580041b828a1df20d55cf7a10ccc405..c55e0697dee4b8ebed517bc9632edffb972513cb 100644 (file)
 %token <Integer>       T_Maxdist
 %token <Integer>       T_Maxmem
 %token <Integer>       T_Maxpoll
+%token <Integer>       T_Mdnstries
 %token <Integer>       T_Mem
 %token <Integer>       T_Memlock
 %token <Integer>       T_Minclock
@@ -526,6 +527,8 @@ other_mode_command
                        { CONCAT_G_FIFOS(cfgt.manycastserver, $2); }
        |       T_Multicastclient address_list
                        { CONCAT_G_FIFOS(cfgt.multicastclient, $2); }
+       |       T_Mdnstries T_Integer
+                       { cfgt.mdnstries = $2; }
        ;