components/ntp/patches/mdns.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 172 093198acf7d4
permissions -rw-r--r--
Close of build 10.
--- ntpd/ntpd-opts.c.orig	Thu Jul 29 09:29:51 2010
+++ ntpd/ntpd-opts.c	Thu Jul 29 09:43:40 2010
@@ -243,6 +243,24 @@
 #define NOVIRTUALIPS_FLAGS       (OPTST_DISABLED)
 
 /*
+ *  Mdns option description:
+ */
+#ifdef HAVE_DNSREGISTRATION
+tSCC    zMdnsText[] =
+        "Register with mDNS as a NTP server";
+tSCC    zMdns_NAME[]               = "MDNS";
+tSCC    zMdns_Name[]               = "mdns";
+#define MDNS_FLAGS       (OPTST_DISABLED)
+
+#else   /* disable Mdns */
+#define VALUE_OPT_MDNS NO_EQUIVALENT
+#define MDNS_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
+#define zMdnsText       NULL
+#define zMdns_NAME      NULL
+#define zMdns_Name      NULL
+#endif  /* HAVE_DNSREGISTRATION */
+
+/*
  *  Modifymmtimer option description:
  */
 #ifdef SYS_WINNT
@@ -673,10 +691,22 @@
      /* desc, NAME, name */ zNovirtualipsText, zNovirtualips_NAME, zNovirtualips_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
-     /* equiv idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
+  {  /* entry idx, value */ 15, VALUE_OPT_MDNS,
+     /* equiv idx, value */ 15, VALUE_OPT_MDNS,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
+     /* opt state flags  */ MDNS_FLAGS, 0,
+     /* last opt argumnt */ { NULL },
+     /* arg list/cookie  */ NULL,
+     /* must/cannot opts */ NULL, NULL,
+     /* option proc      */ NULL,
+     /* desc, NAME, name */ zMdnsText, zMdns_NAME, zMdns_Name,
+     /* disablement strs */ NULL, NULL },
+
+  {  /* entry idx, value */ 16, VALUE_OPT_MODIFYMMTIMER,
+     /* equiv idx, value */ 16, VALUE_OPT_MODIFYMMTIMER,
+     /* equivalenced to  */ NO_EQUIVALENT,
+     /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ MODIFYMMTIMER_FLAGS, 0,
      /* last opt argumnt */ { NULL },
      /* arg list/cookie  */ NULL,
@@ -685,8 +715,8 @@
      /* desc, NAME, name */ zModifymmtimerText, zModifymmtimer_NAME, zModifymmtimer_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 16, VALUE_OPT_NOFORK,
-     /* equiv idx, value */ 16, VALUE_OPT_NOFORK,
+  {  /* entry idx, value */ 17, VALUE_OPT_NOFORK,
+     /* equiv idx, value */ 17, VALUE_OPT_NOFORK,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ NOFORK_FLAGS, 0,
@@ -697,8 +727,8 @@
      /* desc, NAME, name */ zNoforkText, zNofork_NAME, zNofork_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 17, VALUE_OPT_NICE,
-     /* equiv idx, value */ 17, VALUE_OPT_NICE,
+  {  /* entry idx, value */ 18, VALUE_OPT_NICE,
+     /* equiv idx, value */ 18, VALUE_OPT_NICE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ NICE_FLAGS, 0,
@@ -709,8 +739,8 @@
      /* desc, NAME, name */ zNiceText, zNice_NAME, zNice_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 18, VALUE_OPT_PIDFILE,
-     /* equiv idx, value */ 18, VALUE_OPT_PIDFILE,
+  {  /* entry idx, value */ 19, VALUE_OPT_PIDFILE,
+     /* equiv idx, value */ 19, VALUE_OPT_PIDFILE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ PIDFILE_FLAGS, 0,
@@ -721,8 +751,8 @@
      /* desc, NAME, name */ zPidfileText, zPidfile_NAME, zPidfile_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 19, VALUE_OPT_PRIORITY,
-     /* equiv idx, value */ 19, VALUE_OPT_PRIORITY,
+  {  /* entry idx, value */ 20, VALUE_OPT_PRIORITY,
+     /* equiv idx, value */ 20, VALUE_OPT_PRIORITY,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ PRIORITY_FLAGS, 0,
@@ -733,8 +763,8 @@
      /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 20, VALUE_OPT_QUIT,
-     /* equiv idx, value */ 20, VALUE_OPT_QUIT,
+  {  /* entry idx, value */ 21, VALUE_OPT_QUIT,
+     /* equiv idx, value */ 21, VALUE_OPT_QUIT,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ QUIT_FLAGS, 0,
@@ -745,8 +775,8 @@
      /* desc, NAME, name */ zQuitText, zQuit_NAME, zQuit_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
-     /* equiv idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
+  {  /* entry idx, value */ 22, VALUE_OPT_PROPAGATIONDELAY,
+     /* equiv idx, value */ 22, VALUE_OPT_PROPAGATIONDELAY,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ PROPAGATIONDELAY_FLAGS, 0,
@@ -757,8 +787,8 @@
      /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 22, VALUE_OPT_STATSDIR,
-     /* equiv idx, value */ 22, VALUE_OPT_STATSDIR,
+  {  /* entry idx, value */ 23, VALUE_OPT_STATSDIR,
+     /* equiv idx, value */ 23, VALUE_OPT_STATSDIR,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ STATSDIR_FLAGS, 0,
@@ -769,8 +799,8 @@
      /* desc, NAME, name */ zStatsdirText, zStatsdir_NAME, zStatsdir_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 23, VALUE_OPT_TRUSTEDKEY,
-     /* equiv idx, value */ 23, VALUE_OPT_TRUSTEDKEY,
+  {  /* entry idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
+     /* equiv idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, NOLIMIT, 0,
      /* opt state flags  */ TRUSTEDKEY_FLAGS, 0,
@@ -781,8 +811,8 @@
      /* desc, NAME, name */ zTrustedkeyText, zTrustedkey_NAME, zTrustedkey_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 24, VALUE_OPT_USER,
-     /* equiv idx, value */ 24, VALUE_OPT_USER,
+  {  /* entry idx, value */ 25, VALUE_OPT_USER,
+     /* equiv idx, value */ 25, VALUE_OPT_USER,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ USER_FLAGS, 0,
@@ -793,8 +823,8 @@
      /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 25, VALUE_OPT_UPDATEINTERVAL,
-     /* equiv idx, value */ 25, VALUE_OPT_UPDATEINTERVAL,
+  {  /* entry idx, value */ 26, VALUE_OPT_UPDATEINTERVAL,
+     /* equiv idx, value */ 26, VALUE_OPT_UPDATEINTERVAL,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ UPDATEINTERVAL_FLAGS, 0,
@@ -805,8 +835,8 @@
      /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 26, VALUE_OPT_VAR,
-     /* equiv idx, value */ 26, VALUE_OPT_VAR,
+  {  /* entry idx, value */ 27, VALUE_OPT_VAR,
+     /* equiv idx, value */ 27, VALUE_OPT_VAR,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, NOLIMIT, 0,
      /* opt state flags  */ VAR_FLAGS, 0,
@@ -817,8 +847,8 @@
      /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 27, VALUE_OPT_DVAR,
-     /* equiv idx, value */ 27, VALUE_OPT_DVAR,
+  {  /* entry idx, value */ 28, VALUE_OPT_DVAR,
+     /* equiv idx, value */ 28, VALUE_OPT_DVAR,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, NOLIMIT, 0,
      /* opt state flags  */ DVAR_FLAGS, 0,
@@ -829,8 +859,8 @@
      /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 28, VALUE_OPT_SLEW,
-     /* equiv idx, value */ 28, VALUE_OPT_SLEW,
+  {  /* entry idx, value */ 29, VALUE_OPT_SLEW,
+     /* equiv idx, value */ 29, VALUE_OPT_SLEW,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ SLEW_FLAGS, 0,
@@ -967,7 +997,7 @@
       NO_EQUIVALENT, /* '-#' option index */
       NO_EQUIVALENT /* index of default opt */
     },
-    34 /* full option count */, 31 /* user option count */,
+    35 /* full option count */, 32 /* user option count */,
     ntpd_full_usage, ntpd_short_usage,
     NULL, NULL
 };
--- ntpd/ntpd.c.orig	Wed Aug 12 04:07:05 2009
+++ ntpd/ntpd.c	Thu Jul 29 09:48:44 2010
@@ -166,7 +166,7 @@
  * after we have synched the first time. If the attempt fails, then try again once per 
  * minute for up to 5 times. After all, we may be starting before mDNS.
  */
-int mdnsreg = 1;
+int mdnsreg = 0;
 int mdnstries = 5;
 #endif  /* HAVE_DNSREGISTRATION */
 
@@ -540,6 +540,9 @@
 	if (HAVE_OPT( NOVIRTUALIPS ))
 		listen_to_virtual_ips = 0;
 
+	if (HAVE_OPT( MDNS ))
+		mdnsreg = 1;
+
 	/*
 	 * Limit specific interfaces
 	 */
--- ntpd/ntpd-opts.h.orig	Wed Aug 12 04:42:23 2009
+++ ntpd/ntpd-opts.h	Thu Jul 29 09:39:13 2010
@@ -67,28 +67,29 @@
     INDEX_OPT_KEYFILE           = 12,
     INDEX_OPT_LOGFILE           = 13,
     INDEX_OPT_NOVIRTUALIPS      = 14,
-    INDEX_OPT_MODIFYMMTIMER     = 15,
-    INDEX_OPT_NOFORK            = 16,
-    INDEX_OPT_NICE              = 17,
-    INDEX_OPT_PIDFILE           = 18,
-    INDEX_OPT_PRIORITY          = 19,
-    INDEX_OPT_QUIT              = 20,
-    INDEX_OPT_PROPAGATIONDELAY  = 21,
-    INDEX_OPT_STATSDIR          = 22,
-    INDEX_OPT_TRUSTEDKEY        = 23,
-    INDEX_OPT_USER              = 24,
-    INDEX_OPT_UPDATEINTERVAL    = 25,
-    INDEX_OPT_VAR               = 26,
-    INDEX_OPT_DVAR              = 27,
-    INDEX_OPT_SLEW              = 28,
-    INDEX_OPT_USEPCC            = 29,
-    INDEX_OPT_PCCFREQ           = 30,
-    INDEX_OPT_VERSION           = 31,
-    INDEX_OPT_HELP              = 32,
-    INDEX_OPT_MORE_HELP         = 33
+    INDEX_OPT_MDNS              = 15,
+    INDEX_OPT_MODIFYMMTIMER     = 16,
+    INDEX_OPT_NOFORK            = 17,
+    INDEX_OPT_NICE              = 18,
+    INDEX_OPT_PIDFILE           = 19,
+    INDEX_OPT_PRIORITY          = 20,
+    INDEX_OPT_QUIT              = 21,
+    INDEX_OPT_PROPAGATIONDELAY  = 22,
+    INDEX_OPT_STATSDIR          = 23,
+    INDEX_OPT_TRUSTEDKEY        = 24,
+    INDEX_OPT_USER              = 25,
+    INDEX_OPT_UPDATEINTERVAL    = 26,
+    INDEX_OPT_VAR               = 27,
+    INDEX_OPT_DVAR              = 28,
+    INDEX_OPT_SLEW              = 29,
+    INDEX_OPT_USEPCC            = 30,
+    INDEX_OPT_PCCFREQ           = 31,
+    INDEX_OPT_VERSION           = 32,
+    INDEX_OPT_HELP              = 33,
+    INDEX_OPT_MORE_HELP         = 34
 } teOptIndex;
 
-#define OPTION_CT    34
+#define OPTION_CT    35
 #define NTPD_VERSION       "4.2.5p200"
 #define NTPD_FULL_VERSION  "ntpd - NTP daemon program - Ver. 4.2.5p200"
 
@@ -177,6 +178,10 @@
 #  warning undefining NOVIRTUALIPS due to option name conflict
 #  undef   NOVIRTUALIPS
 # endif
+# ifdef    MDNS
+#  warning undefining MDNS due to option name conflict
+#  undef   MDNS
+# endif
 # ifdef    MODIFYMMTIMER
 #  warning undefining MODIFYMMTIMER due to option name conflict
 #  undef   MODIFYMMTIMER
@@ -257,6 +262,7 @@
 # undef KEYFILE
 # undef LOGFILE
 # undef NOVIRTUALIPS
+# undef MDNS
 # undef MODIFYMMTIMER
 # undef NOFORK
 # undef NICE
@@ -302,6 +308,9 @@
 #define VALUE_OPT_KEYFILE        'k'
 #define VALUE_OPT_LOGFILE        'l'
 #define VALUE_OPT_NOVIRTUALIPS   'L'
+#ifdef HAVE_DNSREGISTRATION
+#define VALUE_OPT_MDNS           'm'
+#endif /* HAVE_DNSREGISTRATION */
 #ifdef SYS_WINNT
 #define VALUE_OPT_MODIFYMMTIMER  'M'
 #endif /* SYS_WINNT */
@@ -319,8 +328,8 @@
 #endif /* HAVE_DROPROOT */
 #define VALUE_OPT_UPDATEINTERVAL 'U'
 #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
-#define VALUE_OPT_VAR            26
-#define VALUE_OPT_DVAR           27
+#define VALUE_OPT_VAR            27
+#define VALUE_OPT_DVAR           28
 #define VALUE_OPT_SLEW           'x'
 #ifdef SYS_WINNT
 #define VALUE_OPT_USEPCC         29