You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
825 B
Bash

#!/bin/sh
# Copyright (c) 2016 Qualcomm Atheros, Inc.
#
# All Rights Reserved.
# Qualcomm Atheros Confidential and Proprietary.
. /lib/functions/repacd-netdet.sh
ENABLED=$(uci get repacd.repacd.EnableLANWANDetect)
if [ "$ENABLED" -eq 1 ] && [ "$EVENT" == "direction" ] && [ "$STATE" == "upstream" ]; then
logger -t hotplug-switch -p user.info "detecting mode because port $PORT is $STATE"
pkill -9 -f repacd-detect_device_mode.sh 2>/dev/null || true
logger -t hotplug-switch -p user.debug "waiting for DHCP address"
sleep 5
repacd_netdet_wait_for_dhcp_addr eth0
if [ $? -eq 1 ]; then
logger -t hotplug-switch -p user.debug "we timed out waiting for a DHCP address"
else
logger -t hotplug-switch -p user.debug "we got a DHCP address"
fi
repacd-detect_device_mode.sh &
fi