From nobody Sat Dec 31 12:29:20 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NkhJc6ybHz2nMTP; Sat, 31 Dec 2022 12:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NkhJc66mRz4Kts; Sat, 31 Dec 2022 12:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672489760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eOwPsdjAccJjzilTkkHUrA9/FXn+/OGyM0RwtMsTrdo=; b=ZKrh7fdY5gTDshtCWQTB3DObjeBsQv0AeLpoAZFZe5BIWy39wM2obXyttg0OelM2GY3v6f 2rdlhgTohf0k8e+vNIV7FKQly3AkUmllm39WBpr3ZaBit2ZmWIJNJiXlsIlz2fS5oiGVlx NeCe1Ah/NNxP0ZHdQh9u23JOioBly8G/w1divp0DOS439NspYZciuYjcu4e+wT35sChPHf zRgksMxm1Dv8AMjTGWfTavRBZqAa0aQ23/UMkt7lCFtyJfrOvNl2LEtnndoqDvBYKXOxqK oR+j7zsPrrRCFMtUX2+NT/bXunDQCm9YYtcqWqJ7sagTeJPwKVwtFlha0v5q0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672489760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eOwPsdjAccJjzilTkkHUrA9/FXn+/OGyM0RwtMsTrdo=; b=EeugtuE/W4ee+uefJ06lf4f41YeeYvY3BqxCesWrfhPcnvxttEKppbzrqcJERB9AaCJKUy nWDATeKDi5nBXADmJlorQzSwJ0MdMEieUjYYn+qsI1cjp1Xv305RgCPoZrmC/dYXuIgukn zv27660jy/2BllUQY2YNtu/4X50dCZE0Pl/NZD5euOHX+azl7wNEI0zZ0koDD3DTERjBMo O0Vv9DhfvFPD193WFl/MHjUcBFXekBp8DC950Rwvn8JYFyVp+CSIJQNaeyACd5FkHUX1rR eVPG6wkf/mzVtOXsemRwbHYBX32TsHC4DOKe1bE++YrLfe5dp6L20zmHdRjzzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672489760; a=rsa-sha256; cv=none; b=HXvySp20lcxxL361aTBBw5tqdrMCVwFiHhHfQXZWR5dZk4HcX/5xqyUuDyQmKAe5h2hrbG scJFXr+6P+9BFax80cwGboOSgVh4xxc1ppYjHPjElag9XXensPOkh9hgo16KGJinXFNqrB UCP38AHXetm/LV847SwcHbKPhwHnxpO9/cuIz5sAT+uJqlG/VD9pbcCQovwzplCAHCSPWW nQ1IRkFujDPG2iGut85Kxw/2f3LB2wGAuG5uOP/0P7acYJa2xUDgSE4u1ZW3w2XWiJL2Zd 6qYeiKQaw1mBQkX5Zjs4CFmCpLmnlfE6moM6oA3cvCBgA6NhqAVfXY0n5YIiJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NkhJc533Sznlf; Sat, 31 Dec 2022 12:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BVCTKQE070105; Sat, 31 Dec 2022 12:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BVCTK9n070104; Sat, 31 Dec 2022 12:29:20 GMT (envelope-from git) Date: Sat, 31 Dec 2022 12:29:20 GMT Message-Id: <202212311229.2BVCTK9n070104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 7a1e0af7d0df - stable/12 - netmap: pkt-gen: fix ifname before cmp in source_hwaddr List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7a1e0af7d0df51e7a45beb890e5053192d1dc33e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=7a1e0af7d0df51e7a45beb890e5053192d1dc33e commit 7a1e0af7d0df51e7a45beb890e5053192d1dc33e Author: Vincenzo Maffione AuthorDate: 2022-12-24 16:06:05 +0000 Commit: Vincenzo Maffione CommitDate: 2022-12-31 12:14:49 +0000 netmap: pkt-gen: fix ifname before cmp in source_hwaddr In source_hwaddr(), the configured ifname is compared against all interfaces. However, in main(), the string 'netmap:' is prepended to the interface string if no explicit type is given. Therefore the ifname will not match any system interface and the source MAC address is always empty. Check for the leading 'netmap:' string and skip past it to match against system interfaces. Note that 'tap:' and 'pcap:' devices strip the type string from the ifname in main() so no further work is needed. MFC after: 7 days Submitted by: Brian Poole (cherry picked from commit eda82511883f540cd18f8afd2268636c7db97685) --- tools/tools/netmap/pkt-gen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index 4518c2fd4219..3ecdbd2c3cc4 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -684,6 +684,10 @@ source_hwaddr(const char *ifname, char *buf) return (-1); } + /* remove 'netmap:' prefix before comparing interfaces */ + if (!strncmp(ifname, "netmap:", 7)) + ifname = &ifname[7]; + for (ifap = ifaphead; ifap; ifap = ifap->ifa_next) { struct sockaddr_dl *sdl = (struct sockaddr_dl *)ifap->ifa_addr;