From patchwork Mon Dec 17 12:30:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamal Hadi Salim X-Patchwork-Id: 206851 X-Patchwork-Delegate: shemminger@vyatta.com 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 2C0BA2C0093 for ; Mon, 17 Dec 2012 23:30:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752384Ab2LQMaq (ORCPT ); Mon, 17 Dec 2012 07:30:46 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:38905 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751703Ab2LQMap (ORCPT ); Mon, 17 Dec 2012 07:30:45 -0500 Received: by mail-ie0-f174.google.com with SMTP id c11so9140649ieb.19 for ; Mon, 17 Dec 2012 04:30:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:x-gm-message-state; bh=9z7j70/QoSV1cKfSL/hXp4pQFDnPb364UBviKIk/JGQ=; b=APdGeknG5OMyjvcSqPjliGDo22dIEJyKvJCwiERLr4ptf5u2OeYqMhSr15SdFcUyAl Q1+MiReCyONOe9Dvz47vJB6dfnnJDkP7d93uoj254C0J9UrLBbJGr6B9ttsRtpOCj48B l2iNLjEiqyuL6PNZHk0G08CBGT5GuYW/z0dLHMWd+LNZWpDwJVMdM17HTIR3/aMWmdjE DV2W2JmnJwQ8NlUfZy+ng1ImKWrKfLz7NMITr8ooqQTcgQiGqCuN4R8azHmLr1WgaIf5 aB7Ob25q9DZ58RDXbxBCMvV56V1HQQMLZRLiclGAIViXSf4LZg+LscIqYH3tdU4//4JF ozHg== Received: by 10.43.119.5 with SMTP id fs5mr10818731icc.14.1355747444523; Mon, 17 Dec 2012 04:30:44 -0800 (PST) Received: from [10.0.0.12] (198-84-205-210.cpe.teksavvy.com. [198.84.205.210]) by mx.google.com with ESMTPS id 10sm5517200ign.5.2012.12.17.04.30.42 (version=SSLv3 cipher=OTHER); Mon, 17 Dec 2012 04:30:44 -0800 (PST) Message-ID: <50CF1071.1050405@mojatatu.com> Date: Mon, 17 Dec 2012 07:30:41 -0500 From: Jamal Hadi Salim User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Stephen Hemminger CC: Hasan Chowdhury , Jan Engelhardt , Yury Stankevich , "netdev@vger.kernel.org" , pablo@netfilter.org, netfilter-devel@vger.kernel.org Subject: RFC [PATCH] iproute2: temporary solution to fix xt breakage References: <50C4821D.5090206@gmail.com> <50C9B4BB.9060609@mojatatu.com> <50CCE961.5050204@mojatatu.com> <50CDFB6A.3090806@mojatatu.com> <50CE1A04.1000405@mojatatu.com> <50CE3203.9080007@mojatatu.com> In-Reply-To: <50CE3203.9080007@mojatatu.com> X-Gm-Message-State: ALoCoQknx4vC4kIg8JKodjEI6UiI5TX5OrQpGQfxPMEeT1SXK3BS9qI3ySUPT6/+YOPVjSCmhjOh Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 12-12-16 03:41 PM, Jamal Hadi Salim wrote: > > There is an "intermediate solution" from Hasan which doesnt require > the kernel change. It changes the kernel endpoint to "ipt". I am > conflicted because it is a quick hack while otoh forcing people to > upgrade kernel is a usability issue. > Attached. Author is Hasan - I didnt sign it because i am looking for feedback and i find it distasteful but it solves the problem. This is needed until we have a proper fix in the kernel propagated. Once that kernel change is ubiquitous this change is noise and a maintanance pain. I am making it hard to even turn it on (i.e someone knowledgeable will have to compile with CONFIG_XT_HACK) cheers, jamal diff --git a/tc/m_action.c b/tc/m_action.c index 1fe2431..fa9a7c8 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -209,10 +209,17 @@ done0: tail = NLMSG_TAIL(n); addattr_l(n, MAX_MSG, ++prio, NULL, 0); + /*XXX: hack to work around old kernels, newer xtables */ +#ifdef CONFIG_XT_HACK + if (strncmp(k,"xt",2)==0) + addattr_l(n, MAX_MSG, TCA_ACT_KIND, "ipt" , strlen("ipt") + 1); + else + addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1); +#else addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1); +#endif ret = a->parse_aopt(a,&argc, &argv, TCA_ACT_OPTIONS, n); - if (ret < 0) { fprintf(stderr,"bad action parsing\n"); goto bad_val; @@ -259,7 +266,15 @@ tc_print_one_action(FILE * f, struct rtattr *arg) } + /*XXX: hack to work around old kernels, newer xtables */ +#ifdef CONFIG_XT_HACK + if (strcmp(RTA_DATA(tb[TCA_ACT_KIND]), "ipt")==0) + a = get_action_kind("xt"); + else + a = get_action_kind(RTA_DATA(tb[TCA_ACT_KIND])); +#else a = get_action_kind(RTA_DATA(tb[TCA_ACT_KIND])); +#endif if (NULL == a) return err;