diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-02-02 16:22:48 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-02-02 16:22:48 +0200 |
commit | 620585d1fb7376eaa5a78bd1de44cf9483975b7d (patch) | |
tree | 13046ca443fbc9d45588216670dd1874f46017aa | |
parent | 78e306ee5b588c86d51f7880908cf8031da13445 (diff) | |
download | varnish-mib-620585d1fb7376eaa5a78bd1de44cf9483975b7d.tar.gz varnish-mib-620585d1fb7376eaa5a78bd1de44cf9483975b7d.tar.bz2 |
Don't exit if unable to open Varnish memory file
* NEWS: Update.
* configure.ac: Version 1.0.90
* src/ban.c (banTable_load): Check if vd is available.
* src/betab.c: Likewise.
* src/varnish_mib.mib2c (varnish_snmp_init): Don't open vd right now.
* Makefile.am: Update copyright year.
* README: Update copyright year.
* git2chg.awk: Update copyright year.
* src/Makefile.am: Update copyright year.
* src/auth.c: Update copyright year.
* src/varnish-mib.8: Update copyright year.
* src/vcli.c: Update copyright year.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | git2chg.awk | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/auth.c | 2 | ||||
-rw-r--r-- | src/ban.c | 6 | ||||
-rw-r--r-- | src/betab.c | 5 | ||||
-rw-r--r-- | src/varnish-mib.8 | 2 | ||||
-rw-r--r-- | src/varnish_mib.mib2c | 14 | ||||
-rw-r--r-- | src/vcli.c | 2 |
12 files changed, 29 insertions, 25 deletions
diff --git a/Makefile.am b/Makefile.am index 9f585f9..0334f01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,14 @@ # This file is part of varnish-mib -*- automake -*- -# Copyright (C) 2014 Sergey Poznyakoff +# Copyright (C) 2014-2015 Sergey Poznyakoff # # varnish-mib is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # varnish-mib is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License @@ -1,26 +1,31 @@ -Varnish-mib NEWS -- history of user-visible changes. 2014-11-28 -Copyright (C) 2014 Sergey Poznyakoff +Varnish-mib NEWS -- history of user-visible changes. 2015-02-02 +Copyright (C) 2014-2015 Sergey Poznyakoff See the end of file for copying conditions. Please send Varnish-mib bug reports to <gray@gnu.org> +Version 1.0.90 (Git) + +* Don't exit if unable to open Varnish memory file + + Version 1.0, 2014-11-28 Initial release. * Copyright information: -Copyright (C) 2014 Sergey Poznyakoff +Copyright (C) 2014-2015 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the copyright notice and this permission notice are preserved, thus giving the recipient permission to redistribute in turn. Permission is granted to distribute modified versions of this document, or of portions of it, under the above conditions, provided also that they carry prominent notices stating who last changed them. Local variables: @@ -1,14 +1,14 @@ Varnish-mib README -Copyright (C) 2014 Sergey Poznyakoff +Copyright (C) 2014-2015 Sergey Poznyakoff See the end of file for copying conditions. * Introduction This file contains brief information about configuring, testing and using Varnish-mib. It is *not* intended as a replacement for the documentation, and is provided as a brief reference only. For a detailed documentation, please see the varnish-mib(8) manpage. * Overview diff --git a/configure.ac b/configure.ac index 9b4d998..b5d6636 100644 --- a/configure.ac +++ b/configure.ac @@ -1,30 +1,30 @@ # This file is part of Varnish-mib -*- autoconf -*- -# Copyright (C) 2014 Sergey Poznyakoff +# Copyright (C) 2014-2015 Sergey Poznyakoff # # Varnish-mib is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Varnish-mib is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([varnish-mib], 1.0, [gray@gnu.org]) +AC_INIT([varnish-mib], 1.0.90, [gray@gnu.org]) AC_CONFIG_SRCDIR(src/varnish_mib.mib2c) AM_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_SYSTEM AC_LANG(C) AM_INIT_AUTOMAKE([gnu tar-ustar]) AC_GNU_SOURCE AC_PROG_CC AC_PROG_CC_STDC diff --git a/git2chg.awk b/git2chg.awk index 6dad87e..e5dbe15 100644 --- a/git2chg.awk +++ b/git2chg.awk @@ -1,14 +1,14 @@ # This file is part of grecs -# Copyright (C) 2007-2014 Sergey Poznyakoff +# Copyright (C) 2007-2015 Sergey Poznyakoff # # Grecs is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Grecs is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License diff --git a/src/Makefile.am b/src/Makefile.am index a10abd1..3c066f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,14 +1,14 @@ # This file is part of varnish-mib -*- automake -*- -# Copyright (C) 2014 Sergey Poznyakoff +# Copyright (C) 2014-2015 Sergey Poznyakoff # # varnish-mib is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # varnish-mib is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License @@ -1,14 +1,14 @@ /* This file is part of varnish-mib -*- c -*- - Copyright (C) 2014 Sergey Poznyakoff + Copyright (C) 2014-2015 Sergey Poznyakoff Varnish-mib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Varnish-mib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License @@ -1,14 +1,14 @@ /* This file is part of varnish-mib -*- c -*- - Copyright (C) 2014 Sergey Poznyakoff + Copyright (C) 2014-2015 Sergey Poznyakoff Varnish-mib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Varnish-mib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License @@ -146,27 +146,29 @@ utc_offset (void) int banTable_load(netsnmp_cache *cache, void *vmagic) { netsnmp_tdata *table = (netsnmp_tdata *) vmagic; long idx = 0; int rc; struct vcli_conn conn; char *p; struct VSM_data *vd; DEBUGMSGTL(("varnish_ban", "reloading ban table\n")); vd = varnish_get_vsm_data(); + if (!vd) + return SNMP_ERR_NOSUCHNAME; rc = vcli_connect(vd, &conn); if (rc != SNMP_ERR_NOERROR) - return rc; + return rc; if (vcli_asprintf(&conn, "ban.list\n") || vcli_write(&conn)) return SNMP_ERR_GENERR; if (vcli_read_response(&conn)) return SNMP_ERR_GENERR; if (conn.resp != CLIS_OK) { snmp_log(LOG_ERR, "ban.list command rejected: %u %s\n", conn.resp, conn.base); return SNMP_ERR_GENERR; } diff --git a/src/betab.c b/src/betab.c index 41c18e7..b583958 100644 --- a/src/betab.c +++ b/src/betab.c @@ -214,27 +214,30 @@ create_entry_cb(void *priv, const struct VSC_point *const pt) } } return 0; } /* Varnish API does not provide access to struct VSC_C_vbe, so the only way to backend statistics is to iterate over all statistics data, selecting the entries marked as VBE. That's what this function does. */ int backendTable_load(netsnmp_cache *cache, void *vmagic) { - struct VSM_data *vd = varnish_get_vsm_data(); struct betab_priv bp; + struct VSM_data *vd = varnish_get_vsm_data(); + if (!vd) + return SNMP_ERR_NOSUCHNAME; + bp.idx = -1; bp.err = 0; bp.table = (netsnmp_tdata *) vmagic; memset(&bp.ent, 0, sizeof(bp.ent)); DEBUGMSGTL(("varnish_ban", "loading backend table\n")); VSC_Iter(vd, NULL, create_entry_cb, &bp); /* FIXME: perhaps handle bp.err separately */ if (bp.idx != -1) { DEBUGMSGTL(("varnish_ban", "loaded %lu backend entries\n", bp.idx + 1)); if (!create_entry(bp.table, bp.idx, &bp.ent)) diff --git a/src/varnish-mib.8 b/src/varnish-mib.8 index cc3276b..4559b0c 100644 --- a/src/varnish-mib.8 +++ b/src/varnish-mib.8 @@ -1,14 +1,14 @@ .\" This file is part of Varnish-mib -*- nroff -*- -.\" Copyright (C) 2014 Sergey Poznyakoff +.\" Copyright (C) 2014-2015 Sergey Poznyakoff .\" .\" Varnish-mib is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 3, or (at your option) .\" any later version. .\" .\" Varnish-mib is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c index ae344be..a5367e0 100644 --- a/src/varnish_mib.mib2c +++ b/src/varnish_mib.mib2c @@ -1,14 +1,14 @@ # This file is part of varnish-mib -*- c -*- -# Copyright (C) 2014 Sergey Poznyakoff +# Copyright (C) 2014-2015 Sergey Poznyakoff # # Varnish-mib is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Varnish-mib is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License @@ -189,27 +189,24 @@ void varnish_backend_table_timeout_parser(const char *token, char *line); @open ${name}@ /* THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT. */ #include "varnish_mib.h" static struct VSM_data *vd; void varnish_snmp_init(void) { vd = VSM_New(); - - if (VSM_Open(vd)) - exit(1); } void varnish_snmp_deinit(void) { VSM_Close(vd); } struct VSM_data * varnish_get_vsm_data() { if (VSM_Abandoned(vd)) { @@ -231,30 +228,27 @@ static int handle_$i(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { @if $i.settable@ int ret; @end@ @startperl@ &{$vars{'varnish_translate'}}($vars{'i'}); @endperl@ - - if (VSM_Abandoned(vd)) { - DEBUGMSGTL(("$modulename", "reopening vd\n")); - VSM_Close(vd); - VSM_Open(vd); - } + + if (!varnish_get_vsm_data()) + return SNMP_ERR_NOSUCHNAME; switch(reqinfo->mode) { case MODE_GET: @if $varnish_type eq 'MAIN'@ { struct VSC_C_main const *st = VSC_Main(vd, NULL); @if $i.type eq 'ASN_COUNTER64'@ struct counter64 ctr; if (!st) return SNMP_ERR_NOSUCHNAME; ctr.high = st->$varnish_member >> 32; ctr.low = st->$varnish_member & 0xffffffff; @@ -1,14 +1,14 @@ /* This file is part of varnish-mib -*- c -*- - Copyright (C) 2014 Sergey Poznyakoff + Copyright (C) 2014-2015 Sergey Poznyakoff Varnish-mib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Varnish-mib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License |