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

Juerg Haefliger juerg.haefliger at canonical.com
Thu Nov 23 14:19:15 UTC 2023


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 at 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}"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20231123/06a9f0da/attachment.sig>


More information about the kernel-team mailing list