This patch brings a light factorization in the decision making process. Signed-off-by: Eric Leblond <eric@xxxxxx> --- filter/ulogd_filter_MARK.c | 24 +++++++++++------------- 1 files changed, 11 insertions(+), 13 deletions(-) diff --git a/filter/ulogd_filter_MARK.c b/filter/ulogd_filter_MARK.c index 1a7c2fd..85c146c 100644 --- a/filter/ulogd_filter_MARK.c +++ b/filter/ulogd_filter_MARK.c @@ -71,20 +71,18 @@ static struct ulogd_key mark_inp[] = { static int interp_mark(struct ulogd_pluginstance *pi) { struct ulogd_key *inp = pi->input.keys; - if (pp_is_valid(inp, KEY_CT_MARK)) { - if ((ikey_get_u32(&inp[KEY_CT_MARK]) & - pi->config_kset->ces[MARK_MASK].u.value) != + int index = 0; + if (pp_is_valid(inp, KEY_CT_MARK)) + index = KEY_CT_MARK; + else if (pp_is_valid(inp, KEY_OOB_MARK)) + index = KEY_OOB_MARK; + else + return ULOGD_IRET_OK; + if ((ikey_get_u32(&inp[index]) & + pi->config_kset->ces[MARK_MASK].u.value) != (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value - ) { - return ULOGD_IRET_STOP; - } - } else if (pp_is_valid(inp, KEY_OOB_MARK)) { - if ((ikey_get_u32(&inp[KEY_OOB_MARK]) & - pi->config_kset->ces[MARK_MASK].u.value) != - (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value - ) { - return ULOGD_IRET_STOP; - } + ) { + return ULOGD_IRET_STOP; } return ULOGD_IRET_OK; } -- 1.6.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html