From nobody Sat Dec 31 12:04:18 2022 X-Original-To: dev-commits-src-branches@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 4Nkglk6sJsz2nJ4R; Sat, 31 Dec 2022 12:04:18 +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 4Nkglk65XMz4HMj; Sat, 31 Dec 2022 12:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672488258; 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=Qn4tOpn5G6YIGn7hcavDcLax91RetlgXeMT92l37mSw=; b=qv7zehHYZ0LEFza/SDRhI35yKX2oMnjXzYzNLUx2Iv0e25BM/8497ymxmLJpVUGN8bpu92 JZuaFxSu2m51D/cricsGq+xZi8IA7WuJcXdOhKugincnvhQyJYsipAyRjku2OGBVbprPln yaNYBNPklZzhtFj1b2ihTL1IKqKzPolyWsJhmJnYJln5vAiXrgA0jGr7UAPS0IBNL3k5MA 5MN1iHjlEH8kafqgm8KNFa7jYAsZLlz8gTjPvhTLYMzz5fPkv0IP3tnzCTbGh1TMSYuyar 3SrDe3cUQlOvc5rG4mz0yFbIsOdjca1dmbh3vYG6F6by5e52f5nAwqg9NGNMFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672488258; 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=Qn4tOpn5G6YIGn7hcavDcLax91RetlgXeMT92l37mSw=; b=pECwKQ5/TGO/7Ge7xqZIm49hfQwnJUYjAUBLLnOXx9HeHkj58Dg1+b5SOeO58UvsmhPAeI ckZlHarpui05xXUttB07EGwGB4GWkiqWca8ZJ5KJCDM+rNoHuAGDsoibeU3V1dgUjQ8aRq e+vgh/8itas9RS8jK/2lDq5eDcaQPLs9L4LMW7ZEYath2g//XIUkw9aHQDmaL1FyU1VcpV GupANAEySM2nykatvaiQpA0rDGwqYDOgF/reCLK9CkvwWGtNqP2ImIOO1TeiG2cOyUiv8s qLjpgB0oi1zvz0JzXOaq5pl5fDUWeyYX2RwAEuywkqilC3lwM/diQs0Y+Mg0Fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672488258; a=rsa-sha256; cv=none; b=CNoRmAMYwe++DSo+3L4MEuxmpCWji6iGN5o3o0+OUtcVqJjVVOnY7JVdTMg6IaNibhGuXY 7yOyEDphG6si+KGpVCyRAfm1Ef+MrQkBhLlyi3p4atdhmYYHeCNQZvYFWKqQtQjWPCFW8u RQ6J2+0YU/EsK5MWO+Dr5BdxsDeq6jeJgBt+pi0jSam1+67aHCyGKWr9PvAGyPeK5xo4eQ U75gsXM1sYtOVxCPmqVWL6fDN+NVIGX5/dNaMGYmPgl7UqCqAJhkwvifrjRhkh/I9/XWs9 qy+9W1qzCLeLifLTkrNYixHBh+AXY+dRlC/btc391jUAzBqDc68AIpGvKH6F+w== 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 4Nkglk58WvzngW; Sat, 31 Dec 2022 12:04:18 +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 2BVC4I4I040884; Sat, 31 Dec 2022 12:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BVC4Ide040883; Sat, 31 Dec 2022 12:04:18 GMT (envelope-from git) Date: Sat, 31 Dec 2022 12:04:18 GMT Message-Id: <202212311204.2BVC4Ide040883@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: 01e19f7b8620 - stable/13 - netmap: pkt-gen: fix ifname before cmp in source_hwaddr List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 01e19f7b86209cf8017e09392abed7cdde867354 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=01e19f7b86209cf8017e09392abed7cdde867354 commit 01e19f7b86209cf8017e09392abed7cdde867354 Author: Vincenzo Maffione AuthorDate: 2022-12-24 16:06:05 +0000 Commit: Vincenzo Maffione CommitDate: 2022-12-31 12:04:03 +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;