summaryrefslogtreecommitdiff
path: root/flowtop.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-09-07 17:09:45 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-09-07 17:24:36 +0200
commitf472d90b141d0e9f0c1033012d6d2be1338b7b1f (patch)
treefb42a037b373cb22d68b2d861d672ead2218fea8 /flowtop.c
parentd5bdc3836a9b8bfc03b9c9ff86d913e0717fd300 (diff)
flowtop: Don't attempt to set sysctl values if initial read fails
Bail out early if we fail to read the current sysctl variable values for net/netfilter/nf_conntrack_acct and net/netfilter/nf_conntrack_timestamp Otherwise we'll not be able restore the previous value on exit/panic. Moreover, if we fail to read the sysctl file, we usually also lack the permissions to write it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r--flowtop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/flowtop.c b/flowtop.c
index 0d36a0a..9df4bdb 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1132,6 +1132,7 @@ static void conntrack_acct_enable(void)
if (sysctl_get_int("net/netfilter/nf_conntrack_acct", &sysctl.nfct_acct)) {
fprintf(stderr, "Can't read net/netfilter/nf_conntrack_acct: %s\n",
strerror(errno));
+ return;
}
if (sysctl.nfct_acct == 1)
@@ -1148,6 +1149,7 @@ static void conntrack_tstamp_enable(void)
if (sysctl_get_int("net/netfilter/nf_conntrack_timestamp", &sysctl.nfct_tstamp)) {
fprintf(stderr, "Can't read net/netfilter/nf_conntrack_timestamp: %s\n",
strerror(errno));
+ return;
}
if (sysctl.nfct_tstamp == 1)