]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1512] ntpsnmpd should connect to net-snmpd via a unix-domain socket by default...
authorHarlan Stenn <stenn@ntp.org>
Fri, 30 Apr 2010 09:03:12 +0000 (09:03 +0000)
committerHarlan Stenn <stenn@ntp.org>
Fri, 30 Apr 2010 09:03:12 +0000 (09:03 +0000)
bk: 4bda9cd0JPGKzNo86sMh8ZGbHjPM1Q

ChangeLog
ntpsnmpd/ntpsnmpd-opts.c
ntpsnmpd/ntpsnmpd-opts.def
ntpsnmpd/ntpsnmpd-opts.h
ntpsnmpd/ntpsnmpd-opts.texi
ntpsnmpd/ntpsnmpd.1
ntpsnmpd/ntpsnmpd.c

index eb93b075c0c0765c1941b684ee6c56bb4f4616f7..5fdd59380f362c278da40bf0b28b56292cf16981 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 ---
 
+* [Bug 1512] ntpsnmpd should connect to net-snmpd via a unix-domain
+  socket by default.  Provide a command-line 'socket name' option.
 * [Bug 1538] update refclock_nmea.c's call to getprotobyname().
 
 ---
index 232494203afe6bf17fee844ad49ea2acb8b3a591..6b101b2a5c9a2d17e415912a35dfbc5330b34229 100644 (file)
@@ -1,7 +1,7 @@
 /*  
  *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.c)
  *  
- *  It has been AutoGen-ed  April 27, 2010 at 02:52:13 AM by AutoGen 5.10
+ *  It has been AutoGen-ed  April 29, 2010 at 07:33:02 AM by AutoGen 5.10
  *  From the definitions    ntpsnmpd-opts.def
  *  and the template file   options
  *
@@ -75,6 +75,17 @@ tSCC    zSyslog_NAME[]             = "SYSLOG";
 tSCC    zSyslog_Name[]             = "syslog";
 #define SYSLOG_FLAGS       (OPTST_DISABLED)
 
+/*
+ *  Agentxsocket option description:
+ */
+tSCC    zAgentxsocketText[] =
+        "The socket address ntpsnmpd uses to connect to net-snmpd";
+tSCC    zAgentxsocket_NAME[]       = "AGENTXSOCKET";
+tSCC    zAgentxsocket_Name[]       = "agentxsocket";
+tSCC    zAgentxsocketDefaultArg[]    = "unix:/var/agentx/master";
+#define AGENTXSOCKET_FLAGS       (OPTST_DISABLED \
+        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
 /*
  *  Help/More_Help/Version option descriptions:
  */
@@ -162,6 +173,18 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zSyslogText, zSyslog_NAME, zSyslog_Name,
      /* disablement strs */ NULL, NULL },
 
+  {  /* entry idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
+     /* equiv idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
+     /* equivalenced to  */ NO_EQUIVALENT,
+     /* min, max, act ct */ 0, 1, 0,
+     /* opt state flags  */ AGENTXSOCKET_FLAGS, 0,
+     /* last opt argumnt */ { zAgentxsocketDefaultArg },
+     /* arg list/cookie  */ NULL,
+     /* must/cannot opts */ NULL, NULL,
+     /* option proc      */ NULL,
+     /* desc, NAME, name */ zAgentxsocketText, zAgentxsocket_NAME, zAgentxsocket_Name,
+     /* disablement strs */ NULL, NULL },
+
   {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
      /* equiv idx value  */ NO_EQUIVALENT, 0,
      /* equivalenced to  */ NO_EQUIVALENT,
@@ -234,7 +257,7 @@ static tOptDesc optDesc[ OPTION_CT ] = {
 tSCC   zPROGNAME[]   = "NTPSNMPD";
 tSCC   zUsageTitle[] =
 "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.6p2-RC2\n\
-USAGE:  %s [ -<flag> | --<name> ]...\n";
+USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {
        "$HOME",
@@ -245,7 +268,7 @@ tSCC   zBugsAddr[]    = "http://bugs.ntp.org, bugs@ntp.org";
 #define zExplain NULL
 #define zDetail         NULL
 tSCC    zFullVersion[] = NTPSNMPD_FULL_VERSION;
-/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 495 */
+/* extracted from /usr/local/share/autogen/optcode.tpl near line 495 */
 
 #if defined(ENABLE_NLS)
 # define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -285,7 +308,7 @@ tOptions ntpsnmpdOptions = {
       NO_EQUIVALENT, /* '-#' option index */
       NO_EQUIVALENT /* index of default opt */
     },
-    7 /* full option count */, 2 /* user option count */,
+    8 /* full option count */, 3 /* user option count */,
     ntpsnmpd_full_usage, ntpsnmpd_short_usage,
     NULL, NULL
 };
@@ -301,7 +324,7 @@ doUsageOpt(
     (void)pOptions;
     USAGE( EXIT_SUCCESS );
 }
-/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */
+/* extracted from /usr/local/share/autogen/optmain.tpl near line 109 */
 
 #if defined(TEST_NTPSNMPD_OPTS) /* TEST MAIN PROCEDURE: */
 
@@ -316,7 +339,7 @@ main(int argc, char** argv)
     return res;
 }
 #endif  /* defined TEST_NTPSNMPD_OPTS */
-/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 627 */
+/* extracted from /usr/local/share/autogen/optcode.tpl near line 627 */
 
 #if ENABLE_NLS
 #include <stdio.h>
index 04bb7792ccb6a514dd491c8ac5296d003621612c..7145f6347d7b42dba7f876e58d262f06919e0fcc 100644 (file)
@@ -26,3 +26,15 @@ flag = {
     doc = <<-  _EndOfDoc_
        _EndOfDoc_;
 };
+
+flag = {
+    name      = agentXSocket;
+/*  value     = x; */
+    arg-type  = string;
+    arg-default = "unix:/var/agentx/master";
+    descrip   = "The socket address ntpsnmpd uses to connect to net-snmpd";
+    doc = <<-  _EndOfDoc_
+       [<transport-specifier>:]<transport-address>
+       The default is the Unix Domain socket "unix:/var/agentx/master". Another common alternative is tcp:localhost:705.
+       _EndOfDoc_;
+};
index b73f33943c95e005775b528ff67f45b8efecc910..c03596d528eebf37eede40d4e8f1120991dfe3ab 100644 (file)
@@ -1,7 +1,7 @@
 /*  
  *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.h)
  *  
- *  It has been AutoGen-ed  April 27, 2010 at 02:52:13 AM by AutoGen 5.10
+ *  It has been AutoGen-ed  April 29, 2010 at 07:33:02 AM by AutoGen 5.10
  *  From the definitions    ntpsnmpd-opts.def
  *  and the template file   options
  *
  *  Enumeration of each option:
  */
 typedef enum {
-    INDEX_OPT_NOFORK      =  0,
-    INDEX_OPT_SYSLOG      =  1,
-    INDEX_OPT_VERSION     =  2,
-    INDEX_OPT_HELP        =  3,
-    INDEX_OPT_MORE_HELP   =  4,
-    INDEX_OPT_SAVE_OPTS   =  5,
-    INDEX_OPT_LOAD_OPTS   =  6
+    INDEX_OPT_NOFORK        =  0,
+    INDEX_OPT_SYSLOG        =  1,
+    INDEX_OPT_AGENTXSOCKET  =  2,
+    INDEX_OPT_VERSION       =  3,
+    INDEX_OPT_HELP          =  4,
+    INDEX_OPT_MORE_HELP     =  5,
+    INDEX_OPT_SAVE_OPTS     =  6,
+    INDEX_OPT_LOAD_OPTS     =  7
 } teOptIndex;
 
-#define OPTION_CT    7
+#define OPTION_CT    8
 #define NTPSNMPD_VERSION       "4.2.6p2-RC2"
 #define NTPSNMPD_FULL_VERSION  "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.6p2-RC2"
 
@@ -98,9 +99,14 @@ typedef enum {
 #  warning undefining SYSLOG due to option name conflict
 #  undef   SYSLOG
 # endif
+# ifdef    AGENTXSOCKET
+#  warning undefining AGENTXSOCKET due to option name conflict
+#  undef   AGENTXSOCKET
+# endif
 #else  /* NO_OPTION_NAME_WARNINGS */
 # undef NOFORK
 # undef SYSLOG
+# undef AGENTXSOCKET
 #endif  /*  NO_OPTION_NAME_WARNINGS */
 
 /* * * * * *
@@ -109,6 +115,7 @@ typedef enum {
  */
 #define VALUE_OPT_NOFORK         'n'
 #define VALUE_OPT_SYSLOG         'p'
+#define VALUE_OPT_AGENTXSOCKET   2
 #define VALUE_OPT_HELP          '?'
 #define VALUE_OPT_MORE_HELP     '!'
 #define VALUE_OPT_VERSION       INDEX_OPT_VERSION
@@ -128,7 +135,7 @@ typedef enum {
                 ntpsnmpdOptions.pzCurOpt  = NULL )
 #define START_OPT       RESTART_OPT(1)
 #define USAGE(c)        (*ntpsnmpdOptions.pUsageProc)( &ntpsnmpdOptions, c )
-/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */
+/* extracted from /usr/local/share/autogen/opthead.tpl near line 409 */
 
 /* * * * * *
  *
index 2c1c80173e419144ad4b94edf5d8053092846758..895c9ff61d766179b36ab06fb008ce2edc556313 100644 (file)
@@ -6,7 +6,7 @@
 # 
 # EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.texi)
 # 
-# It has been AutoGen-ed  April 27, 2010 at 02:52:14 AM by AutoGen 5.10
+# It has been AutoGen-ed  April 29, 2010 at 07:33:08 AM by AutoGen 5.10
 # From the definitions    ntpsnmpd-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -21,6 +21,7 @@ This software is released under a specialized copyright license.
 
 @menu
 * ntpsnmpd usage::                  ntpsnmpd usage help (-?)
+* ntpsnmpd agentxsocket::           agentxsocket option
 * ntpsnmpd nofork::                 nofork option (-n)
 * ntpsnmpd syslog::                 syslog option (-p)
 @end menu
@@ -33,7 +34,29 @@ This is the automatically generated usage text for ntpsnmpd:
 
 @exampleindent 0
 @example
-ntpsnmpd is unavailable - no --help
+ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.6p2-RC2
+USAGE:  ntpsnmpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
+  Flg Arg Option-Name    Description
+   -n no  nofork         Do not fork
+   -p no  syslog         Log to syslog()
+      Str agentxsocket   The socket address ntpsnmpd uses to connect to net-snmpd
+      opt version        Output version information and exit
+   -? no  help           Display extended usage information and exit
+   -! no  more-help      Extended usage information passed thru pager
+   -> opt save-opts      Save the option state to a config file
+   -< Str load-opts      Load options from a config file
+                                - disabled as --no-load-opts
+                                - may appear multiple times
+
+Options are specified by doubled hyphens and their name
+or by a single hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file /a/etc/amd.stage/thump2-g3/export/ntp/home/stenn/.ntprc
+ - reading file /a/etc/amd.stage/thump2-g3/export/ntp/home/stenn/ntp-stable-1512-38/ntpsnmpd/.ntprc
+ - examining environment variables named NTPSNMPD_*
+
+please send bug reports to:  http://bugs.ntp.org, bugs@@ntp.org
 @end example
 @exampleindent 4
 
@@ -50,3 +73,11 @@ This is the ``do not fork'' option.
 
 This is the ``log to syslog()'' option.
 
+
+@node ntpsnmpd agentxsocket
+@subsection agentxsocket option
+@cindex ntpsnmpd-agentxsocket
+
+This is the ``the socket address ntpsnmpd uses to connect to net-snmpd'' option.
+[<transport-specifier>:]<transport-address>
+The default is the Unix Domain socket "unix:/var/agentx/master". Another common alternative is tcp:localhost:705.
index be51732208c7942103b0acf4e8f41ab928e887e9..128037148c57b861a04237084f2dac3b04ef1bf7 100644 (file)
@@ -1,7 +1,7 @@
-.TH NTPSNMPD 1 2010-04-27 "( 4.2.6p2-RC2)" "Programmer's Manual"
+.TH NTPSNMPD 1 2010-04-29 "( 4.2.6p2-RC2)" "Programmer's Manual"
 .\"  EDIT THIS FILE WITH CAUTION  (ntpsnmpd.1)
 .\"  
-.\"  It has been AutoGen-ed  April 27, 2010 at 02:52:14 AM by AutoGen 5.10
+.\"  It has been AutoGen-ed  April 29, 2010 at 07:33:08 AM by AutoGen 5.10
 .\"  From the definitions    ntpsnmpd-opts.def
 .\"  and the template file   agman1.tpl
 .\"
@@ -27,6 +27,15 @@ Do not fork.
 Log to syslog().
 .sp
 
+.TP
+.BR \--agentxsocket "=\fIstring\fP"
+The socket address ntpsnmpd uses to connect to net-snmpd.
+The default \fIstring\fP for this option is:
+.ti +4
+ unix:/var/agentx/master
+.sp
+[<transport-specifier>:]<transport-address>
+The default is the Unix Domain socket "unix:/var/agentx/master". Another common alternative is tcp:localhost:705.
 .TP
 .BR \-? , " \--help"
 Display extended usage information and exit.
index 449631b47c1288dc4fe6b24ac1de95635f4f5eff..194080783623864989c2f6745046aa06d3ceb037 100644 (file)
@@ -91,7 +91,7 @@ main (int argc, char **argv) {
 
   /* Set AgentX socket interface */
   netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
-                            NETSNMP_DS_AGENT_X_SOCKET, "tcp:localhost:705");
+                            NETSNMP_DS_AGENT_X_SOCKET, OPT_ARG( AGENTXSOCKET ));
 
   init_agent("ntpsnmpd");