diff mbox series

[SRU,M:meta-laptop] UBUNTU: Set persistent wifi MAC address

Message ID 20231027182729.52300-1-juerg.haefliger@canonical.com
State New
Headers show
Series [SRU,M:meta-laptop] UBUNTU: Set persistent wifi MAC address | expand

Commit Message

Juerg Haefliger Oct. 27, 2023, 6:27 p.m. UTC
BugLink: https://bugs.launchpad.net/2039144

The X13s comes up with a random wifi MAC address, because it's hidden
probably in secret storage that the kernel can't get to (yet). This can
be problematic for some environments and MAC address randomization should
really be handled by NetworkManager. So set a unique and persistent
MAC based on /etc/machine-id.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
 share/set-wifi-mac-addr                     | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
 create mode 100755 share/set-wifi-mac-addr

Comments

Dimitri John Ledkov Nov. 22, 2023, 11:52 a.m. UTC | #1
On Fri, 27 Oct 2023 at 19:28, Juerg Haefliger
<juerg.haefliger@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/2039144
>
> The X13s comes up with a random wifi MAC address, because it's hidden
> probably in secret storage that the kernel can't get to (yet). This can
> be problematic for some environments and MAC address randomization should
> really be handled by NetworkManager. So set a unique and persistent
> MAC based on /etc/machine-id.
>
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
>  share/set-wifi-mac-addr                     | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
>  create mode 100755 share/set-wifi-mac-addr
>
> diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
> new file mode 100644
> index 000000000000..e667f9d13f3a
> --- /dev/null
> +++ b/rules.d/60-laptop-persistent-wifi-mac.rules
> @@ -0,0 +1,2 @@
> +# Set wifi MAC on X13s
> +SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
> diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
> new file mode 100755
> index 000000000000..1b56e22e5638
> --- /dev/null
> +++ b/share/set-wifi-mac-addr
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Set X13s wifi MAC address
> +#
> +
> +intf=${1}
> +
> +# Bytes 2-4 from /etc/machine-id
> +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
> +
> +# Qualcomm OUI
> +oui="8c:fd:f0"
> +
> +mac="${oui}:${nic}"
> +echo "Set MAC addr of ${intf} to ${mac}"
> +/bin/ip link set "${intf}" address "${mac}"
> --
> 2.39.2
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Note, for the meta change, we can respin meta alone to get these mac
address fixes out to the users.

Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>

okurrr,

Dimitri
Thibault Ferrante Nov. 22, 2023, 12:45 p.m. UTC | #2
On 27-10-2023 20:27, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/2039144
> 
> The X13s comes up with a random wifi MAC address, because it's hidden
> probably in secret storage that the kernel can't get to (yet). This can
> be problematic for some environments and MAC address randomization should
> really be handled by NetworkManager. So set a unique and persistent
> MAC based on /etc/machine-id.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
>   share/set-wifi-mac-addr                     | 16 ++++++++++++++++
>   2 files changed, 18 insertions(+)
>   create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
>   create mode 100755 share/set-wifi-mac-addr
> 
> diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
> new file mode 100644
> index 000000000000..e667f9d13f3a
> --- /dev/null
> +++ b/rules.d/60-laptop-persistent-wifi-mac.rules
> @@ -0,0 +1,2 @@
> +# Set wifi MAC on X13s
> +SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
> diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
> new file mode 100755
> index 000000000000..1b56e22e5638
> --- /dev/null
> +++ b/share/set-wifi-mac-addr
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Set X13s wifi MAC address
> +#
> +
> +intf=${1}
> +
> +# Bytes 2-4 from /etc/machine-id
> +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
> +
> +# Qualcomm OUI
> +oui="8c:fd:f0"
> +
> +mac="${oui}:${nic}"
> +echo "Set MAC addr of ${intf} to ${mac}"
> +/bin/ip link set "${intf}" address "${mac}"

Acked-by: Thibault Ferrante <thibault.ferrante@canonical.com>

--
Thibault
Manuel Diewald Nov. 22, 2023, 12:55 p.m. UTC | #3
On Fri, Oct 27, 2023 at 08:27:29PM +0200, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/2039144
> 

I cannot access the BugLink ('Error: Page not found'). Should it be
public?

> The X13s comes up with a random wifi MAC address, because it's hidden
> probably in secret storage that the kernel can't get to (yet). This can
> be problematic for some environments and MAC address randomization should
> really be handled by NetworkManager. So set a unique and persistent
> MAC based on /etc/machine-id.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
>  share/set-wifi-mac-addr                     | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
>  create mode 100755 share/set-wifi-mac-addr
> 
> diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
> new file mode 100644
> index 000000000000..e667f9d13f3a
> --- /dev/null
> +++ b/rules.d/60-laptop-persistent-wifi-mac.rules
> @@ -0,0 +1,2 @@
> +# Set wifi MAC on X13s
> +SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
> diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
> new file mode 100755
> index 000000000000..1b56e22e5638
> --- /dev/null
> +++ b/share/set-wifi-mac-addr
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Set X13s wifi MAC address
> +#
> +
> +intf=${1}
> +
> +# Bytes 2-4 from /etc/machine-id
> +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
> +
> +# Qualcomm OUI
> +oui="8c:fd:f0"
> +
> +mac="${oui}:${nic}"
> +echo "Set MAC addr of ${intf} to ${mac}"
> +/bin/ip link set "${intf}" address "${mac}"
> -- 
> 2.39.2
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Manuel Diewald <manuel.diewald@canonical.com>
Juerg Haefliger Nov. 23, 2023, 2:19 p.m. UTC | #4
Applied to ~ubuntu-concept/ubuntu/+source/linux-meta/+git/mantic linux-laptop
branch.

...Juerg


> BugLink: https://bugs.launchpad.net/2039144
> 
> The X13s comes up with a random wifi MAC address, because it's hidden
> probably in secret storage that the kernel can't get to (yet). This can
> be problematic for some environments and MAC address randomization should
> really be handled by NetworkManager. So set a unique and persistent
> MAC based on /etc/machine-id.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
>  share/set-wifi-mac-addr                     | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
>  create mode 100755 share/set-wifi-mac-addr
> 
> diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
> new file mode 100644
> index 000000000000..e667f9d13f3a
> --- /dev/null
> +++ b/rules.d/60-laptop-persistent-wifi-mac.rules
> @@ -0,0 +1,2 @@
> +# Set wifi MAC on X13s
> +SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
> diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
> new file mode 100755
> index 000000000000..1b56e22e5638
> --- /dev/null
> +++ b/share/set-wifi-mac-addr
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Set X13s wifi MAC address
> +#
> +
> +intf=${1}
> +
> +# Bytes 2-4 from /etc/machine-id
> +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
> +
> +# Qualcomm OUI
> +oui="8c:fd:f0"
> +
> +mac="${oui}:${nic}"
> +echo "Set MAC addr of ${intf} to ${mac}"
> +/bin/ip link set "${intf}" address "${mac}"
Juerg Haefliger Nov. 23, 2023, 2:19 p.m. UTC | #5
Applied to ~ubuntu-concept/ubuntu/+source/linux-meta/+git/mantic linux-laptop
branch.

...Juerg


> BugLink: https://bugs.launchpad.net/2039144
> 
> The X13s comes up with a random wifi MAC address, because it's hidden
> probably in secret storage that the kernel can't get to (yet). This can
> be problematic for some environments and MAC address randomization should
> really be handled by NetworkManager. So set a unique and persistent
> MAC based on /etc/machine-id.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  rules.d/60-laptop-persistent-wifi-mac.rules |  2 ++
>  share/set-wifi-mac-addr                     | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 rules.d/60-laptop-persistent-wifi-mac.rules
>  create mode 100755 share/set-wifi-mac-addr
> 
> diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
> new file mode 100644
> index 000000000000..e667f9d13f3a
> --- /dev/null
> +++ b/rules.d/60-laptop-persistent-wifi-mac.rules
> @@ -0,0 +1,2 @@
> +# Set wifi MAC on X13s
> +SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
> diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
> new file mode 100755
> index 000000000000..1b56e22e5638
> --- /dev/null
> +++ b/share/set-wifi-mac-addr
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Set X13s wifi MAC address
> +#
> +
> +intf=${1}
> +
> +# Bytes 2-4 from /etc/machine-id
> +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
> +
> +# Qualcomm OUI
> +oui="8c:fd:f0"
> +
> +mac="${oui}:${nic}"
> +echo "Set MAC addr of ${intf} to ${mac}"
> +/bin/ip link set "${intf}" address "${mac}"
diff mbox series

Patch

diff --git a/rules.d/60-laptop-persistent-wifi-mac.rules b/rules.d/60-laptop-persistent-wifi-mac.rules
new file mode 100644
index 000000000000..e667f9d13f3a
--- /dev/null
+++ b/rules.d/60-laptop-persistent-wifi-mac.rules
@@ -0,0 +1,2 @@ 
+# Set wifi MAC on X13s
+SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x17cb", ATTRS{device}=="0x1103", PROGRAM="/usr/share/linux-laptop/set-wifi-mac-addr %k"
diff --git a/share/set-wifi-mac-addr b/share/set-wifi-mac-addr
new file mode 100755
index 000000000000..1b56e22e5638
--- /dev/null
+++ b/share/set-wifi-mac-addr
@@ -0,0 +1,16 @@ 
+#!/bin/sh
+#
+# Set X13s wifi MAC address
+#
+
+intf=${1}
+
+# Bytes 2-4 from /etc/machine-id
+nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)
+
+# Qualcomm OUI
+oui="8c:fd:f0"
+
+mac="${oui}:${nic}"
+echo "Set MAC addr of ${intf} to ${mac}"
+/bin/ip link set "${intf}" address "${mac}"