* [PATCH] net/tap: Set locally administered bit with a fixed MAC address
@ 2023-04-25 20:58 David Christensen
2023-04-26 0:39 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: David Christensen @ 2023-04-25 20:58 UTC (permalink / raw)
To: dev; +Cc: David Christensen
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:<iface_idx>. 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:<iface_idx>.
Bugzilla ID: 1198
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
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:<iface_idx> */
- memcpy((char *)user_mac->addr_bytes, "\0dtap",
+ /* fixed mac = 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] =
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
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/tap: Set locally administered bit with a fixed MAC address
2023-04-25 20:58 [PATCH] net/tap: Set locally administered bit with a fixed MAC address David Christensen
@ 2023-04-26 0:39 ` Stephen Hemminger
2023-04-26 15:58 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2023-04-26 0:39 UTC (permalink / raw)
To: David Christensen; +Cc: dev
On Tue, 25 Apr 2023 16:58:06 -0400
David Christensen <drc@linux.vnet.ibm.com> wrote:
> 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:<iface_idx>. 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:<iface_idx>.
>
> Bugzilla ID: 1198
>
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/tap: Set locally administered bit with a fixed MAC address
2023-04-26 0:39 ` Stephen Hemminger
@ 2023-04-26 15:58 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2023-04-26 15:58 UTC (permalink / raw)
To: Stephen Hemminger, David Christensen; +Cc: dev, Radu Nicolau, Akhil Goyal
On 4/26/2023 1:39 AM, Stephen Hemminger wrote:
> On Tue, 25 Apr 2023 16:58:06 -0400
> David Christensen <drc@linux.vnet.ibm.com> wrote:
>
>> 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:<iface_idx>. 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:<iface_idx>.
>>
>> Bugzilla ID: 1198
>>
>> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>
Bugzilla ID: 1198
Fixes: f6921783fee6 ("net/tap: add support for fixed MAC addresses")
Cc: stable@dpdk.org
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
Applied to dpdk-next-net/main, thanks.
Dropped 'examples/ipsec-secgw/test/common_defs.sh' change while merging,
although it is a minor change can you please send a separate patch for it?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-26 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 20:58 [PATCH] net/tap: Set locally administered bit with a fixed MAC address David Christensen
2023-04-26 0:39 ` Stephen Hemminger
2023-04-26 15:58 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).