]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/collectd/silence-openvpn-errors.patch
Merge remote-tracking branch 'earl/tor' into next
[ipfire-2.x.git] / src / patches / collectd / silence-openvpn-errors.patch
1 diff --git a/src/openvpn.c b/src/openvpn.c
2 index d446e9957b68..ef5bf1078285 100644
3 --- a/src/openvpn.c
4 +++ b/src/openvpn.c
5 @@ -70,6 +70,7 @@ static const char *config_keys[] =
6 };
7 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
8
9 +static int version_detect (const char *filename);
10
11 /* Helper function
12 * copy-n-pasted from common.c - changed delim to "," */
13 @@ -540,6 +541,11 @@ static int openvpn_read (void)
14 continue;
15 }
16
17 + // If the version was not detected yet, we try to guess again
18 + if (vpn_list[i]->version == 0) {
19 + vpn_list[i]->version = version_detect(vpn_list[i]->file);
20 + }
21 +
22 switch (vpn_list[i]->version)
23 {
24 case SINGLE:
25 @@ -567,7 +573,7 @@ static int openvpn_read (void)
26 read += vpn_read;
27 }
28
29 - return (read ? 0 : -1);
30 + return 0;
31 } /* int openvpn_read */
32
33 static int version_detect (const char *filename)
34 @@ -630,16 +636,6 @@ static int version_detect (const char *filename)
35 }
36 }
37
38 - if (version == 0)
39 - {
40 - /* This is only reached during configuration, so complaining to
41 - * the user is in order. */
42 - NOTICE ("openvpn plugin: %s: Unknown file format, please "
43 - "report this as bug. Make sure to include "
44 - "your status file, so the plugin can "
45 - "be adapted.", filename);
46 - }
47 -
48 fclose (fh);
49
50 return version;
51 @@ -656,13 +652,6 @@ static int openvpn_config (const char *key, const char *value)
52 /* try to detect the status file format */
53 status_version = version_detect (value);
54
55 - if (status_version == 0)
56 - {
57 - WARNING ("openvpn plugin: unable to detect status version, \
58 - discarding status file \"%s\".", value);
59 - return (1);
60 - }
61 -
62 status_file = sstrdup (value);
63 if (status_file == NULL)
64 {