Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP mode enhancements #326

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion overlay/lower/etc/init.d/S49ntpd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ TMP_CONF="/tmp/ntp.conf"

start() {
starting
[ "true" = "$(get wlanap_enabled)" ] && quit "AP mode"
if [ "true" = "$(get wlanap_enabled)" ]; then
touch $TMP_CONF
DAEMON_ARGS="-n -l"
fi

if [ -f $TMP_CONF ]; then
info "work config found"
Expand Down
6 changes: 3 additions & 3 deletions package/busybox/busybox.config
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ CONFIG_NSLOOKUP=y
CONFIG_FEATURE_NSLOOKUP_BIG=y
CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y
CONFIG_NTPD=y
# CONFIG_FEATURE_NTPD_SERVER is not set
CONFIG_FEATURE_NTPD_SERVER=y
CONFIG_FEATURE_NTPD_CONF=y
CONFIG_FEATURE_NTP_AUTH=y
CONFIG_PING=y
Expand Down Expand Up @@ -1007,9 +1007,9 @@ CONFIG_FEATURE_WGET_TIMEOUT=y
# CONFIG_ZCIP is not set
CONFIG_UDHCPD=y
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
CONFIG_DHCPD_LEASES_FILE=""
# CONFIG_DUMPLEASES is not set
CONFIG_DUMPLEASES=y
# CONFIG_DHCPRELAY is not set
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
Expand Down
6 changes: 5 additions & 1 deletion package/thingino-ap/files/S42wifiap
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ case "$1" in
ip link set $net_dev up
ip route add ${CNET}.0/24 dev $net_dev > /dev/null 2>&1

cp /etc/dnsd-ap.conf /tmp/dnsd.conf
hostname=$(get hostname)
grep $hostname /tmp/dnsd.conf > /dev/null || echo $hostname.local ${CNET}.1 >> /tmp/dnsd.conf

start-stop-daemon -S -x /sbin/udhcpd -- -S -I ${CNET}.1 /etc/udhcpd-ap.conf 2>&1
start-stop-daemon -S -x /sbin/dnsd -- -i ${CNET}.1 -c /etc/dnsd-ap.conf -d | log
start-stop-daemon -S -x /sbin/dnsd -- -i ${CNET}.1 -c /tmp/dnsd.conf -d | log

mac_address=$(ip link show $net_dev | awk '/ether/ {print $2}')
last_two=$(echo $mac_address | awk -F: '{print $(NF-1) $NF}')
Expand Down
14 changes: 14 additions & 0 deletions package/thingino-ap/files/hosts-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

HOSTS=/tmp/dnsd.conf

cp /etc/dnsd-ap.conf ${HOSTS}
hostname=$(get hostname)
grep $hostname ${HOSTS} > /dev/null || echo $(hostname).local $(hostname -i) >> ${HOSTS}

dumpleases -f /run/udhcpd_ap.leases -d | grep -v "^Mac Address" |
while read line; do
ip=$(echo $line | cut -s -F 2)
hostname=$(echo $line | cut -s -F 3)
[ " " != "${line:34:1}" ] && echo $hostname.local $ip >> ${HOSTS}
done
2 changes: 1 addition & 1 deletion package/thingino-ap/files/udhcpd-ap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ offer_time 60 # 1 min
min_lease 60 # 1 min
lease_file /var/run/udhcpd_ap.leases
pidfile /var/run/udhcpd_ap.pid
#notify_file dumpleases
notify_file /sbin/hosts-update

opt dns 100.64.1.1
option subnet 255.255.255.0
Expand Down
3 changes: 3 additions & 0 deletions package/thingino-ap/thingino-ap.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ define THINGINO_AP_INSTALL_TARGET_CMDS

$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d/ $(THINGINO_AP_PKGDIR)/files/S42wifiap

$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/sbin/ $(THINGINO_AP_PKGDIR)/files/hosts-update
endef

$(eval $(generic-package))