From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0FACA42824;
	Thu, 23 Mar 2023 18:12:40 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E6C9040E09;
	Thu, 23 Mar 2023 18:12:39 +0100 (CET)
Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178])
 by mails.dpdk.org (Postfix) with ESMTP id 135614021E
 for <dev@dpdk.org>; Thu, 23 Mar 2023 18:12:38 +0100 (CET)
Received: by inbox.dpdk.org (Postfix, from userid 33)
 id 04B2942826; Thu, 23 Mar 2023 18:12:38 +0100 (CET)
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [Bug 1198] Tap driver incorrectly uses globally unique ID when
 "mac=fixed" is specified
Date: Thu, 23 Mar 2023 17:12:38 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: DPDK
X-Bugzilla-Component: core
X-Bugzilla-Version: 23.03
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: normal
X-Bugzilla-Who: drc@linux.vnet.ibm.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: dev@dpdk.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
 op_sys bug_status bug_severity priority component assigned_to reporter
 target_milestone
Message-ID: <bug-1198-3@http.bugs.dpdk.org/>
Content-Type: multipart/alternative; boundary=16795915570.7cF57868.1946938
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
MIME-Version: 1.0
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org


--16795915570.7cF57868.1946938
Date: Thu, 23 Mar 2023 18:12:37 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

https://bugs.dpdk.org/show_bug.cgi?id=3D1198

            Bug ID: 1198
           Summary: Tap driver incorrectly uses globally unique ID when
                    "mac=3Dfixed" is specified
           Product: DPDK
           Version: 23.03
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: drc@linux.vnet.ibm.com
  Target Milestone: ---

When the tap driver is loaded and the user selects the optional "mac=3Dfixe=
d"
setting, the tap driver incorrectly uses a globally unique EUI-48 identifier
(as documented in RFC 7042).  Since this is a locally generated ID, the Loc=
al
bit in the MAC address should be set to 1.

The following change is suggested:

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=3Dfixed`` 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=3Dfixed``. The MAC address is
formatted
-as 00:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get t=
he
-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 t=
he
+actual MAC address: ``02:64:74:61:70:[00-FF]``.

-   --vdev=3Dnet_tap0,mac=3D"00:64:74:61:70:11"
+   --vdev=3Dnet_tap0,mac=3D"02:64:74:61:70:11"

 The MAC address will have a user value passed as string. The MAC address i=
s in
 format with delimiter ``:``. The string is byte converted to hex and you g=
et
-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 ad=
ding
 ``remote=3Dfoo1``, for example::
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 8c50801fd4..02f8066635 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2280,8 +2280,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 =3D 00:64:74:61:70:<iface_idx> */
-               memcpy((char *)user_mac->addr_bytes, "\0dtap",
+               /* fixed mac =3D 02:64:74:61:70:<iface_idx> */
+               memcpy((char *)user_mac->addr_bytes, "\002dtap",
                        RTE_ETHER_ADDR_LEN);
                user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] =3D
                        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=3Ddtap0

-LOCAL_MAC=3D"00:64:74:61:70:30"
+LOCAL_MAC=3D"02:64:74:61:70:30"

 REMOTE_IPV4=3D192.168.31.14
 LOCAL_IPV4=3D192.168.31.92

--=20
You are receiving this mail because:
You are the assignee for the bug.=

--16795915570.7cF57868.1946938
Date: Thu, 23 Mar 2023 18:12:37 +0100
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<html>
    <head>
      <base href=3D"https://bugs.dpdk.org/">
    </head>
    <body><table border=3D"1" cellspacing=3D"0" cellpadding=3D"8" class=3D"=
bz_new_table">
        <tr>
          <th>Bug ID</th>
          <td><a class=3D"bz_bug_link=20
          bz_status_UNCONFIRMED "
   title=3D"UNCONFIRMED - Tap driver incorrectly uses globally unique ID wh=
en &quot;mac=3Dfixed&quot; is specified"
   href=3D"https://bugs.dpdk.org/show_bug.cgi?id=3D1198">1198</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Tap driver incorrectly uses globally unique ID when &quot;mac=
=3Dfixed&quot; is specified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>23.03
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>core
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev&#64;dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>drc&#64;linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class=3D"bz_comment_block">
          <pre class=3D"bz_comment_text">When the tap driver is loaded and =
the user selects the optional &quot;mac=3Dfixed&quot;
setting, the tap driver incorrectly uses a globally unique EUI-48 identifier
(as documented in RFC 7042).  Since this is a locally generated ID, the Loc=
al
bit in the MAC address should be set to 1.

The following change is suggested:

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
&#64;&#64; -34,14 +34,14 &#64;&#64; Using the option ``mac=3Dfixed`` you ca=
n 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=3Dfixed``. The MAC address is
formatted
-as 00:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get t=
he
-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 t=
he
+actual MAC address: ``02:64:74:61:70:[00-FF]``.

-   --vdev=3Dnet_tap0,mac=3D&quot;00:64:74:61:70:11&quot;
+   --vdev=3Dnet_tap0,mac=3D&quot;02:64:74:61:70:11&quot;

 The MAC address will have a user value passed as string. The MAC address i=
s in
 format with delimiter ``:``. The string is byte converted to hex and you g=
et
-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 ad=
ding
 ``remote=3Dfoo1``, for example::
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 8c50801fd4..02f8066635 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
&#64;&#64; -2280,8 +2280,8 &#64;&#64; set_mac_type(const char *key __rte_un=
used,
        if (!strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED=
)))
{
                static int iface_idx;

-               /* fixed mac =3D 00:64:74:61:70:&lt;iface_idx&gt; */
-               memcpy((char *)user_mac-&gt;addr_bytes, &quot;\0dtap&quot;,
+               /* fixed mac =3D 02:64:74:61:70:&lt;iface_idx&gt; */
+               memcpy((char *)user_mac-&gt;addr_bytes, &quot;\002dtap&quot=
;,
                        RTE_ETHER_ADDR_LEN);
                user_mac-&gt;addr_bytes[RTE_ETHER_ADDR_LEN - 1] =3D
                        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
&#64;&#64; -26,7 +26,7 &#64;&#64; fi

 LOCAL_IFACE=3Ddtap0

-LOCAL_MAC=3D&quot;00:64:74:61:70:30&quot;
+LOCAL_MAC=3D&quot;02:64:74:61:70:30&quot;

 REMOTE_IPV4=3D192.168.31.14
 LOCAL_IPV4=3D192.168.31.92
          </pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
      <div itemscope itemtype=3D"http://schema.org/EmailMessage">
        <div itemprop=3D"action" itemscope itemtype=3D"http://schema.org/Vi=
ewAction">
=20=20=20=20=20=20=20=20=20=20
          <link itemprop=3D"url" href=3D"https://bugs.dpdk.org/show_bug.cgi=
?id=3D1198">
          <meta itemprop=3D"name" content=3D"View bug">
        </div>
        <meta itemprop=3D"description" content=3D"Bugzilla bug update notif=
ication">
      </div>
    </body>
</html>=

--16795915570.7cF57868.1946938--