Skip to content

Commit

Permalink
wb-set-mac: disable MAC setting for wb6 and newer (#29)
Browse files Browse the repository at this point in the history
* wb-set-mac: disable MAC setting for wb6 and newer
  • Loading branch information
webconn authored Dec 24, 2021
1 parent 3813ef8 commit 9b1e9f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-utils (3.1.0) stable; urgency=medium

* wb-set-mac: disable MAC setting for wb6 and newer

-- Nikita Maslov <[email protected]> Mon, 13 Dec 2021 17:40:50 +0300

wb-utils (3.0.0) stable; urgency=medium

* switch all services to systemd (wb-init, wb-watch-update, wb-gsm-rtc)
Expand Down
23 changes: 8 additions & 15 deletions utils/bin/wb-set-mac
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/bin/bash

. /usr/lib/wb-utils/wb_env.sh
wb_source "of"

IFACE=${IFACE:-$1}
[[ -n "$IFACE" ]] || {
echo "IFACE is unset"
exit 1
}

[[ -z "$WB_VERSION" ]] && . /usr/lib/wb-utils/wb_env.sh

set_saved_mac() {
local saved_mac="/var/lib/wirenboard/${IFACE}_mac.conf"
[[ -e "$saved_mac" ]] && [[ -s "$saved_mac" ]] &&
ip link set "$IFACE" address "$(cat "$saved_mac")" || true
}

case "$WB_VERSION" in
"60" | "61" )
# If random MAC is used (i.e. not set in DT by U-Boot or manually
# configured), fallback to the usual way. Otherwise, do nothing.
addr_type=$(cat "/sys/class/net/$IFACE/addr_assign_type")
[[ "$addr_type" == 1 ]] && set_saved_mac || true
;;

*)
set_saved_mac
;;
esac

if of_machine_match "fsl,imx23" || of_machine_match "fsl,imx28" ; then
# set mac from saved location for Wiren Board 5 or older
set_saved_mac
fi

0 comments on commit 9b1e9f6

Please sign in to comment.