From patchwork Thu Mar 9 18:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13168058 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E98AEC64EC4 for ; Thu, 9 Mar 2023 18:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjCISwc (ORCPT ); Thu, 9 Mar 2023 13:52:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbjCISw3 (ORCPT ); Thu, 9 Mar 2023 13:52:29 -0500 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C9BFAEF2 for ; Thu, 9 Mar 2023 10:52:11 -0800 (PST) Received: by mail-ot1-x32b.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso1606376oti.8 for ; Thu, 09 Mar 2023 10:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; t=1678387931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Py87wm18nf6iBnrV1Xx+QX4xad9FSzmXnS6t2bxd9ZA=; b=GIJMb9yXmlIRwqK/4ioKUq7APtLFuk2fVD4P493ovPs05//6HxwkvwmbK4xzA21jNr 5Myfn8tccrwwTb56n5aQsZygldjhlD5LL9HHFUUvdYYQYgMv8iP/wP4/Lp07nAndqLdU P1J+PG+Xn/YpVFm1acQiH6xHA5Kb/+AaxNunT33ex9RhAFQ5KCEeZOijNsh+QLT0XBau p2cFAGCTNJ9nbEy3fA3MKafunKluw08Wj/CkEqFI0SRXIZyMMEaH3vbKnrzwNQe4JFbp JXa2MxSRS12IPa/Qkeml2lwAJf8W/sru4d1zGjsQZfxTAKPTzP0GTzpFVRd0NdYi3vyn CQOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678387931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Py87wm18nf6iBnrV1Xx+QX4xad9FSzmXnS6t2bxd9ZA=; b=v9jkdBtt6PrMzW31NRzODTiBYxl+IQFTzTIVLt1Z6nF5+wys66HDrngiTvIDXxwvjL kHzUu3VonV7qe/tdrw6GIYZEa3iFd4YVUmZbm3DnPHN8vU9UsYj1CNBt/9JGI2zj/tqC iFOMq0HMuPpT52CelHIKl8VslOydC5Uhl7fOnfbhb2vRqnkCAUW+Hl7Bx+/dONQ2ib4H d0pOLsQ1Wh0KfvjykmYMXqMaDWKoXOQUjg0CqyDd26Fz/mQ8c8LhEi5jEXZIaBS4tbXr Zr1T6QDM/MOhFEynqyw9InQYZEd9My6+JlJSwW9gQAeMKM0R9hxAER7fC4Dp2wHoLOac RXbA== X-Gm-Message-State: AO0yUKWV7Cc/XEmDWW56MncMvV3z/JbNPjR6OJKYMLiB0ZG8wPBQ7zc5 YERpPZi2ubMET+GrmSWvjIkQfGWFbGP3JdcKCQM= X-Google-Smtp-Source: AK7set+n9zuxA0bIRHXQwFYsTCQ+4+tBrtEmU4fBlFEkU9Qit4vToYACpGs7Ft5H6EwvILhS8WdF+A== X-Received: by 2002:a9d:700c:0:b0:68b:cada:6817 with SMTP id k12-20020a9d700c000000b0068bcada6817mr9311181otj.12.1678387931044; Thu, 09 Mar 2023 10:52:11 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:d22f:e7ce:9ab3:d054]) by smtp.gmail.com with ESMTPSA id o25-20020a9d7199000000b0068657984c22sm63248otj.32.2023.03.09.10.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 10:52:10 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [PATCH net-next 1/3] net/sched: act_pedit: use extack in 'ex' parsing errors Date: Thu, 9 Mar 2023 15:51:56 -0300 Message-Id: <20230309185158.310994-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309185158.310994-1-pctammela@mojatatu.com> References: <20230309185158.310994-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We have extack available when parsing 'ex' keys, so pass it to tcf_pedit_keys_ex_parse and add more detailed error messages. While at it, remove redundant code from the 'err_out' label code path. Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- net/sched/act_pedit.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 4559a1507ea5..f4ebe06aeaf2 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -35,7 +35,7 @@ static const struct nla_policy pedit_key_ex_policy[TCA_PEDIT_KEY_EX_MAX + 1] = { }; static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, - u8 n) + u8 n, struct netlink_ext_ack *extack) { struct tcf_pedit_key_ex *keys_ex; struct tcf_pedit_key_ex *k; @@ -55,26 +55,21 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, nla_for_each_nested(ka, nla, rem) { struct nlattr *tb[TCA_PEDIT_KEY_EX_MAX + 1]; - if (!n) { - err = -EINVAL; + if (!n) goto err_out; - } n--; - if (nla_type(ka) != TCA_PEDIT_KEY_EX) { - err = -EINVAL; + if (nla_type(ka) != TCA_PEDIT_KEY_EX) goto err_out; - } - err = nla_parse_nested_deprecated(tb, TCA_PEDIT_KEY_EX_MAX, - ka, pedit_key_ex_policy, - NULL); + err = nla_parse_nested_deprecated(tb, TCA_PEDIT_KEY_EX_MAX, ka, + pedit_key_ex_policy, extack); if (err) goto err_out; if (!tb[TCA_PEDIT_KEY_EX_HTYPE] || !tb[TCA_PEDIT_KEY_EX_CMD]) { - err = -EINVAL; + NL_SET_ERR_MSG_MOD(extack, "Extended Pedit missing required attributes"); goto err_out; } @@ -83,23 +78,21 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, if (k->htype > TCA_PEDIT_HDR_TYPE_MAX || k->cmd > TCA_PEDIT_CMD_MAX) { - err = -EINVAL; + NL_SET_ERR_MSG_MOD(extack, "Extended Pedit key is malformed"); goto err_out; } k++; } - if (n) { - err = -EINVAL; + if (n) goto err_out; - } return keys_ex; err_out: kfree(keys_ex); - return ERR_PTR(err); + return ERR_PTR(-EINVAL); } static int tcf_pedit_key_ex_dump(struct sk_buff *skb, @@ -222,7 +215,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, } nparms->tcfp_keys_ex = - tcf_pedit_keys_ex_parse(tb[TCA_PEDIT_KEYS_EX], parm->nkeys); + tcf_pedit_keys_ex_parse(tb[TCA_PEDIT_KEYS_EX], parm->nkeys, extack); if (IS_ERR(nparms->tcfp_keys_ex)) { ret = PTR_ERR(nparms->tcfp_keys_ex); goto out_free; From patchwork Thu Mar 9 18:51:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13168059 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B14C64EC4 for ; Thu, 9 Mar 2023 18:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjCISwe (ORCPT ); Thu, 9 Mar 2023 13:52:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjCISw3 (ORCPT ); Thu, 9 Mar 2023 13:52:29 -0500 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59DBFAED0 for ; Thu, 9 Mar 2023 10:52:14 -0800 (PST) Received: by mail-ot1-x32a.google.com with SMTP id m25-20020a05683026d900b006941a2838caso1606115otu.7 for ; Thu, 09 Mar 2023 10:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; t=1678387934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G0L8emv2pJSrZmSSOqCvjwuklxY4YhMLOQGqbfEikcU=; b=3p3xwetV1Ic6E1/kfNET58dtntwVFEIVT7Cb7VQryTd7XcFpWAup3oCkhnUAa/DQqD u1gE6q1jRaonCcR4r4WXG9y/n3A+fzdqPyH5JBG18aHzrjtaL6aVvoCKQmHXknSIPsmZ CZHkqMssFdcB7a6H+wKddtGwnKaTIQWpPTGsmaFuq2HpP3HjVNSijj5jnnTy7h4pv1GZ 6GddAiEGNzZoo2bd2LObdkZxl+9Ay0iPrvJ7ePyPgmUvXS9wTqFL64XscNcb3PBsS7BP LcfdCYAFIjS0152XvLU3CXVsIlu6/+sUjrH3BMO10FB+il9mCAQTtXlXzCeC4mWFYp2X GTPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678387934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G0L8emv2pJSrZmSSOqCvjwuklxY4YhMLOQGqbfEikcU=; b=5PtvRLPWdXNsa3jUmb4Pg2nyIz3azkCL/KjhPxTyA6T8mTYXKZEBw+3G/CLWEES0Mq FPg6/E2Gy3wvYzoEViALxxPWk7Kcs5g1nltHdLQsC6fkrImjYJto7FDRED2+rVu5RgXd XrvyREAyDedKZbkRCxQb/m5ZKIp65vqZkfRuFFG85d/1bc2ddYw+FEDV0AOG764E+QVG 0F70/rfUhuJti1GiCW5z4qbP+EIhJ4f3417Xpouet1owX7zjT7C/LoydR3CbL7OLv2Ky 7WXodY7/ChmmuOlK3NaCMusxTzIGQ8vFNli+XfSIWEhSb9aWeeCPdTr+pS++GaSsqK+S qkug== X-Gm-Message-State: AO0yUKX0F9lbXcPy4FB30gtG5al1O4eHDdAOCw1Rmtax5m/2uGCnP4Pk BrshLYyXncySyn5tZndP6jw6Ub1vV54VmrdYP8w= X-Google-Smtp-Source: AK7set9e2wpi2fhVpnXXdAaJPBrJkDCyUb69TE27qGdHi3nkGNX507qm5ctSdro93UcjweZGpZ7FMw== X-Received: by 2002:a9d:705c:0:b0:694:3972:dbad with SMTP id x28-20020a9d705c000000b006943972dbadmr10379327otj.12.1678387934061; Thu, 09 Mar 2023 10:52:14 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:d22f:e7ce:9ab3:d054]) by smtp.gmail.com with ESMTPSA id o25-20020a9d7199000000b0068657984c22sm63248otj.32.2023.03.09.10.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 10:52:13 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [PATCH net-next 2/3] net/sched: act_pedit: check static offsets a priori Date: Thu, 9 Mar 2023 15:51:57 -0300 Message-Id: <20230309185158.310994-3-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309185158.310994-1-pctammela@mojatatu.com> References: <20230309185158.310994-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Static key offsets should always be on 32 bit boundaries. Validate them on create/update time for static offsets and move the datapath validation for runtime offsets only. iproute2 already errors out if a given offset and data size cannot be packed to a 32 bit boundary. This change will make sure users which create/update pedit instances directly via netlink also error out, instead of finding out when packets are traversing. Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela Reviewed-by: Simon Horman --- net/sched/act_pedit.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index f4ebe06aeaf2..e42cbfc369ff 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -242,6 +242,12 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, for (i = 0; i < nparms->tcfp_nkeys; ++i) { u32 cur = nparms->tcfp_keys[i].off; + if (cur % 4) { + NL_SET_ERR_MSG_MOD(extack, "Pedit offsets must be on 32bit boundaries"); + ret = -EINVAL; + goto put_chain; + } + /* sanitize the shift value for any later use */ nparms->tcfp_keys[i].shift = min_t(size_t, BITS_PER_TYPE(int) - 1, @@ -400,12 +406,12 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb, sizeof(_d), &_d); if (!d) goto bad; - offset += (*d & tkey->offmask) >> tkey->shift; - } - if (offset % 4) { - pr_info("tc action pedit offset must be on 32 bit boundaries\n"); - goto bad; + offset += (*d & tkey->offmask) >> tkey->shift; + if (offset % 4) { + pr_info("tc action pedit offset must be on 32 bit boundaries\n"); + goto bad; + } } if (!offset_valid(skb, hoffset + offset)) { From patchwork Thu Mar 9 18:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13168060 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EAF6C61DA4 for ; Thu, 9 Mar 2023 18:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbjCISwh (ORCPT ); Thu, 9 Mar 2023 13:52:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjCISwa (ORCPT ); Thu, 9 Mar 2023 13:52:30 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF1E1FA8E7 for ; Thu, 9 Mar 2023 10:52:17 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id r23-20020a05683001d700b00690eb18529fso1620295ota.1 for ; Thu, 09 Mar 2023 10:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; t=1678387937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WSGMSYSX6IsJrRKeSPwghMZU2+X4vAr4S/os1lTIXGg=; b=itqyp/gFScnrMAykSA6hIN0yafMJSpBcdGlsKx3D+MwzxNzRUed7+nGQtm6aBlmniN VXaQxj2Ga9Gc8l7giKkX87lgVeBfS1zPkGdTAlzSqxa60AJUxL0dB+JY+ml2IC3Ld9dS JnmLMiDnmsm9ldNs8oUWexCQFnZg55HtoVXN4pQbR99mH2MHBjag2n8ZaUhpvlU8RoXY Vx9YeaxwJR6V6pBbcTCJyHF/TKb9Wy2SHbpyjMJRBvXWWsr0wUA3SIfcfXQb351XhEIq GrTUU2+T1O7Q7ZJREuTyEn7VqMUtvgor+njL9kolQSE/D0UicubCcR+yHbhXQGooTIJT v9Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678387937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WSGMSYSX6IsJrRKeSPwghMZU2+X4vAr4S/os1lTIXGg=; b=P37aTzRgPyEsl3KY5HrqFIJeQeis6/6oW9TTtWy8TrT7ui6ZLSVftkoUlu1392OQjS wbOxZvGOx7S9uFiW6NPEdqhGaVIQ2EnMIvtcXbdkjShv3ETRFV7qdDWtVRfH4La0X+2o YJmShsymY2tb0W+JyfOm9zsl37ug5OXCiVKc6IIrwsS4kkBAX2H3P/MOyW3Q1NOlU4O0 8Y9/cVHa4+NBkcgPJvZPSZw3WaC3j/5TDFSuGt0NSkeOcJt+ifnOyFyFfTgdLkmFGbAQ uFYSngBY5vVVBOeiOJ85WlJGig+jzFsJMWlXQJzqDmA6bscwEZ3Y3gAD/7EaGASaoj4/ 0oyQ== X-Gm-Message-State: AO0yUKUv97mcEcsdNzrQr8bO6+YYEw21adD2cRmnj3UCVSiQkJTp6gqb 1vLE3AVuAMDcnSV8APvEHoWeRLnuT3p4UdfTGsQ= X-Google-Smtp-Source: AK7set/BHR44V79w3vWPDG2SMPGJBEdtg/bBw4O6G5EZjkDwoSqn8My3EHmXuATG02hy/ptBmByPVQ== X-Received: by 2002:a9d:1782:0:b0:68b:e0bc:c533 with SMTP id j2-20020a9d1782000000b0068be0bcc533mr10724715otj.20.1678387937026; Thu, 09 Mar 2023 10:52:17 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:d22f:e7ce:9ab3:d054]) by smtp.gmail.com with ESMTPSA id o25-20020a9d7199000000b0068657984c22sm63248otj.32.2023.03.09.10.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 10:52:16 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [PATCH net-next 3/3] net/sched: act_pedit: rate limit datapath messages Date: Thu, 9 Mar 2023 15:51:58 -0300 Message-Id: <20230309185158.310994-4-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309185158.310994-1-pctammela@mojatatu.com> References: <20230309185158.310994-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Unbounded info messages in the pedit datapath can flood the printk ring buffer quite easily depending on the action created. As these messages are informational, usually printing some, not all, is enough to bring attention to the real issue. Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- net/sched/act_pedit.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index e42cbfc369ff..b5a8fc19ee55 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -388,9 +388,8 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb, } rc = pedit_skb_hdr_offset(skb, htype, &hoffset); - if (rc) { - pr_info("tc action pedit bad header type specified (0x%x)\n", - htype); + if (unlikely(rc)) { + pr_info_ratelimited("tc action pedit bad header type specified (0x%x)\n", htype); goto bad; } @@ -398,8 +397,8 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb, u8 *d, _d; if (!offset_valid(skb, hoffset + tkey->at)) { - pr_info("tc action pedit 'at' offset %d out of bounds\n", - hoffset + tkey->at); + pr_info_ratelimited("tc action pedit 'at' offset %d out of bounds\n", + hoffset + tkey->at); goto bad; } d = skb_header_pointer(skb, hoffset + tkey->at, @@ -409,14 +408,13 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb, offset += (*d & tkey->offmask) >> tkey->shift; if (offset % 4) { - pr_info("tc action pedit offset must be on 32 bit boundaries\n"); + pr_info_ratelimited("tc action pedit offset must be on 32 bit boundaries\n"); goto bad; } } if (!offset_valid(skb, hoffset + offset)) { - pr_info("tc action pedit offset %d out of bounds\n", - hoffset + offset); + pr_info_ratelimited("tc action pedit offset %d out of bounds\n", hoffset + offset); goto bad; } @@ -433,8 +431,7 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb, val = (*ptr + tkey->val) & ~tkey->mask; break; default: - pr_info("tc action pedit bad command (%d)\n", - cmd); + pr_info_ratelimited("tc action pedit bad command (%d)\n", cmd); goto bad; }