Resent work related to 'label' and misc fixes
cover Resent work related to 'label' and misc fixes
Hello,
This patchset contains work related to the label option:
* 0001-Add-label-option-to-ULOG-input-plugin.patch
* 0004-Add-label-option-to-NFLOG-input-plugin.patch
* 0005-Update-default-configuration-to-fit-last-changes.patch
It also adds hook support to ULOG:
* 0002-Add-hook-output-to-ULOG-input-module.patch
and fixes a macro in NFLOG:
* 0003-Fix-a-bug-in-definition-of-seq_global_ce-macro.patch
Patches providing 'label' support to databases will be sent by Pierre Chifflier in an other patchset.
BR,
--
Eric Leblond
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
PATCH 1/5 Add label option to ULOG input plugin.
This patch adds support for "label" option to the ULOG plugin. For example, it can be used by another module to determine if the packet has been dropped, rejected or accepted.
--- input/packet/ulogd_inppkt_ULOG.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
input/packet/ulogd_inppkt_ULOG.c +17 -1
@@ -34,7 +34,7 @@ struct ulog_input {/* configuration entries */ static struct config_keyset libulog_kset = { - .num_ces =3 , + .num_ces =4 , .ces = { { .key ="bufsize" ,
@@ -54,6 +54,13 @@ static struct config_keyset libulog_kset = { .options = CONFIG_OPT_NONE, .u.value = ULOGD_RMEM_DEFAULT, }, + { + .key = "label", + .type = CONFIG_TYPE_INT, + .options = CONFIG_OPT_NONE, + .u.value = 0, + }, + } }; enum ulog_keys {
@@ -70,6 +77,7 @@ enum ulog_keys {ULOG_KEY_RAW_MAC_LEN ,ULOG_KEY_OOB_FAMILY ,ULOG_KEY_OOB_PROTOCOL , + ULOG_KEY_RAW_LABEL, }; static struct ulogd_key output_keys[] = {
@@ -157,6 +165,11 @@ static struct ulogd_key output_keys[] = { .flags = ULOGD_RETF_NONE, .name = "oob.protocol", }, + { + .type = ULOGD_RET_UINT8, + .flags = ULOGD_RETF_NONE, + .name = "raw.label", + }, };
@@ -171,6 +184,9 @@ static int interp_packet(struct ulogd_pluginstance *ip, ulog_packet_msg_t *pkt) ret[ULOG_KEY_RAW_MAC_LEN ].flags |=ULOGD_RETF_VALID ; } + ret[ULOG_KEY_RAW_LABEL ].u.value.ui8 = ip->config_kset->ces[3 ].u.value; + ret[ULOG_KEY_RAW_LABEL ].flags |=ULOGD_RETF_VALID ; +/* include pointer to raw ipv4 packet */ ret[ULOG_KEY_RAW_PCKT ].u.value.ptr = pkt->payload; ret[ULOG_KEY_RAW_PCKT ].flags |=ULOGD_RETF_VALID ;
Signature · 1 line
1.5.2.5
PATCH 2/5 Add hook output to ULOG input module.
In reply to Eric LeblondThis patch adds oob.hook to the list of output key sof ULOG input plugin.
--- input/packet/ulogd_inppkt_ULOG.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
input/packet/ulogd_inppkt_ULOG.c +13 -0
@@ -74,6 +74,7 @@ enum ulog_keys {ULOG_KEY_OOB_MARK ,ULOG_KEY_OOB_IN ,ULOG_KEY_OOB_OUT , +ULOG_KEY_OOB_HOOK ,ULOG_KEY_RAW_MAC_LEN ,ULOG_KEY_OOB_FAMILY , ULOG_KEY_OOB_PROTOCOL,
@@ -150,6 +151,15 @@ static struct ulogd_key output_keys[] = { .flags = ULOGD_RETF_NONE, .name = "oob.out", }, + { + .type = ULOGD_RET_UINT8, + .flags = ULOGD_RETF_NONE, + .name = "oob.hook", + .ipfix = { + .vendor = IPFIX_VENDOR_NETFILTER, + .field_id = IPFIX_NF_hook, + }, + }, { .type = ULOGD_RET_UINT16, .flags = ULOGD_RETF_NONE,
@@ -217,6 +227,9 @@ static int interp_packet(struct ulogd_pluginstance *ip, ulog_packet_msg_t *pkt) ret[ULOG_KEY_OOB_OUT ].u.value.ptr = pkt->outdev_name; ret[ULOG_KEY_OOB_OUT ].flags |=ULOGD_RETF_VALID ; + ret[ULOG_KEY_OOB_HOOK ].u.value.ui8 = pkt->hook; + ret[ULOG_KEY_OOB_HOOK ].flags |=ULOGD_RETF_VALID ; +/* ULOG is IPv4 only */ ret[ULOG_KEY_OOB_FAMILY ].u.value.ui8 =AF_INET ; ret[ULOG_KEY_OOB_FAMILY ].flags |=ULOGD_RETF_VALID ;
Signature · 1 line
1.5.2.5
Re: [ULOGD PATCH 2/5] Add hook output to ULOG input module.
Quoted 1 line · Eric Leblond
This patch adds oob.hook to the list of output key sof ULOG input plugin.
Applied. Thanks.
Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers
PATCH 3/5 Fix a bug in definition of seq_global_ce macro.
In reply to Eric Leblond--- input/packet/ulogd_inppkt_NFLOG.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
input/packet/ulogd_inppkt_NFLOG.c +2 -2
@@ -86,8 +86,8 @@ static struct config_keyset libulog_kset = {#define rmem_ce (x) (x->ces[2])#define af_ce (x) (x->ces[3])#define unbind_ce (x) (x->ces[4]) -#define seq_ce (x) (x->ces[4]) -#define seq_global_ce (x) (x->ces[5]) +#define seq_ce (x) (x->ces[5]) +#define seq_global_ce (x) (x->ces[6])enum nflog_keys {NFLOG_KEY_RAW_MAC =0 ,
Signature · 1 line
1.5.2.5
Pablo Neira Ayuso
maintainerRe: [ULOGD PATCH 3/5] Fix a bug in definition of seq_global_ce macro.
Quoted 1 line · Eric Leblond
Signed-off-by Eric Leblond <[email protected]>
This one applied. Thanks Eric.
Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers
PATCH 4/5 Add label option to NFLOG input plugin.
In reply to Eric LeblondThis patch adds support for "label" option to the NFLOG plugin. For example, it can be used by another module to determine if the packet has been dropped, rejected or accepted.
--- input/packet/ulogd_inppkt_NFLOG.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
input/packet/ulogd_inppkt_NFLOG.c +19 -1
@@ -34,7 +34,7 @@ struct nflog_input {/* configuration entries */ static struct config_keyset libulog_kset = { - .num_ces =7 , + .num_ces =8 , .ces = { { .key ="bufsize" ,
@@ -78,6 +78,13 @@ static struct config_keyset libulog_kset = { .options = CONFIG_OPT_NONE, .u.value = 0, }, + { + .key = "label", + .type = CONFIG_TYPE_INT, + .options = CONFIG_OPT_NONE, + .u.value = 0, + }, + } };
@@ -88,6 +95,7 @@ static struct config_keyset libulog_kset = {#define unbind_ce (x) (x->ces[4])#define seq_ce (x) (x->ces[5])#define seq_global_ce (x) (x->ces[6]) +#define label_ce (x) (x->ces[7])enum nflog_keys {NFLOG_KEY_RAW_MAC =0 ,
@@ -108,6 +116,7 @@ enum nflog_keys {NFLOG_KEY_OOB_PROTOCOL ,NFLOG_KEY_OOB_UID ,NFLOG_KEY_OOB_GID , + NFLOG_KEY_RAW_LABEL, }; static struct ulogd_key output_keys[] = {
@@ -252,6 +261,12 @@ static struct ulogd_key output_keys[] = { .flags = ULOGD_RETF_NONE, .name = "oob.gid", }, + { + .type = ULOGD_RET_UINT8, + .flags = ULOGD_RETF_NONE, + .name = "raw.label", + }, + }; static inline int
@@ -275,6 +290,9 @@ interp_packet(struct ulogd_pluginstance *upi, struct nflog_data *ldata) ret[NFLOG_KEY_OOB_FAMILY ].u.value.ui8 =af_ce (upi->config_kset).u.value; ret[NFLOG_KEY_OOB_FAMILY ].flags |=ULOGD_RETF_VALID ; + ret[NFLOG_KEY_RAW_LABEL ].u.value.ui8 =label_ce (upi->config_kset).u.value; + ret[NFLOG_KEY_RAW_LABEL ].flags |=ULOGD_RETF_VALID ; +if (ph) {/* FIXME */ ret[NFLOG_KEY_OOB_HOOK ].u.value.ui8 = ph->hook;
Signature · 1 line
1.5.2.5
PATCH 5/5 Update default configuration to fit last changes
In reply to Eric LeblondDefault stacks needed to be modified to be in sync MAC2STR plugin which is used by database output modules. The new label configuration variable has been added to some ULOG and NFLOG instances to show that it exists.
--- ulogd.conf.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
ulogd.conf.in +2 -0
@@ -97,6 +97,7 @@ group=0 [log2] group=1 # Group has to be different from the one use in log1 addressfamily=10 # 10 is value of AF_INET6 +label=1 # label can be used to define the decision applied to packet # ebtables logging through NFLOG [log3]
@@ -106,6 +107,7 @@ addressfamily=7 # 7 is value of AF_BRIDGE [ulog1] # netlink multicast group (the same as the iptables --ulog-nlgroup param) nlgroup=1 +#label=0 # optionnal argument [emu1] file="/var/log/ulogd_syslogemu.log"
Signature · 1 line
1.5.2.5