aboutsummaryrefslogtreecommitdiff
path: root/src/ban.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-11-27 00:47:17 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-11-27 00:47:17 +0200
commit4090bd6ff268036b5fd1fdb0fe6d344fd25b5198 (patch)
treef75281343a2ec3be4061acf02fca828a901dc65c /src/ban.c
parent039fcda402493c6083a219dd6df8b8c6078d2390 (diff)
downloadvarnish-mib-4090bd6ff268036b5fd1fdb0fe6d344fd25b5198.tar.gz
varnish-mib-4090bd6ff268036b5fd1fdb0fe6d344fd25b5198.tar.bz2
Make varnish CLI timeout configurable.
* src/ban.c (varnish_mib_timeout_parser): New function. * src/varnish_mib.mib2c (varnish_mib_timeout_parser): New proto. (init_$modulename): Register config handler for varnishCLIPortTimeout. * src/vcli.c (vcli_timeout): Change type to unsigned. (varnish_vcli_timeout_parser): New function. * src/varnish-mib.8: Update.
Diffstat (limited to 'src/ban.c')
-rw-r--r--src/ban.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ban.c b/src/ban.c
index 4648f59..72aa506 100644
--- a/src/ban.c
+++ b/src/ban.c
@@ -64,8 +64,8 @@ varnish_ban(netsnmp_agent_request_info *reqinfo,
unsigned banTable_timeout = 60;
-void
-varnish_ban_table_timeout_parser(const char *token, char *line)
+int
+varnish_mib_timeout_parser(const char *token, char *line, unsigned *retval)
{
char *p;
unsigned long n = strtoul(line, &p, 10);
@@ -76,20 +76,27 @@ varnish_ban_table_timeout_parser(const char *token, char *line)
++p;
if (*p) {
config_perror("too many arguments");
- return;
+ return 1;
}
} else {
config_perror("invalid timeout value");
- return;
+ return 1;
}
}
if (n > UINT_MAX) {
config_perror("timeout value out of allowed range");
- return;
+ return 1;
}
- banTable_timeout = n;
+ *retval = n;
+ return 0;
+}
+
+void
+varnish_ban_table_timeout_parser(const char *token, char *line)
+{
+ varnish_mib_timeout_parser(token, line, &banTable_timeout);
}
int
@@ -100,7 +107,7 @@ varnish_ban_table_timeout_set(netsnmp_agent_request_info *reqinfo,
if (*requests->requestvb->val.integer < 0 ||
*requests->requestvb->val.integer > UINT_MAX)
return SNMP_ERR_BADVALUE;
- DEBUGMSGTL(("varnish_ban", "setting banTable timeould %ld\n",
+ DEBUGMSGTL(("varnish_ban", "setting banTable timeout %ld\n",
*requests->requestvb->val.integer));
banTable_timeout = *requests->requestvb->val.integer;
return SNMP_ERR_NOERROR;

Return to:

Send suggestions and report system problems to the System administrator.