From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24A04A054A for ; Tue, 25 Oct 2022 17:10:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C24E42C3C; Tue, 25 Oct 2022 17:10:13 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 6CCC742C34 for ; Tue, 25 Oct 2022 17:10:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666710610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TNOH3U+juwuZKbSe0HGYiJCuyOCPCobULzJc4XKypGI=; b=ccIKi46cwRlBzaY8dazy22m6h96qHFxLAYUwxkvQcPjt+oxAL2QzzZmPJifcteJLdATf8V LRUyGngXdxZpcaY/gE89waY2rEDURlZrYTJXoiJMzWzSVI6rePFVhbB3RWOAcrHpPhI5TQ QJLfDIdWkZAl0BAY45NIw7Bc95tbIf0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-281-LtMotKczN3Sed5-5Bs0UAw-1; Tue, 25 Oct 2022 11:10:07 -0400 X-MC-Unique: LtMotKczN3Sed5-5Bs0UAw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 012771C0BC61; Tue, 25 Oct 2022 15:10:06 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBD7D4A9255; Tue, 25 Oct 2022 15:10:04 +0000 (UTC) From: Kevin Traynor To: Alex Kiselev Cc: Stephen Hemminger , dpdk stable Subject: patch 'net/tap: fix overflow of network interface index' has been queued to stable release 21.11.3 Date: Tue, 25 Oct 2022 16:07:27 +0100 Message-Id: <20221025150734.142189-92-ktraynor@redhat.com> In-Reply-To: <20221025150734.142189-1-ktraynor@redhat.com> References: <20221025150734.142189-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/01/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/37560c8deb988246db128907e5fcb115eb3f4eb0 Thanks. Kevin --- >From 37560c8deb988246db128907e5fcb115eb3f4eb0 Mon Sep 17 00:00:00 2001 From: Alex Kiselev Date: Thu, 21 Jul 2022 11:13:01 +0000 Subject: [PATCH] net/tap: fix overflow of network interface index [ upstream commit 8772bbfa717fdf3251b32ea48bdd21ddd6836dde ] On Linux and most other systems, network interface index is a 32-bit integer. Indexes overflowing the 16-bit integer are frequently seen when used inside a Docker container. Fixes: 7c25284e30c2 ("net/tap: add netlink back-end for flow API") Fixes: 2bc06869cd94 ("net/tap: add remote netdevice traffic capture") Signed-off-by: Alex Kiselev Acked-by: Stephen Hemminger --- drivers/net/tap/tap_flow.c | 2 +- drivers/net/tap/tap_tcmsgs.c | 18 +++++++++--------- drivers/net/tap/tap_tcmsgs.h | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 7673823945..f53bc297f8 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1685,5 +1685,5 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, struct rte_flow_attr *attr = &implicit_rte_flows[idx].attr; struct rte_flow_item_eth eth_local = { .type = 0 }; - uint16_t if_index = pmd->remote_if_index; + unsigned int if_index = pmd->remote_if_index; struct rte_flow *remote_flow = NULL; struct nlmsg *msg = NULL; diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c index b478b5951e..a3aae3c814 100644 --- a/drivers/net/tap/tap_tcmsgs.c +++ b/drivers/net/tap/tap_tcmsgs.c @@ -20,5 +20,5 @@ struct qdisc { struct list_args { int nlsk_fd; - uint16_t ifindex; + unsigned int ifindex; void *custom_arg; }; @@ -43,5 +43,5 @@ struct qdisc_custom_arg { */ void -tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, uint16_t flags) +tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags) { struct nlmsghdr *n = &msg->nh; @@ -71,5 +71,5 @@ tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, uint16_t flags) */ static int -qdisc_del(int nlsk_fd, uint16_t ifindex, struct qdisc *qinfo) +qdisc_del(int nlsk_fd, unsigned int ifindex, struct qdisc *qinfo) { struct nlmsg msg; @@ -115,5 +115,5 @@ error: */ int -qdisc_add_multiq(int nlsk_fd, uint16_t ifindex) +qdisc_add_multiq(int nlsk_fd, unsigned int ifindex) { struct tc_multiq_qopt opt = {0}; @@ -145,5 +145,5 @@ qdisc_add_multiq(int nlsk_fd, uint16_t ifindex) */ int -qdisc_add_ingress(int nlsk_fd, uint16_t ifindex) +qdisc_add_ingress(int nlsk_fd, unsigned int ifindex) { struct nlmsg msg; @@ -209,5 +209,5 @@ qdisc_del_cb(struct nlmsghdr *nh, void *arg) */ static int -qdisc_iterate(int nlsk_fd, uint16_t ifindex, +qdisc_iterate(int nlsk_fd, unsigned int ifindex, int (*callback)(struct nlmsghdr *, void *), void *arg) { @@ -239,5 +239,5 @@ qdisc_iterate(int nlsk_fd, uint16_t ifindex, */ int -qdisc_flush(int nlsk_fd, uint16_t ifindex) +qdisc_flush(int nlsk_fd, unsigned int ifindex) { return qdisc_iterate(nlsk_fd, ifindex, qdisc_del_cb, NULL); @@ -257,5 +257,5 @@ qdisc_flush(int nlsk_fd, uint16_t ifindex) */ int -qdisc_create_multiq(int nlsk_fd, uint16_t ifindex) +qdisc_create_multiq(int nlsk_fd, unsigned int ifindex) { int err = 0; @@ -283,5 +283,5 @@ qdisc_create_multiq(int nlsk_fd, uint16_t ifindex) */ int -qdisc_create_ingress(int nlsk_fd, uint16_t ifindex) +qdisc_create_ingress(int nlsk_fd, unsigned int ifindex) { int err = 0; diff --git a/drivers/net/tap/tap_tcmsgs.h b/drivers/net/tap/tap_tcmsgs.h index 8cedea8462..a64cb29d6f 100644 --- a/drivers/net/tap/tap_tcmsgs.h +++ b/drivers/net/tap/tap_tcmsgs.h @@ -25,13 +25,13 @@ #define MULTIQ_MAJOR_HANDLE (1 << 16) -void tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, +void tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags); -int qdisc_list(int nlsk_fd, uint16_t ifindex); -int qdisc_flush(int nlsk_fd, uint16_t ifindex); -int qdisc_create_ingress(int nlsk_fd, uint16_t ifindex); -int qdisc_create_multiq(int nlsk_fd, uint16_t ifindex); -int qdisc_add_ingress(int nlsk_fd, uint16_t ifindex); -int qdisc_add_multiq(int nlsk_fd, uint16_t ifindex); -int filter_list_ingress(int nlsk_fd, uint16_t ifindex); +int qdisc_list(int nlsk_fd, unsigned int ifindex); +int qdisc_flush(int nlsk_fd, unsigned int ifindex); +int qdisc_create_ingress(int nlsk_fd, unsigned int ifindex); +int qdisc_create_multiq(int nlsk_fd, unsigned int ifindex); +int qdisc_add_ingress(int nlsk_fd, unsigned int ifindex); +int qdisc_add_multiq(int nlsk_fd, unsigned int ifindex); +int filter_list_ingress(int nlsk_fd, unsigned int ifindex); #endif /* _TAP_TCMSGS_H_ */ -- 2.37.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-10-25 14:19:00.617725325 +0100 +++ 0092-net-tap-fix-overflow-of-network-interface-index.patch 2022-10-25 14:18:58.534798532 +0100 @@ -1 +1 @@ -From 8772bbfa717fdf3251b32ea48bdd21ddd6836dde Mon Sep 17 00:00:00 2001 +From 37560c8deb988246db128907e5fcb115eb3f4eb0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8772bbfa717fdf3251b32ea48bdd21ddd6836dde ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index a9a55e439e..efe66fe059 100644 +index 7673823945..f53bc297f8 100644 @@ -26 +27 @@ -@@ -1683,5 +1683,5 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, +@@ -1685,5 +1685,5 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,