collectd.git
5 years agoSet static bools to true instead of 1
Ruben Kerkhof [Sun, 13 May 2018 17:05:33 +0000 (19:05 +0200)]
Set static bools to true instead of 1

5 years agoNo need to initialize static bools to false
Ruben Kerkhof [Sun, 13 May 2018 16:56:18 +0000 (18:56 +0200)]
No need to initialize static bools to false

5 years agoTreewide: use bool instead of _Bool
Ruben Kerkhof [Sun, 13 May 2018 16:35:29 +0000 (18:35 +0200)]
Treewide: use bool instead of _Bool

It's about time

5 years agowrite_sensu: use sstrncpy
Ruben Kerkhof [Sun, 13 May 2018 15:06:54 +0000 (17:06 +0200)]
write_sensu: use sstrncpy

Fixes:
  CC       src/write_sensu.lo
src/write_sensu.c: In function ‘replace_str’:
src/write_sensu.c:630:3: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
   strncpy(r, p, strlen(p));
   ^~~~~~~~~~~~~~~~~~~~~~~~
  CCLD     write_sensu.la

6 years agovirt: Remove unneeded info about thread id
Radoslaw Jablonski [Wed, 9 May 2018 11:48:57 +0000 (12:48 +0100)]
virt: Remove unneeded info about thread id

There is only one notification thread in virt plugin, therefore
information about ID is not needed.

Change-Id: I755f649711a815132927007a80a89caa98704f95
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agovirt: Add valgrind.suppress to EXTRA_DIST
Radoslaw Jablonski [Tue, 8 May 2018 14:09:50 +0000 (15:09 +0100)]
virt: Add valgrind.suppress to EXTRA_DIST

Previosusly newly added valgrind.suppress file was
missing during collectd archive creation using
'make dist-gzip' target.
Virt unit tests were failing on debian wheezy platform
without that file (because of unfiltered libnl v1 leaks).

Change-Id: I49543f883dd6dbeaef439c602b2f05ac0e977053
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agoMerge pull request #2767 from rpv-tomsk/tmpfix
Ruben Kerkhof [Mon, 7 May 2018 20:13:11 +0000 (22:13 +0200)]
Merge pull request #2767 from rpv-tomsk/tmpfix

netlink plugin: Handle new counter from Linux kernel version 4.6+.

6 years agonetlink plugin: Report `rx_nohandler` stats
Pavel Rochnyack [Mon, 7 May 2018 16:39:35 +0000 (23:39 +0700)]
netlink plugin: Report `rx_nohandler` stats

Added metric for new counter from Linux kernel version 4.6+.

Issue: #2510

6 years agonetlink plugin: Use of less strict rules in link_filter_cb()
Pavel Rochnyack [Mon, 7 May 2018 15:53:23 +0000 (22:53 +0700)]
netlink plugin: Use of less strict rules in link_filter_cb()

mnl_attr_validate2() function implements strict equality check of kernel and
userspace structures size. Additional counters was added to 4.6 Linux kernel,
sizes was changed and mismatch can occur.

This patch weakened validation.
Now Collectd just checks if structures, received from kernel space, has enough
data.

Closes: #2510

6 years agovirt unit tests: Add valgrind.suppress with libnl1 leak definition
Radoslaw Jablonski [Wed, 2 May 2018 07:48:34 +0000 (08:48 +0100)]
virt unit tests: Add valgrind.suppress with libnl1 leak definition

Libnl-1 is used by libvirt on older systems (e.g. debian wheezy)
and unfortunately it has memory leaks that cannot be fixed from
collectd side - virt unit tests were failing on platforms with
libnl1 because of those leaks.
Valgrind.suppress file is used to pass definitions for leaks that
cannot be fixed and now virt unit tests can be run without any
problems on every platform - memory leaks are still validated and
the only difference is that libnl1 leaks are ignored during
valgrind check.

Change-Id: I5fc423402f7b89e4e43fb896f73cba89eea36226
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agoUpdates for rpm spec and review feedback
Andrew Smith [Sun, 6 May 2018 18:00:03 +0000 (14:00 -0400)]
Updates for rpm spec and review feedback

6 years agoMerge pull request #2761 from dago/patch-3
Ruben Kerkhof [Thu, 3 May 2018 13:51:32 +0000 (15:51 +0200)]
Merge pull request #2761 from dago/patch-3

Add endianness checks for AIX

6 years agoAdd endianness checks for AIX
Dagobert Michelsen [Thu, 3 May 2018 10:42:28 +0000 (12:42 +0200)]
Add endianness checks for AIX

6 years agoMerge pull request #2755 from dehotot/debug-option-rpms
Ruben Kerkhof [Wed, 2 May 2018 15:19:10 +0000 (17:19 +0200)]
Merge pull request #2755 from dehotot/debug-option-rpms

Add ability to turn on collectd "debug" feature in RPMs

6 years agoaggregation plugin: modernize the code a bit
Ruben Kerkhof [Wed, 2 May 2018 13:26:43 +0000 (15:26 +0200)]
aggregation plugin: modernize the code a bit

6 years agoapache plugin: modernize the code a bit
Ruben Kerkhof [Wed, 2 May 2018 13:15:15 +0000 (15:15 +0200)]
apache plugin: modernize the code a bit

6 years agoRun clang-format on src/bind.c after my change
Ruben Kerkhof [Wed, 2 May 2018 12:21:14 +0000 (14:21 +0200)]
Run clang-format on src/bind.c after my change

6 years agobind plugin: modernize the code a bit
Ruben Kerkhof [Wed, 2 May 2018 12:19:07 +0000 (14:19 +0200)]
bind plugin: modernize the code a bit

6 years agowrite_tsdb: ansify function declaration
Ruben Kerkhof [Wed, 2 May 2018 11:17:13 +0000 (13:17 +0200)]
write_tsdb: ansify function declaration

6 years agoDo not hide prototype of check_capability()
Ruben Kerkhof [Wed, 2 May 2018 10:42:56 +0000 (12:42 +0200)]
Do not hide prototype of check_capability()

We have a fallback definition for if <sys/capability.h> is not found.
That definition needs a prototype.

Noticed while checking with sparse on Mac OS.

6 years agoMerge branch 'collectd-5.8'
Ruben Kerkhof [Wed, 2 May 2018 10:27:01 +0000 (12:27 +0200)]
Merge branch 'collectd-5.8'

Conflicts:
src/collectd.conf.pod

6 years agoconfigure.ac: return is not a function
Ruben Kerkhof [Wed, 2 May 2018 10:23:56 +0000 (12:23 +0200)]
configure.ac: return is not a function

6 years agonetwork_parse.c: ansify function definition
Ruben Kerkhof [Wed, 2 May 2018 10:17:13 +0000 (12:17 +0200)]
network_parse.c: ansify function definition

6 years agoMerge pull request #2691 from lilydjwg/master
Pavel Rochnyak [Tue, 1 May 2018 12:13:51 +0000 (19:13 +0700)]
Merge pull request #2691 from lilydjwg/master

ping plugin: support specifying the address family

6 years agoping plugin: doc: wrap long lines
lilydjwg [Tue, 1 May 2018 11:52:53 +0000 (19:52 +0800)]
ping plugin: doc: wrap long lines

6 years agoAuto-Merge pull request #2760 from rpv-tomsk/tmpfix
collectd bot [Tue, 1 May 2018 09:12:01 +0000 (11:12 +0200)]
Auto-Merge pull request #2760 from rpv-tomsk/tmpfix

Automatically merged due to "Automerge" label

6 years agoping plugin: warn on invalid AddressFamily value instead of error
lilydjwg [Tue, 1 May 2018 08:40:09 +0000 (16:40 +0800)]
ping plugin: warn on invalid AddressFamily value instead of error

6 years agodocs: Fix typo in collectd.conf.pod
Pavel Rochnyack [Tue, 1 May 2018 08:30:43 +0000 (15:30 +0700)]
docs: Fix typo in collectd.conf.pod

6 years agoFix typo in collectd.conf.pod
Pavel Rochnyack [Tue, 1 May 2018 08:26:36 +0000 (15:26 +0700)]
Fix typo in collectd.conf.pod

6 years agoping plugin: reformat
lilydjwg [Tue, 1 May 2018 07:14:26 +0000 (15:14 +0800)]
ping plugin: reformat

6 years agoping plugin: update docs for AddressFamily option
lilydjwg [Tue, 1 May 2018 06:52:44 +0000 (14:52 +0800)]
ping plugin: update docs for AddressFamily option

6 years agoping plugin: check AddressFamily option value in ping_config
lilydjwg [Tue, 1 May 2018 06:10:30 +0000 (14:10 +0800)]
ping plugin: check AddressFamily option value in ping_config

6 years agoAdd ability to turn on collectd "debug" feature in RPMs
Alex White [Fri, 27 Apr 2018 09:47:04 +0000 (10:47 +0100)]
Add ability to turn on collectd "debug" feature in RPMs

6 years agovirt: Add exit condition in notif-thread loop
Radoslaw Jablonski [Mon, 23 Apr 2018 06:32:35 +0000 (07:32 +0100)]
virt: Add exit condition in notif-thread loop

Previously thread was stopped using pthread_cancel() call.
Now introduced state variable to track thread active state.

This patch fixes warning about 'infinite loop without
exit condition' generated by Klocwork static analisys.

Change-Id: Ifbaf1dacf422ad6a2a11057e6475c4320c709f33
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agotrying again
Christian Ekstam [Fri, 20 Apr 2018 08:50:53 +0000 (10:50 +0200)]
trying again

6 years agovirt: Fix memory handling for domains data
Radoslaw Jablonski [Fri, 30 Mar 2018 15:31:00 +0000 (16:31 +0100)]
virt: Fix memory handling for domains data

Memory with data for inactive domains was wrongly
freed earlier in refresh_lists() function and crash
was generated. Memory for active domains have
had the same problems with unnecessary free.
Also added handling for freeing inactive domain in
case of error.

Change-Id: I618798d9a369840be9ee596c96f12cbc1f7b24a6
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agovirt: Fix code style in unit tests
Radoslaw Jablonski [Thu, 29 Mar 2018 07:39:23 +0000 (08:39 +0100)]
virt: Fix code style in unit tests

Change-Id: I22501153af210082b444103a8c2ae2686064ebfa
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agovirt: Fix memory leak when using libvirt <= 1.0
Radoslaw Jablonski [Tue, 27 Mar 2018 14:59:13 +0000 (15:59 +0100)]
virt: Fix memory leak when using libvirt <= 1.0

Cleanup was missing for libvirt-allocated virDomainPtr.

Change-Id: Ied152e9e4084ee9e25b7357e648a6aac8778d09b
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agovirt: Replace malloc with calloc for array allocations
Radoslaw Jablonski [Mon, 26 Mar 2018 10:18:19 +0000 (11:18 +0100)]
virt: Replace malloc with calloc for array allocations

Change-Id: I5720ea4c4a237eca7aac19e2cdf7a37194c4c69c
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
6 years agosrc/virt.c: Decouple persistent notifications from refreshInterval
Antoine Naud [Wed, 21 Mar 2018 08:51:42 +0000 (08:51 +0000)]
src/virt.c: Decouple persistent notifications from refreshInterval

When persistentNotification is true, if refreshInterval value is larger than
(read) Interval, the notifications are not issued every read interval as should
be. The fix consist in decoupling persistent notifications from refreshInterval.

Change-Id: I157554a360510c21ffa631430446afd57b99dfab
Signed-off-by: Antoine Naud <antoinex.naud@intel.com>
6 years agosrc/virt_test.c: Fix build error on ubuntu:trusty
Antoine Naud [Thu, 22 Mar 2018 09:48:09 +0000 (09:48 +0000)]
src/virt_test.c: Fix build error on ubuntu:trusty

Change-Id: Ie7dce42f52709c95e1cc51c2236276755278a0ec
Signed-off-by: Antoine Naud <antoinex.naud@intel.com>
6 years agosrc/virt_test.c: Fix memory leaks detected by valgrind
Antoine Naud [Thu, 22 Mar 2018 08:31:23 +0000 (08:31 +0000)]
src/virt_test.c: Fix memory leaks detected by valgrind

src/virt.c: The same memory leaks are also fixed.

Change-Id: Ie970ec5ce500be7cc06512a52994b37cfb687e84
Signed-off-by: Antoine Naud <antoinex.naud@intel.com>
6 years agosrc/virt.c: Fix build error on ubuntu:trusty
Antoine Naud [Wed, 14 Mar 2018 11:49:13 +0000 (11:49 +0000)]
src/virt.c: Fix build error on ubuntu:trusty

Change-Id: Ic76a5b9861360181c677b643245b24f40b80777b
Signed-off-by: Antoine Naud <antoinex.naud@intel.com>
6 years agoAdd connection retry
Andrew Smith [Mon, 16 Apr 2018 13:50:21 +0000 (09:50 -0400)]
Add connection retry

6 years agoFix leak due to sender delivery not being settled
Andrew Smith [Wed, 11 Apr 2018 17:16:37 +0000 (13:16 -0400)]
Fix leak due to sender delivery not being settled

6 years agoMerge pull request #2740 from melak/ros_radioname_null
Ruben Kerkhof [Mon, 9 Apr 2018 11:18:03 +0000 (13:18 +0200)]
Merge pull request #2740 from melak/ros_radioname_null

Fix routeros unset radio-name showing up as "(null)"

6 years agoMerge pull request #2741 from dago/mac
Ruben Kerkhof [Thu, 5 Apr 2018 17:05:32 +0000 (19:05 +0200)]
Merge pull request #2741 from dago/mac

Fix gcc issue on Mac byteorder

6 years agoFix gcc issue on Mac byteorder
Dagobert Michelsen [Thu, 5 Apr 2018 08:49:30 +0000 (10:49 +0200)]
Fix gcc issue on Mac byteorder

6 years agoFix routeros unset radio-name showing up as "(null)"
Tamas TEVESZ [Wed, 4 Apr 2018 16:25:28 +0000 (18:25 +0200)]
Fix routeros unset radio-name showing up as "(null)"

This happens when the `radio-name` property is unset on a wireless
interface. Why this is done is beyond me, but it does seem to be a thing.

6 years agoFix compilation on OpenBSD
Ruben Kerkhof [Wed, 4 Apr 2018 15:02:29 +0000 (17:02 +0200)]
Fix compilation on OpenBSD

  CC       src/libcollectdclient/libcollectdclient_la-server.lo
In file included from src/libcollectdclient/server.c:37:
/usr/include/net/if.h:121: error: field 'ifi_lastchange' has incomplete type
/usr/include/net/if.h:369: error: field 'ifru_addr' has incomplete type
/usr/include/net/if.h:370: error: field 'ifru_dstaddr' has incomplete type
/usr/include/net/if.h:371: error: field 'ifru_broadaddr' has incomplete type
/usr/include/net/if.h:399: error: field 'ifrau_addr' has incomplete type
/usr/include/net/if.h:405: error: field 'ifra_dstaddr' has incomplete type
/usr/include/net/if.h:407: error: field 'ifra_mask' has incomplete type
/usr/include/net/if.h:450: error: field 'addr' has incomplete type
/usr/include/net/if.h:451: error: field 'dstaddr' has incomplete type
/usr/include/net/if.h:457: error: expected specifier-qualifier-list before 'sa_family_t'
In file included from /usr/include/net/if.h:466,
                 from src/libcollectdclient/server.c:37:
/usr/include/net/if_arp.h:79: error: field 'arp_pa' has incomplete type
/usr/include/net/if_arp.h:80: error: field 'arp_ha' has incomplete type
*** Error 1 in . (Makefile:6017 'src/libcollectdclient/libcollectdclient_la-server.lo': @echo "  CC      " src/libcollectdclient/libcollectd...)
*** Error 1 in /home/ruben/src/collectd (Makefile:4188 'all')

6 years agoMerge pull request #2690 from shastah/fix-spec-typo
Ruben Kerkhof [Wed, 4 Apr 2018 14:52:56 +0000 (16:52 +0200)]
Merge pull request #2690 from shastah/fix-spec-typo

RPM spec: fix mbmon/mcelog typo

6 years agoMerge pull request #2717 from dago/endian
Ruben Kerkhof [Wed, 4 Apr 2018 12:44:44 +0000 (14:44 +0200)]
Merge pull request #2717 from dago/endian

Add fallback for endianness conversion

6 years agoFix conditional on byteorder to work on Solaris
Dagobert Michelsen [Wed, 4 Apr 2018 12:34:15 +0000 (14:34 +0200)]
Fix conditional on byteorder to work on Solaris

6 years agoMerge pull request #2376 from zerkms/ISSUE-2358
Ruben Kerkhof [Tue, 3 Apr 2018 21:29:17 +0000 (23:29 +0200)]
Merge pull request #2376 from zerkms/ISSUE-2358

Skip `0.0.0.0` hosts in ntpd plugin

6 years agoMerge pull request #2045 from rubenk/fix-readme
Ruben Kerkhof [Tue, 3 Apr 2018 21:28:03 +0000 (23:28 +0200)]
Merge pull request #2045 from rubenk/fix-readme

README: do not point users to non-existing file

6 years agodaemon: fix build warning
Ruben Kerkhof [Tue, 3 Apr 2018 20:00:46 +0000 (22:00 +0200)]
daemon: fix build warning

src/daemon/collectd.c:579:9: warning: declaration shadows a local variable [-Wshadow]
    int status;
        ^
src/daemon/collectd.c:558:7: note: previous declaration is here
  int status;
      ^

6 years agodaemon: make function static
Ruben Kerkhof [Tue, 3 Apr 2018 19:56:55 +0000 (21:56 +0200)]
daemon: make function static

Fixes the following build warning:

src/daemon/collectd.c:499:5: warning: no previous prototype for function 'configure_collectd' [-Wmissing-prototypes]
int configure_collectd(struct cmdline_config *config) {
    ^

6 years agodaemon: make function static
Ruben Kerkhof [Tue, 3 Apr 2018 19:55:49 +0000 (21:55 +0200)]
daemon: make function static

Fixes a build warning:

src/daemon/collectd.c:452:6: warning: no previous prototype for function 'read_cmdline' [-Wmissing-prototypes]
void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
     ^

6 years agofilecount plugin: mark function as static
Ruben Kerkhof [Tue, 3 Apr 2018 19:48:27 +0000 (21:48 +0200)]
filecount plugin: mark function as static

Fixes a build warning:

CC       src/filecount.lo
src/filecount.c:66:6: warning: no previous prototype for function 'fc_free_dir' [-Wmissing-prototypes]
void fc_free_dir(fc_directory_conf_t *dir) {
     ^
1 warning generated.

6 years agoMerge branch 'master' into endian
Dagobert Michelsen [Tue, 3 Apr 2018 12:42:56 +0000 (14:42 +0200)]
Merge branch 'master' into endian

6 years agoInclude config.h early or _FILE_OFFSET_BITS is wrongly defined and bails out on Solar...
Dagobert Michelsen [Thu, 22 Mar 2018 13:54:01 +0000 (14:54 +0100)]
Include config.h early or _FILE_OFFSET_BITS is wrongly defined and bails out on Solaris 32 bit

6 years agoMerge pull request #2716 from dago/kstat
Ruben Kerkhof [Sat, 31 Mar 2018 10:18:39 +0000 (12:18 +0200)]
Merge pull request #2716 from dago/kstat

Include kstat.h when available

6 years agoMerge pull request #2688 from dstathis/master
Ruben Kerkhof [Sat, 31 Mar 2018 10:16:28 +0000 (12:16 +0200)]
Merge pull request #2688 from dstathis/master

change HAVE_UDEV_H to HAVE_LIBUDEV_H for bug 2651

6 years agoMerge pull request #2731 from elfiesmelfie/ovs_fixes
Ruben Kerkhof [Sat, 31 Mar 2018 09:17:08 +0000 (11:17 +0200)]
Merge pull request #2731 from elfiesmelfie/ovs_fixes

Ovs Fixes

6 years agoMerge branch 'collectd-5.7' into collectd-5.8
Pavel Rochnyack [Fri, 30 Mar 2018 14:12:47 +0000 (21:12 +0700)]
Merge branch 'collectd-5.7' into collectd-5.8

6 years agoMerge remote-tracking branch 'origin/collectd-5.8'
Ruben Kerkhof [Fri, 30 Mar 2018 13:42:12 +0000 (15:42 +0200)]
Merge remote-tracking branch 'origin/collectd-5.8'

6 years agoAuto-Merge pull request #2736 from rpv-tomsk/collectd-collectd-5.8
collectd bot [Thu, 29 Mar 2018 19:17:13 +0000 (21:17 +0200)]
Auto-Merge pull request #2736 from rpv-tomsk/collectd-collectd-5.8

Automatically merged due to "Automerge" label

6 years agouuid plugin: Fixed hostname setting
Pavel Rochnyack [Thu, 29 Mar 2018 18:27:14 +0000 (01:27 +0700)]
uuid plugin: Fixed hostname setting

Closes: #2723
References: #2467

6 years agoMerge pull request #2722 from elfiesmelfie/increase_buffer
Pavel Rochnyak [Wed, 28 Mar 2018 15:28:12 +0000 (22:28 +0700)]
Merge pull request #2722 from elfiesmelfie/increase_buffer

dpdk: increase buffer size for parsing lcores

6 years agoMerge pull request #2721 from elfiesmelfie/update_README
Pavel Rochnyak [Wed, 28 Mar 2018 15:27:31 +0000 (22:27 +0700)]
Merge pull request #2721 from elfiesmelfie/update_README

README: Include compiler defenses suggestion

6 years agoMerge pull request #2703 from elfiesmelfie/fix_ipmi_bugfix_0.2
Pavel Rochnyak [Wed, 28 Mar 2018 15:26:21 +0000 (22:26 +0700)]
Merge pull request #2703 from elfiesmelfie/fix_ipmi_bugfix_0.2

Fixes for ipmi plugin

6 years agoMerge pull request #2704 from dhrupadb/patch-1
Pavel Rochnyak [Wed, 28 Mar 2018 14:39:24 +0000 (21:39 +0700)]
Merge pull request #2704 from dhrupadb/patch-1

Properly cleanup dropped MySQL connections.

6 years agoMerge pull request #2735 from rpv-tomsk/collectd-master
Pavel Rochnyak [Wed, 28 Mar 2018 14:17:48 +0000 (21:17 +0700)]
Merge pull request #2735 from rpv-tomsk/collectd-master

Tree wide: Replace sstrerror() with STRERRNO.

6 years agoAuto-Merge pull request #2734 from rpv-tomsk/fix-2732
collectd bot [Wed, 28 Mar 2018 14:12:50 +0000 (16:12 +0200)]
Auto-Merge pull request #2734 from rpv-tomsk/fix-2732

Automatically merged due to "Automerge" label

6 years agoTree wide: Replace sstrerror() with STRERRNO.
Pavel Rochnyack [Sat, 10 Feb 2018 11:40:06 +0000 (18:40 +0700)]
Tree wide: Replace sstrerror() with STRERRNO.

References: #2519

6 years agoperl plugin: Fix compile fail with message "void function cannot return value"
Pavel Rochnyack [Wed, 28 Mar 2018 13:23:32 +0000 (20:23 +0700)]
perl plugin: Fix compile fail with message "void function cannot return value"

Closes: #2732

6 years agoNow with updated clang-format
cekstam [Tue, 27 Mar 2018 14:31:13 +0000 (16:31 +0200)]
Now with updated clang-format

6 years agoRead CONTRIBUTING.md, but obviously got it wrong
cekstam [Tue, 27 Mar 2018 13:08:08 +0000 (15:08 +0200)]
Read CONTRIBUTING.md, but obviously got it wrong

6 years agocorrecting all the wrongs
cekstam [Tue, 27 Mar 2018 12:11:52 +0000 (14:11 +0200)]
correcting all the wrongs

, data->scale, data->shift

6 years agoutils_ovs: fix resource leaks
Kavanagh, Mark B [Tue, 27 Feb 2018 17:28:55 +0000 (17:28 +0000)]
utils_ovs: fix resource leaks

In ovs_db_init(), upon failure of either ovs_db_event_thread_init()
and/or ovs_db_poll_thread_init(), ovs_db_destroy() is invoked, in
order to release OVSDB data resources.

However, in the event that ovs_db_destroy() returns an error value,
some OVSDB resources are never released, and are consequently lost.

Resolve this issue by checking the return value of ovs_db_destroy()
and manually releasing the appropriate resources accordingly.

Fixes: 5a90d0e ("ovs_events: Address PR comments")
Signed-off-by: Kavanagh, Mark B <mark.b.kavanagh@intel.com>
6 years agoutils_ovs: fix potential NULL
Kavanagh, Mark B [Mon, 26 Feb 2018 17:08:31 +0000 (17:08 +0000)]
utils_ovs: fix potential NULL

In ovs_utils_get_map_value(), YAJL_GET_ARRAY may return a NULL
pointer, which is subsequently dereferenced. Ensure that the
pointer is non-NULL before proceeding.

Fixes: 12f6497 ("ovs_events: Add external ids as metadata")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoutils_ovs: fix potential NULL-string dereference
Kavanagh, Mark B [Mon, 26 Feb 2018 16:12:26 +0000 (16:12 +0000)]
utils_ovs: fix potential NULL-string dereference

In ovs_utils_get_map_value(), a potential NULL-string, returned
by YAJL_GET_STRING(), is passed to strcmp, and subsequently
dereferenced. Ensure that said string is non-NULL.

Fixes: cb59d85 ("ovs_events: Fix plugin collectd config file")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_stats: fix potential NULL array dereference
Kavanagh, Mark B [Mon, 26 Feb 2018 14:49:00 +0000 (14:49 +0000)]
ovs_stats: fix potential NULL array dereference

In ovs_stats_update_bridge(), YAJL_GET_ARRAY() may return a NULL
pointer. Ensure that a non-NULL pointer is returned, before
attempting to dererence same.

Fixes: 4256753 ("ovs_events: fix scan-build warnings #2205")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoAdd scale and shift to modbus plugin
cekstam [Tue, 27 Mar 2018 11:15:28 +0000 (13:15 +0200)]
Add scale and shift to modbus plugin

Adding a Scale and Shift parameter to the modbus plugin in order to correct amplifed data

6 years agoutils_ovs: fix potential NULL dereference
Mark Kavanagh [Mon, 19 Feb 2018 16:39:31 +0000 (16:39 +0000)]
utils_ovs: fix potential NULL dereference

In ovs_utils_get_map_value(), YAJL_GET_ARRAY may return NULL,
which is subsequently dereferenced.

Ensure that the returned pointer is non-NULL before attempting
to dereference it.

Fixes: 12f6497 ("ovs_events: Add external ids as metadata")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_stats: fix memory leak
Mark Kavanagh [Thu, 22 Feb 2018 11:55:44 +0000 (11:55 +0000)]
ovs_stats: fix memory leak

In ovs_stats_plugin_config(), memory may be allocated from the heap,
but is not subsequently freed in the case of failure later in the
function.

Fixes: bcf9c48 ("ovs_stats plugin: Fix a memory leak.")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_stats: fix potential NULL-string dereference
Mark Kavanagh [Wed, 21 Feb 2018 16:15:01 +0000 (16:15 +0000)]
ovs_stats: fix potential NULL-string dereference

The YAJL_GET_STRING macro may return NULL; ensure that the returned
string is non-NULL, before passing it to ovs_stats_new_port(), within
the context of the ovs_stats_update_bridge() function.

Since this change introduces another return path, a single 'failure'
return point is introduced to ovs_stats_bridge().

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoutils_ovs: fix potential strcmp() NULL ptr param
Mark Kavanagh [Mon, 19 Feb 2018 15:55:45 +0000 (15:55 +0000)]
utils_ovs: fix potential strcmp() NULL ptr param

YAJL_GET_STRING(array_values[0]) may return NULL if
array_values[0]->string is NULL; passing a NULL parameter to
strcmp() is not recommended, since the resultant behaviour may
be undefined.

Resolve the issue by adding a NULL check for the string returned
by YAJL_GET_STRING.

Fixes: cbq59d853 ("ovs_events: Fix plugin collectd config file")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_stats: fix potential NULL dereference
Mark Kavanagh [Mon, 19 Feb 2018 15:23:46 +0000 (15:23 +0000)]
ovs_stats: fix potential NULL dereference

ovs_stats_update_iface() passes a pointer to a potentially-NULL
string to sstrncpy(); this is obviously problematic.

Add a check to ensure that the relevant string is non-NULL.

Fixes: 1cc7599 ("ovs_stats plugin: Fix null dereference of "port".)
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_stats: fix potential NULL dereference
Mark Kavanagh [Mon, 19 Feb 2018 13:48:12 +0000 (13:48 +0000)]
ovs_stats: fix potential NULL dereference

ovs_stats_new_port() accepts a character pointer, uuid, as a parameter,
and copies it into port->uuid. Later, this value is dereferenced in
ovs_stats_update_bridge(). If uuid was NULL, then a SEGV will occur.

Resolve this issue by checking if uuid is NULL in ovs_stats_new_port().

Fixes: 481984e ("ovs_stats: Implement OVS statistics plugin.")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agoovs_events: fix potential NULL pointer dereference
Mark Kavanagh [Mon, 19 Feb 2018 13:06:36 +0000 (13:06 +0000)]
ovs_events: fix potential NULL pointer dereference

A potentially-NULL pointer to ovs_events_iface_info_t is defererenced
by an invocation of sizeof(), within ovs_events_get_iface_info().

Move the offending line, such that it is executed after the
NULL-pointer check.

Fixes: f6adec45 ("ovs_events: Fix notification metadata garbage.")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agodpdk: fix utils_dpdk.c clang issue
Kevin Laatz [Thu, 22 Mar 2018 17:23:06 +0000 (17:23 +0000)]
dpdk: fix utils_dpdk.c clang issue

This commit resolves the clang issue in src/utils_dpdk.c

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoKeep clang-format happy
Dagobert Michelsen [Wed, 21 Mar 2018 21:23:07 +0000 (22:23 +0100)]
Keep clang-format happy

6 years agoAdd fallback for endianess conversion
Dagobert Michelsen [Wed, 21 Mar 2018 21:09:15 +0000 (22:09 +0100)]
Add fallback for endianess conversion

6 years agoInclude kstat.h when available
Dagobert Michelsen [Wed, 21 Mar 2018 20:22:45 +0000 (21:22 +0100)]
Include kstat.h when available

6 years agoREADME: Include compiler defenses suggestion
Kevin Laatz [Tue, 27 Feb 2018 13:21:44 +0000 (13:21 +0000)]
README: Include compiler defenses suggestion

This commit adds text in the README to advise users of the DPDK plugins to
use compiler defenses such as -fstack-protector.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agodpdk: increase buffer size for parsing lcores
Harry van Haaren [Wed, 21 Mar 2018 15:33:00 +0000 (15:33 +0000)]
dpdk: increase buffer size for parsing lcores

This commit increases the size of the "high_str" buffer,
which is later used by the strncpy() function. Static analysis
showed that there was a potential issue in accessing this string
if the buffer is smaller.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoDocs: use "its" vice "it's" where appropriate
William Pursell [Wed, 10 Jan 2018 00:35:00 +0000 (16:35 -0800)]
Docs: use "its" vice "it's" where appropriate

6 years agoMerge pull request #2711 from dago/kstat
Pavel Rochnyak [Thu, 15 Mar 2018 05:38:39 +0000 (12:38 +0700)]
Merge pull request #2711 from dago/kstat

Include kstat.h if available to provide kstat_ctl_t

6 years agovirt: Fix unit tests build with libvirt versions < 1.3
Radoslaw Jablonski [Wed, 7 Mar 2018 14:40:35 +0000 (14:40 +0000)]
virt: Fix unit tests build with libvirt versions < 1.3

Previously too much code was disabled in ifdefs, and during
compilation with old libvirt (version < 1.3.x) warning was shown
because of unused test variables.

Change-Id: I631c9446add4ccef068a3c4585f8750a5930f406
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>