From 367415663fc52b9a7a203513f4993febf81150d7 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 30 Nov 2023 11:03:06 +0100 Subject: [PATCH] cfg80211: pass default country code to cfg80211 during module load Signed-off-by: John Crispin --- .../files/etc/init.d/{certificates => early_boot} | 13 +++++++++++-- .../ucentral-schema/files/etc/board.d/04-regdm | 2 +- profiles/ucentral-ap.yml | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) rename feeds/tip/certificates/files/etc/init.d/{certificates => early_boot} (58%) diff --git a/feeds/tip/certificates/files/etc/init.d/certificates b/feeds/tip/certificates/files/etc/init.d/early_boot similarity index 58% rename from feeds/tip/certificates/files/etc/init.d/certificates rename to feeds/tip/certificates/files/etc/init.d/early_boot index 9cb41c4f7..c0fcdfe98 100755 --- a/feeds/tip/certificates/files/etc/init.d/certificates +++ b/feeds/tip/certificates/files/etc/init.d/early_boot @@ -1,6 +1,6 @@ #!/bin/sh /etc/rc.common -START=80 +START=09 copy_certificates() { [ -f /certificates/key.pem ] || return @@ -10,9 +10,18 @@ copy_certificates() { chmod 0440 root.network /etc/ucentral/*.pem [ -f /certificates/gateway.json ] && cp /certificates/gateway.json /etc/ucentral/ [ -f /certificates/dev-id ] && cp /certificates/dev-id /etc/ucentral/ - [ -f /etc/ucentral/dev-id] && chmod 0400 /etc/ucentral/dev-id + [ -f /etc/ucentral/dev-id ] && chmod 0400 /etc/ucentral/dev-id [ -f /certificates/restrictions.json ] && cp /certificates/restrictions.json /etc/ucentral/ [ -f /certificates/sign_pubkey.pem ] && cp /certificates/sign_pubkey.pem /etc/ucentral/ + country=`cat /certificates/ucentral.defaults | jsonfilter -e '@.country'` + [ -z "$country" -a -f /etc/uci-defaults/30_uboot-envtools ] && { + (. /etc/uci-defaults/30_uboot-envtools) + fw_printenv + country=$(fw_printenv -n country) + } + [ -z "$country" ] && country=US + echo "options cfg80211 ieee80211_regdom="$country > /etc/modules.conf + echo -n $country > /etc/ucentral/country exit 0 } diff --git a/feeds/ucentral/ucentral-schema/files/etc/board.d/04-regdm b/feeds/ucentral/ucentral-schema/files/etc/board.d/04-regdm index 04f697ab4..e2e523c8d 100755 --- a/feeds/ucentral/ucentral-schema/files/etc/board.d/04-regdm +++ b/feeds/ucentral/ucentral-schema/files/etc/board.d/04-regdm @@ -18,7 +18,7 @@ cig,wf660a) ;; cig,wf188n|\ cig,wf196) - ucidef_set_wifi_country "$(cat /lib/firmware/country)" + ucidef_set_wifi_country "US CA MY DE" ;; esac diff --git a/profiles/ucentral-ap.yml b/profiles/ucentral-ap.yml index d1a6fe782..f8ac946c7 100644 --- a/profiles/ucentral-ap.yml +++ b/profiles/ucentral-ap.yml @@ -63,6 +63,7 @@ packages: - umdns - oping - vxlan + - wireless-regdb - wpad-openssl diffconfig: | CONFIG_OPENSSL_ENGINE=y