2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
11 DEFAULT_IP="192.168.49.1"
12 DEFAULT_NET="192.168.49.1/24"
13 DEFAULT_BRD="192.168.49.255"
15 if [ ! -f @SBIN_DIR@/ip ]; then
16 interface=`@SBIN_DIR@/ifconfig -a|/bin/grep ${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f1`
18 interface=`@SBIN_DIR@/ip link|/bin/grep ${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f2`
20 echo "Target is ${TARGET} and interface ${INTERFACE_PREFIX}: ${interface}."
24 if [ "X${interface}" == "X" ]; then
25 echo "interface(${INTERFACE_PREFIX}) is not up"
29 /bin/rm /@TZ_SYS_VAR@/lib/misc/dhcpd.leases
30 /bin/touch @TZ_SYS_VAR@/lib/misc/dhcpd.leases
31 if [ ! -f @SBIN_DIR@/ip ]; then
32 @SBIN_DIR@/ifconfig ${interface} ${DEFAULT_IP} up
34 @SBIN_DIR@/ip addr add ${DEFAULT_NET} brd ${DEFAULT_BRD} dev ${interface}
36 @SBIN_DIR@/dhcpd -S -i ${interface} @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf -f &
38 route=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep router | /bin/awk '{print $3}'`
39 if [ -z $route ]; then
42 subnet=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep subnet | /bin/awk '{print $3}'`
44 if [ -z $subnet ]; then
45 subnet="255.255.255.0"
51 if [ "X${interface}" == "X" ]; then
52 echo "interface(${INTERFACE_PREFIX}) is not up"
56 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
57 @BIN_DIR@/dhcp -S -i $interface -s @TZ_SYS_RO_ETC@/wifi-direct/udhcp_script.non-autoip &
63 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname "" -f
64 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask "" -f
65 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway "" -f
66 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip "" -f
67 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
72 @BIN_DIR@/pkill -x dhcp
73 @BIN_DIR@/pkill -x dhcpd
74 if [ "X${interface}" == "X" ]; then
75 echo "interface(${INTERFACE_PREFIX}) is not up"
79 if [ ! -f @SBIN_DIR@/ip ]; then
80 @SBIN_DIR@/ifconfig ${interface} "0.0.0.0"
82 @SBIN_DIR@/ip addr del ${local_ip_net} dev ${interface}
89 run=`/bin/ps -eo comm|/bin/grep ${program}`
90 if [ "X${run}" == "X" ]; then
91 echo "${program} is not running"
93 echo "${program} is already running"
99 is_running @BIN_DIR@/dhcp
100 is_running @SBIN_DIR@/dhcpd
122 /bin/echo wifi-direct-dhcp.sh [server] [client] [stop] [status]