[ulogd2] Cleanup: fix error messages and indentation

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Thu Jun 12 11:42:37 CEST 2008


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=ulogd2.git;a=commit;h=14d01ad2ec4bd1ceae13fc3789922fdc059d2b30
commit 14d01ad2ec4bd1ceae13fc3789922fdc059d2b30
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:17:03 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:17:03 2008 +0200

    Cleanup: fix error messages and indentation
    
    This patch fixes some messages in the NFCT and NFLOG input
    plugin (end of line before quote). It also fixes indenting by
    suppressing some spaces on empty line and replacing spaces by tab.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 45499c285e455cb748c7bc85f759682022fc295f
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:15:58 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:15:58 2008 +0200

    Update configfile for MARK module
    
    Add stack example for MARK and update some wrong stacks.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 2ea1541ce5bd9ca035d13a5ec778c555b9cb2069
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:15:14 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:15:14 2008 +0200

    Use ULOGD_IRET_* as return for all interpreters
    
    This patch modifies plugins to use the already defined but not used
    define. This also fixes some weird behaviours in error treatment (like
    not stopping after OOM).
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 015849995f7f99f344ece11748a6e7b36ce07dd7
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:10:58 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:10:58 2008 +0200

    Fix hexadecimal parsing in config file
    
    The config file parsing was not able to parse integer given in hex notation.
    This patch modify the parsing of configfile to be able to use different
    integers notation.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit da35b9e971b852338be7bbb00c639a381b1a5a76
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:08:31 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:08:31 2008 +0200

    New MARK-based filter
    
    This module filters message by using the mark to decide wether or not a
    packet or a flow has to be logged. It takes a mark and a mask option. It
    demonstrates the usage of ULOGD_IRET_STOP which can be used to abort
    iteration through the stack.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 509bf34f1843203cdaa21bfbdb88212ab8de8c8f
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jun 12 11:06:28 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jun 12 11:06:28 2008 +0200

    Fix the propagation through the stack
    
    When a plugin returns ULOGD_IRET_STOP, the propagation should
    stop. This was not the case as break was used to do so but it was called
    inside a switch and thus apply to the switch instruction and not to
    the llist iteration.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>
       via  14d01ad2ec4bd1ceae13fc3789922fdc059d2b30 (commit)
       via  45499c285e455cb748c7bc85f759682022fc295f (commit)
       via  2ea1541ce5bd9ca035d13a5ec778c555b9cb2069 (commit)
       via  015849995f7f99f344ece11748a6e7b36ce07dd7 (commit)
       via  da35b9e971b852338be7bbb00c639a381b1a5a76 (commit)
       via  509bf34f1843203cdaa21bfbdb88212ab8de8c8f (commit)
      from  498711aaf9167061643feb802adb920f7ca3d0a2 (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 14d01ad2ec4bd1ceae13fc3789922fdc059d2b30
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:17:03 2008 +0200

    Cleanup: fix error messages and indentation
    
    This patch fixes some messages in the NFCT and NFLOG input
    plugin (end of line before quote). It also fixes indenting by
    suppressing some spaces on empty line and replacing spaces by tab.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 45499c285e455cb748c7bc85f759682022fc295f
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:15:58 2008 +0200

    Update configfile for MARK module
    
    Add stack example for MARK and update some wrong stacks.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 2ea1541ce5bd9ca035d13a5ec778c555b9cb2069
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:15:14 2008 +0200

    Use ULOGD_IRET_* as return for all interpreters
    
    This patch modifies plugins to use the already defined but not used
    define. This also fixes some weird behaviours in error treatment (like
    not stopping after OOM).
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 015849995f7f99f344ece11748a6e7b36ce07dd7
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:10:58 2008 +0200

    Fix hexadecimal parsing in config file
    
    The config file parsing was not able to parse integer given in hex notation.
    This patch modify the parsing of configfile to be able to use different
    integers notation.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit da35b9e971b852338be7bbb00c639a381b1a5a76
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:08:31 2008 +0200

    New MARK-based filter
    
    This module filters message by using the mark to decide wether or not a
    packet or a flow has to be logged. It takes a mark and a mask option. It
    demonstrates the usage of ULOGD_IRET_STOP which can be used to abort
    iteration through the stack.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

commit 509bf34f1843203cdaa21bfbdb88212ab8de8c8f
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jun 12 11:06:28 2008 +0200

    Fix the propagation through the stack
    
    When a plugin returns ULOGD_IRET_STOP, the propagation should
    stop. This was not the case as break was used to do so but it was called
    inside a switch and thus apply to the switch instruction and not to
    the llist iteration.
    
    Signed-off-by: Eric Leblond <eric at inl.fr>

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

 filter/Makefile.am                        |    5 +-
 filter/raw2packet/ulogd_raw2packet_BASE.c |   50 ++++++------
 filter/ulogd_filter_IFINDEX.c             |    2 +-
 filter/ulogd_filter_IP2BIN.c              |    2 +-
 filter/ulogd_filter_IP2STR.c              |    2 +-
 filter/ulogd_filter_MAC2STR.c             |    4 +-
 filter/ulogd_filter_MARK.c                |  123 +++++++++++++++++++++++++++++
 filter/ulogd_filter_PRINTFLOW.c           |    2 +-
 filter/ulogd_filter_PRINTPKT.c            |    2 +-
 filter/ulogd_filter_PWSNIFF.c             |   12 ++--
 input/flow/ulogd_inpflow_NFCT.c           |    6 +-
 input/packet/ulogd_inppkt_NFLOG.c         |    2 +-
 output/pcap/ulogd_output_PCAP.c           |    6 +-
 output/ulogd_output_IPFIX.c               |    4 +-
 output/ulogd_output_LOGEMU.c              |    2 +-
 output/ulogd_output_NACCT.c               |    2 +-
 output/ulogd_output_OPRINT.c              |    2 +-
 output/ulogd_output_SYSLOG.c              |    2 +-
 src/conffile.c                            |    2 +-
 src/ulogd.c                               |    6 ++
 ulogd.conf.in                             |    9 ++-
 21 files changed, 193 insertions(+), 54 deletions(-)
 create mode 100644 filter/ulogd_filter_MARK.c
When a plugin returns ULOGD_IRET_STOP, the propagation should
stop. This was not the case as break was used to do so but it was called
inside a switch and thus apply to the switch instruction and not to
the llist iteration.

Signed-off-by: Eric Leblond <eric at inl.fr>

diff --git a/src/ulogd.c b/src/ulogd.c
index 8c8dc14..4e36984 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -477,6 +477,7 @@ static void ulogd_clean_results(struct ulogd_pluginstance *pi)
 void ulogd_propagate_results(struct ulogd_pluginstance *pi)
 {
 	struct ulogd_pluginstance *cur = pi;
+	int abort_stack = 0;
 	/* iterate over remaining plugin stack */
 	llist_for_each_entry_continue(cur, &pi->stack->list, list) {
 		int ret;
@@ -489,6 +490,7 @@ void ulogd_propagate_results(struct ulogd_pluginstance *pi)
 			/* fallthrough */
 		case ULOGD_IRET_STOP:
 			/* we shall abort further iteration of the stack */
+			abort_stack = 1;
 			break;
 		case ULOGD_IRET_OK:
 			/* we shall continue travelling down the stack */
@@ -497,8 +499,12 @@ void ulogd_propagate_results(struct ulogd_pluginstance *pi)
 			ulogd_log(ULOGD_NOTICE,
 				  "unknown return value `%d' from plugin %s\n",
 				  ret, cur->plugin->name);
+			abort_stack = 1;
 			break;
 		}
+
+		if (abort_stack)
+			break;
 	}
 
 	ulogd_clean_results(pi);



More information about the netfilter-cvslog mailing list