Skip to contentSkip to conversation

basic patches

ULOGD2 New Pierre Chifflier 2 participants 5 messages Oct 15, 2008 – Oct 20, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

These patchset fix the following problems:

- We don't need to add constraints in the PostgreSQL table, the application already checks for port value. Constraints only slow down insertions.

- Finish the renaming of MAC2STR plugin to HWHDR

- Fix a potential segfault in HWHDR plugin, when mac is NULL (e.g when using ulogd2 on OUTPUT).

Cheers,
Pierre

#1 lore raw

PATCH 1/3 Drop useless constraints

---
 doc/pgsql-ulogd2.sql |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
doc/pgsql-ulogd2.sql +0 -6
index 78c06b5..9340801 100644
@@ -109,9 +109,6 @@ CREATE TABLE tcp (
 CREATE INDEX tcp_sport ON tcp(tcp_sport);
 CREATE INDEX tcp_dport ON tcp(tcp_dport);
 
-ALTER TABLE tcp ADD CONSTRAINT tcp_sport_ok CHECK(tcp_sport >= 0 AND tcp_sport <= 65536);
-ALTER TABLE tcp ADD CONSTRAINT tcp_dport_ok CHECK(tcp_dport >= 0 AND tcp_dport <= 65536);
-
 CREATE TABLE udp (
   _udp_id bigint PRIMARY KEY UNIQUE NOT NULL,
   udp_sport integer default NULL,
@@ -122,9 +119,6 @@ CREATE TABLE udp (
 CREATE INDEX udp_sport ON udp(udp_sport);
 CREATE INDEX udp_dport ON udp(udp_dport);
 
-ALTER TABLE udp ADD CONSTRAINT udp_sport_ok CHECK(udp_sport >= 0 AND udp_sport <= 65536);
-ALTER TABLE udp ADD CONSTRAINT udp_dport_ok CHECK(udp_dport >= 0 AND udp_dport <= 65536);
-
 CREATE TABLE icmp (
   _icmp_id bigint PRIMARY KEY UNIQUE NOT NULL,
   icmp_type smallint default NULL,
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 2/3 Fix pp_is_valid in mac2str plugin

In reply to Pierre Chifflier

This fixes a segfault when RAW_MAC key is NULL in MAC2STR plugin.

---
 filter/ulogd_filter_HWHDR.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
filter/ulogd_filter_HWHDR.c +1 -1
index cecd3e2..327b5fe 100644
@@ -174,7 +174,7 @@ static int interp_mac2str(struct ulogd_pluginstance *pi)
 			return fret;
 	}
 
-	if (!pp_is_valid(inp, KEY_RAW_MAC)) {
+	if (pp_is_valid(inp, KEY_RAW_MAC)) {
 		if (GET_VALUE(inp, KEY_RAW_MAC_ADDRLEN).ui16 == ETH_ALEN) {
 			ret[KEY_MAC_TYPE].u.value.ui16 = ARPHRD_ETHER;
 			ret[KEY_MAC_TYPE].flags |= ULOGD_RETF_VALID;
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 3/3 Fix HWHDR plugin name

In reply to Pierre Chifflier

MAC2STR has been renamed to HWHDR.

---
 filter/ulogd_filter_HWHDR.c |    4 ++--
 ulogd.conf.in               |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
filter/ulogd_filter_HWHDR.c +2 -2
index 327b5fe..af44791 100644
@@ -1,4 +1,4 @@
-/* ulogd_filter_MAC2STR.c, Version $Revision: 1500 $
+/* ulogd_filter_HWHDR.c, Version $Revision: 1500 $
  *
  * ulogd interpreter plugin for HWMAC
  *
@@ -218,7 +218,7 @@ static int interp_mac2str(struct ulogd_pluginstance *pi)
 
 
 static struct ulogd_plugin mac2str_pluging = {
-	.name = "MAC2STR",
+	.name = "HWHDR",
 	.input = {
 		.keys = mac2str_inp,
 		.num_keys = ARRAY_SIZE(mac2str_inp),
ulogd.conf.in +1 -1
index a32234d..751892f 100644
@@ -39,7 +39,7 @@ plugin="@libdir@/ulogd/ulogd_filter_IFINDEX.so"
 plugin="@libdir@/ulogd/ulogd_filter_IP2STR.so"
 plugin="@libdir@/ulogd/ulogd_filter_IP2BIN.so"
 plugin="@libdir@/ulogd/ulogd_filter_PRINTPKT.so"
-plugin="@libdir@/ulogd/ulogd_filter_MAC2STR.so"
+plugin="@libdir@/ulogd/ulogd_filter_HWHDR.so"
 plugin="@libdir@/ulogd/ulogd_filter_PRINTFLOW.so"
 #plugin="@libdir@/ulogd/ulogd_filter_MARK.so"
 plugin="@libdir@/ulogd/ulogd_output_LOGEMU.so"
Signature · 1 line
1.5.6.5
#4 lore raw
In reply to Pierre Chifflier
Quoted 11 lines · Pierre Chifflier

Hi,

These patchset fix the following problems:

- We don't need to add constraints in the PostgreSQL table, the application already checks for port value. Constraints only slow down insertions.

- Finish the renaming of MAC2STR plugin to HWHDR

- Fix a potential segfault in HWHDR plugin, when mac is NULL (e.g when using ulogd2 on OUTPUT).

All applied. Thanks Pierre. BTW, next time, it would great if you can improve the log a bit to look like:

-o-
section: short description

Long description

-o-

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers