[conntrack-tools] conntrack: use fscanf() instead of read() for showing counter

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Thu Oct 8 18:07:20 CEST 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=910d392806be7457f95aaab73e81abe20772bd05
commit 910d392806be7457f95aaab73e81abe20772bd05
Author:     Hannes Eder <heder at google.com>
AuthorDate: Thu Oct 8 18:06:04 2009 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Oct 8 18:06:04 2009 +0200

    conntrack: use fscanf() instead of read() for showing counter
    
    Read an integer right away with fscanf() instead of read()-ing to a
    buffer, which was actually to small for the terminating '\0', and
    atoi()-ing.  Furthermore read() might not read enough, though unlikely
    here.
    
    Signed-off-by: Hannes Eder <heder at google.com>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit eb1127e0f72274bdcdcf6fdef96f1cbac5d19f02
Author:     Hannes Eder <heder at google.com>
AuthorDate: Thu Oct 8 18:04:11 2009 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Oct 8 18:04:11 2009 +0200

    conntrack: avoid error with expectations when using 'conntrack -E -e ALL ...'
    
    Avoid this error:
    conntrack v0.9.13 (conntrack-tools): Operation failed: No such file or
    directory
    
    when using 'conntrack -E -e ALL ...'.
    
    This is caused by the fact that netfilter expectations also get
    delivered, but things are not setup for this, nfnl_catch returns -1
    and errno = ENOENT.
    
    Signed-off-by: Hannes Eder <heder at google.com>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  910d392806be7457f95aaab73e81abe20772bd05 (commit)
       via  eb1127e0f72274bdcdcf6fdef96f1cbac5d19f02 (commit)
      from  0cd2397e80d21d77ddb97794f24bb6945849093d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 910d392806be7457f95aaab73e81abe20772bd05
Author: Hannes Eder <heder at google.com>
Date:   Thu Oct 8 18:06:04 2009 +0200

    conntrack: use fscanf() instead of read() for showing counter
    
    Read an integer right away with fscanf() instead of read()-ing to a
    buffer, which was actually to small for the terminating '\0', and
    atoi()-ing.  Furthermore read() might not read enough, though unlikely
    here.
    
    Signed-off-by: Hannes Eder <heder at google.com>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit eb1127e0f72274bdcdcf6fdef96f1cbac5d19f02
Author: Hannes Eder <heder at google.com>
Date:   Thu Oct 8 18:04:11 2009 +0200

    conntrack: avoid error with expectations when using 'conntrack -E -e ALL ...'
    
    Avoid this error:
    conntrack v0.9.13 (conntrack-tools): Operation failed: No such file or
    directory
    
    when using 'conntrack -E -e ALL ...'.
    
    This is caused by the fact that netfilter expectations also get
    delivered, but things are not setup for this, nfnl_catch returns -1
    and errno = ENOENT.
    
    Signed-off-by: Hannes Eder <heder at google.com>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

-----------------------------------------------------------------------

 src/conntrack.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
Avoid this error:
conntrack v0.9.13 (conntrack-tools): Operation failed: No such file or
directory

when using 'conntrack -E -e ALL ...'.

This is caused by the fact that netfilter expectations also get
delivered, but things are not setup for this, nfnl_catch returns -1
and errno = ENOENT.

Signed-off-by: Hannes Eder <heder at google.com>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

diff --git a/src/conntrack.c b/src/conntrack.c
index 0053a28..8e546ab 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -1401,7 +1401,8 @@ int main(int argc, char *argv[])
 		
 	case CT_EVENT:
 		if (options & CT_OPT_EVENT_MASK)
-			cth = nfct_open(CONNTRACK, event_mask);
+			cth = nfct_open(CONNTRACK,
+					event_mask & NFCT_ALL_CT_GROUPS);
 		else
 			cth = nfct_open(CONNTRACK, NFCT_ALL_CT_GROUPS);
 



More information about the netfilter-cvslog mailing list