From patchwork Sun Apr 28 15:06:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamal Hadi Salim X-Patchwork-Id: 240253 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 67C832C00A2 for ; Mon, 29 Apr 2013 01:06:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192Ab3D1PGn (ORCPT ); Sun, 28 Apr 2013 11:06:43 -0400 Received: from mail-ia0-f182.google.com ([209.85.210.182]:61244 "EHLO mail-ia0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752108Ab3D1PGm (ORCPT ); Sun, 28 Apr 2013 11:06:42 -0400 Received: by mail-ia0-f182.google.com with SMTP id w33so2567526iag.41 for ; Sun, 28 Apr 2013 08:06:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:x-gm-message-state; bh=ESUTmg+yD02V1WfGJkDYAVgky8NKB2LI4G9EZtUU6Ck=; b=bcXGpB3Dvu6wpIr+24YBhWsydrPAlyVVkkzw5djsMfjFjIilSni8h/3bLYasAT6YL2 qU/dT3kkYQbgLPU9DXB7KkKhfUWU2O1hNvB0L22HantebSdfhampNn2Kk5XEQCkU6uUj CMrlRyO2xjfBmFP1ff7h572eOKkgkWF3Y2b2yjmyBM5RaMGrqGa+m2hk4nlqggNFNgWh BqT7xz45qV7cCqRa7XAq9T8bTy8Ef1G2s//e9MBTbqfSwgKO/YCP1vM3k+YuQrtyvoaJ Gy9tARmwAHiiFclrJkz/6HXJZ752G4ErH/ucDt7ImsaOEg9UNZd9k/yVlKfDnamP1XKc YIAQ== X-Received: by 10.50.171.73 with SMTP id as9mr5844077igc.23.1367161602019; Sun, 28 Apr 2013 08:06:42 -0700 (PDT) Received: from [192.168.1.100] ([24.212.162.80]) by mx.google.com with ESMTPSA id y5sm14059815igg.7.2013.04.28.08.06.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Apr 2013 08:06:41 -0700 (PDT) Message-ID: <517D3AFE.8020001@mojatatu.com> Date: Sun, 28 Apr 2013 11:06:38 -0400 From: Jamal Hadi Salim User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: David Miller CC: "netdev@vger.kernel.org" , Hasan Chowdhury , Jan Engelhardt Subject: [PATCH] net_sched: act_ipt forward compat with xtables X-Gm-Message-State: ALoCoQm3nQGTSkYB8FGJz3iOfvVuK8KPQhgizlWGAEnoh3sx68SVtLOCeoZZFUy/4bOtwtzSQR8o Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I have done minimal testing on this on my environment. I took Jan's advise to simplify things. Hasan, I know you have your head buried in the sand right now; but please when you get the time test this patch with the latest iproute2 git tree and send your tested-by credential. Dave, When Hasan nods I think this should also go into stable because none of the newer kernels work with newer iptables (which is a lot of distros). cheers, jamal commit 94c39d99038dd7fdea4922ae4cfb4ad683c1307c Author: Jamal Hadi Salim Date: Sun Apr 28 10:46:56 2013 -0400 Deal with changes in newer xtables while maintaining backward compatibility. Thanks to Jan Engelhardt for suggestions. Signed-off-by: Jamal Hadi Salim diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index e0f6de6..60d88b6 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -8,7 +8,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Copyright: Jamal Hadi Salim (2002-4) + * Copyright: Jamal Hadi Salim (2002-13) */ #include @@ -303,17 +303,44 @@ static struct tc_action_ops act_ipt_ops = { .walk = tcf_generic_walker }; -MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); +static struct tc_action_ops act_xt_ops = { + .kind = "xt", + .hinfo = &ipt_hash_info, + .type = TCA_ACT_IPT, + .capab = TCA_CAP_NONE, + .owner = THIS_MODULE, + .act = tcf_ipt, + .dump = tcf_ipt_dump, + .cleanup = tcf_ipt_cleanup, + .lookup = tcf_hash_search, + .init = tcf_ipt_init, + .walk = tcf_generic_walker +}; + +MODULE_AUTHOR("Jamal Hadi Salim(2002-13)"); MODULE_DESCRIPTION("Iptables target actions"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("act_xt"); static int __init ipt_init_module(void) { - return tcf_register_action(&act_ipt_ops); + int ret1, ret2; + ret1 = tcf_register_action(&act_xt_ops); + if (ret1 < 0) + printk("Failed to load xt action\n"); + ret2 = tcf_register_action(&act_ipt_ops); + if (ret2 < 0) + printk("Failed to load ipt action\n"); + + if (ret1 < 0 && ret2 < 0) + return ret1; + else + return 0; } static void __exit ipt_cleanup_module(void) { + tcf_unregister_action(&act_xt_ops); tcf_unregister_action(&act_ipt_ops); }