From b44af767e88ed6352569cd392228cc0c2816fa51 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 4 Nov 2010 00:24:56 +0100 Subject: [PATCH] xt_mp2t: fix mtcheck convention Xt-a/compat_xtables has its own API that is independent from the kernel. --- extensions/xt_mp2t.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/extensions/xt_mp2t.c b/extensions/xt_mp2t.c index d8b348b..96436cd 100644 --- a/extensions/xt_mp2t.c +++ b/extensions/xt_mp2t.c @@ -637,20 +637,6 @@ mp2t_stream_alloc_init(struct xt_rule_mp2t_conn_htable *ht, return entry; } -/* - * The xt_mp2t_mt_check(), return type changed, which is quite - * confusing as the return logic gets turned around. - * - * TODO: Think change happend in 2.6.35, need to check the exact - * kernel version this changed in! - */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34) -enum RETURNVALS { error = 0 /*false*/, success = 1 /*true*/, }; -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) -enum RETURNVALS { error = -EINVAL, success = 0, }; -#endif - static int xt_mp2t_mt_check(const struct xt_mtchk_param *par) { @@ -664,13 +650,13 @@ xt_mp2t_mt_check(const struct xt_mtchk_param *par) /* Debugging, this should not be possible */ if (!info) { msg_err(DRV, "ERROR info is NULL"); - return error; + return -EINVAL; } /* Debugging, this should not be possible */ if (IS_ERR_VALUE((unsigned long)(info->hinfo))) { msg_err(DRV, "ERROR info->hinfo is an invalid pointer!!!"); - return error; + return -EINVAL; } /* TODO/FIXME: Add a check to NOT allow proc files with same @@ -685,15 +671,15 @@ xt_mp2t_mt_check(const struct xt_mtchk_param *par) atomic_inc(&info->hinfo->use); msg_info(DEBUG, "ReUsing info->hinfo ptr:[%p] htable id:%d", info->hinfo, info->hinfo->id); - return success; + return 0; } if (mp2t_htable_create(info) == false) { msg_err(DRV, "Error creating hash table"); - return error; + return -ENOMEM; } - return success; + return 0; } static void