summaryrefslogtreecommitdiffstats
path: root/web/attachments/221749-check_snmp_sourceip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/221749-check_snmp_sourceip.patch')
-rw-r--r--web/attachments/221749-check_snmp_sourceip.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/web/attachments/221749-check_snmp_sourceip.patch b/web/attachments/221749-check_snmp_sourceip.patch
new file mode 100644
index 0000000..2bba2f4
--- /dev/null
+++ b/web/attachments/221749-check_snmp_sourceip.patch
@@ -0,0 +1,78 @@
1--- check_snmp.c.orig 2007-03-22 15:24:22.000000000 +0100
2+++ check_snmp.c 2007-03-22 15:23:00.000000000 +0100
3@@ -103,6 +103,7 @@
4 int errcode, excode;
5
6 char *server_address = NULL;
7+char *client_address = NULL;
8 char *community = NULL;
9 char *authpriv = NULL;
10 char *proto = NULL;
11@@ -183,11 +184,22 @@
12
13 /* create the command line to execute */
14 if(usesnmpgetnext == TRUE) {
15+ if (client_address != NULL)
16+ asprintf(&command_line, "%s --clientaddr=%s -t %d -r %d -m %s -v %s %s %s:%s %s",
17+ PATH_TO_SNMPGETNEXT, client_address, timeout_interval, retries, miblist, proto,
18+ authpriv, server_address, port, oid);
19+ if (client_address == NULL)
20 asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
21 PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
22 authpriv, server_address, port, oid);
23 }else{
24
25+ if (client_address != NULL)
26+ asprintf (&command_line, "%s --clientaddr=%s -t %d -r %d -m %s -v %s %s %s:%s %s",
27+ PATH_TO_SNMPGET, client_address, timeout_interval, retries, miblist, proto,
28+ authpriv, server_address, port, oid);
29+
30+ if (client_address == NULL)
31 asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
32 PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
33 authpriv, server_address, port, oid);
34@@ -398,6 +410,7 @@
35 static struct option longopts[] = {
36 STD_LONG_OPTS,
37 {"community", required_argument, 0, 'C'},
38+ {"source", required_argument, 0, 'S'},
39 {"oid", required_argument, 0, 'o'},
40 {"object", required_argument, 0, 'o'},
41 {"delimiter", required_argument, 0, 'd'},
42@@ -436,7 +449,7 @@
43 }
44
45 while (1) {
46- c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:",
47+ c = getopt_long (argc, argv, "nhvVt:c:w:H:S:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:",
48 longopts, &option);
49
50 if (c == -1 || c == EOF)
51@@ -462,6 +475,9 @@
52 case 'H': /* Host or server */
53 server_address = optarg;
54 break;
55+ case 'S': /* Client source address */
56+ client_address = optarg;
57+ break;
58 case 'p': /* TCP port number */
59 port = optarg;
60 break;
61@@ -919,6 +935,8 @@
62 /* SNMP and Authentication Protocol */
63 printf (" %s\n", "-n, --next");
64 printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
65+ printf (" %s\n", "-S, --source=ADDRESS");
66+ printf (" %s\n", _("Specify SNMP client source address"));
67 printf (" %s\n", "-P, --protocol=[1|2c|3]");
68 printf (" %s\n", _("SNMP protocol version"));
69 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
70@@ -1005,7 +1023,7 @@
71 print_usage (void)
72 {
73 printf (_("Usage:"));
74- printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
75+ printf ("%s -H <ip_address> -o <OID> [-S source_ip_address] [-w warn_range] [-c crit_range]\n",progname);
76 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
77 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
78 printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n");