From patchwork Tue Apr 25 20:58:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Christensen X-Patchwork-Id: 126521 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D0C5429D8; Tue, 25 Apr 2023 22:58:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E44B1410D0; Tue, 25 Apr 2023 22:58:24 +0200 (CEST) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id C2E8F40ED6 for ; Tue, 25 Apr 2023 22:58:23 +0200 (CEST) Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33PKmWss003877 for ; Tue, 25 Apr 2023 20:58:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=QK0QbQDfR3/2osaH1TVhvfEi1G9QcFeNhJ7sGmzT3mA=; b=csRwBy84nOwDtVL7icasONT8fkXDqoyX6v1rwucCd99hCOCHuKlMQyQtr+OtHFFpJMlO +qQoF2tDOE4gN18jt7f9ODvhCaEpqLlMonN0JLQ7HfQ33yV9PGgyai//BucCWW7AUSjY OGLOXFs6yFndYEJ0UN31ckwP4xEAbsrsn5PYDoHlPIqH63IXFniKnCZ69vdkl3oeOXNC EA6gqlLjHDZRcVjqs4zE0ZvIaZ3BCNmgBrMP4oMc68bP/89dCOw520uwZVM7X7A7I543 TTbon6xJLgnGzXp1BFOh1bA34gG/tFX909jAEbE9QoY5X8rQqnN6WmhPkBQwghmj9Z7P Ag== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q6nup96cg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 25 Apr 2023 20:58:22 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33PIjrsv026874 for ; Tue, 25 Apr 2023 20:58:22 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([9.208.129.119]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3q4778245k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 25 Apr 2023 20:58:22 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33PKwLMv26346122 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Apr 2023 20:58:21 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10DDE58055; Tue, 25 Apr 2023 20:58:21 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD25B5804E; Tue, 25 Apr 2023 20:58:20 +0000 (GMT) Received: from ltc19u30.pok.stglabs.ibm.com (unknown [9.114.224.51]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 25 Apr 2023 20:58:20 +0000 (GMT) From: David Christensen To: dev@dpdk.org Cc: David Christensen Subject: [PATCH] net/tap: Set locally administered bit with a fixed MAC address Date: Tue, 25 Apr 2023 16:58:06 -0400 Message-Id: <20230425205806.776057-1-drc@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BszGbl_9a7NSEu8ANjHRPRZSegPAqt1o X-Proofpoint-ORIG-GUID: BszGbl_9a7NSEu8ANjHRPRZSegPAqt1o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-25_08,2023-04-25_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 clxscore=1011 impostorscore=0 spamscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304250183 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When the tap driver is loaded and the user selects the optional "mac=fixed" setting, the tap driver incorrectly uses a globally unique EUI-48 identifier (as documented in RFC 7042) of 00:64:74:61:70:. Since this is a locally generated ID, the Local bit in the MAC address should be set to 1, resulting in the new address 02:64:74:61:70:. Bugzilla ID: 1198 Signed-off-by: David Christensen Acked-by: Stephen Hemminger Acked-by: Ferruh Yigit --- doc/guides/nics/tap.rst | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 4 ++-- examples/ipsec-secgw/test/common_defs.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst index 2f7417bddd..07df0d35a2 100644 --- a/doc/guides/nics/tap.rst +++ b/doc/guides/nics/tap.rst @@ -34,14 +34,14 @@ Using the option ``mac=fixed`` you can create a fixed known MAC address:: The MAC address will have a fixed value with the last octet incrementing by one for each interface string containing ``mac=fixed``. The MAC address is formatted -as 00:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get the -actual MAC address: ``00:64:74:61:70:[00-FF]``. +as 02:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get the +actual MAC address: ``02:64:74:61:70:[00-FF]``. - --vdev=net_tap0,mac="00:64:74:61:70:11" + --vdev=net_tap0,mac="02:64:74:61:70:11" The MAC address will have a user value passed as string. The MAC address is in format with delimiter ``:``. The string is byte converted to hex and you get -the actual MAC address: ``00:64:74:61:70:11``. +the actual MAC address: ``02:64:74:61:70:11``. It is possible to specify a remote netdevice to capture packets from by adding ``remote=foo1``, for example:: diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 089ac202fa..bf98f75559 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2303,8 +2303,8 @@ set_mac_type(const char *key __rte_unused, if (!strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED))) { static int iface_idx; - /* fixed mac = 00:64:74:61:70: */ - memcpy((char *)user_mac->addr_bytes, "\0dtap", + /* fixed mac = 02:64:74:61:70: */ + memcpy((char *)user_mac->addr_bytes, "\002dtap", RTE_ETHER_ADDR_LEN); user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] = iface_idx++ + '0'; diff --git a/examples/ipsec-secgw/test/common_defs.sh b/examples/ipsec-secgw/test/common_defs.sh index 3ef06bc761..6e04ffc1a6 100644 --- a/examples/ipsec-secgw/test/common_defs.sh +++ b/examples/ipsec-secgw/test/common_defs.sh @@ -26,7 +26,7 @@ fi LOCAL_IFACE=dtap0 -LOCAL_MAC="00:64:74:61:70:30" +LOCAL_MAC="02:64:74:61:70:30" REMOTE_IPV4=192.168.31.14 LOCAL_IPV4=192.168.31.92