summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2009-10-24 14:10:41 +0000
committerStef Walter <stef@memberwebs.com>2009-10-24 14:10:41 +0000
commit0af1b01b5ca61422c779b40a9c99cd0b29b40049 (patch)
tree26374207ac7df32b16332090328cd1a99ddeff4f /tools
parent54c751ffc4f79dcd916b4dffe690f59615c7146d (diff)
Support for multiple local sockets (ie: INET + INET6)
* Allows us to make ipv6 queries.
Diffstat (limited to 'tools')
-rw-r--r--tools/rrdbot-get.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/rrdbot-get.c b/tools/rrdbot-get.c
index 46219d9..27c8b75 100644
--- a/tools/rrdbot-get.c
+++ b/tools/rrdbot-get.c
@@ -426,6 +426,8 @@ int
main (int argc, char* argv[])
{
char *bind_address = NULL;
+ const char **local = NULL;
+ int n_local = 0;
char ch;
char* t;
@@ -460,7 +462,9 @@ main (int argc, char* argv[])
/* local source address */
case 's':
- bind_address = optarg;
+ local = xrealloc (local, sizeof (char*) * (n_local + 2));
+ local[n_local] = optarg;
+ local[++n_local] = NULL;
break;
/* The timeout */
@@ -495,8 +499,23 @@ main (int argc, char* argv[])
if(argc != 1)
usage ();
+ /* No bind addresses specified, use defaults... */
+ if (local == NULL) {
+ local = xrealloc (local, sizeof (char*) * 3);
+ local[0] = "0.0.0.0";
+ local[1] = NULL;
+#ifdef HAVE_INET6
+ local[1] = "::";
+ local[2] = NULL;
+#endif
+ }
+
server_init ();
- snmp_engine_init (bind_address, MAX_RETRIES);
+ snmp_engine_init (local, MAX_RETRIES);
+
+ free (local);
+ n_local = 0;
+ local = NULL;
parse_argument (argv[0]);