9 DEFAULT_IP="192.168.49.1"
10 DEFAULT_NET="192.168.49.1/24"
11 DEFAULT_BRD="192.168.49.255"
13 if [ ! -f @SBIN_DIR@/ip ]; then
14 interface=`@SBIN_DIR@/ifconfig -a|/bin/grep ${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f1`
16 interface=`@SBIN_DIR@/ip link|/bin/grep ${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f2`
18 echo "Target is ${TARGET} and interface ${INTERFACE_PREFIX}: ${interface}."
22 if [ "X${interface}" == "X" ]; then
23 echo "interface(${INTERFACE_PREFIX}) is not up"
27 /bin/rm /@TZ_SYS_VAR@/lib/misc/dhcpd.leases
28 /bin/touch @TZ_SYS_VAR@/lib/misc/dhcpd.leases
29 if [ ! -f @SBIN_DIR@/ip ]; then
30 @SBIN_DIR@/ifconfig ${interface} ${DEFAULT_IP} up
32 @SBIN_DIR@/ip addr add ${DEFAULT_NET} brd ${DEFAULT_BRD} dev ${interface}
34 @SBIN_DIR@/dhcpd -S -i ${interface} @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf -f &
36 route=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep router | /bin/awk '{print $3}'`
37 if [ -z $route ]; then
40 subnet=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep subnet | /bin/awk '{print $3}'`
42 if [ -z $subnet ]; then
43 subnet="255.255.255.0"
46 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f
47 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f
48 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${route} -f
49 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${DEFAULT_IP} -f
54 if [ "X${interface}" == "X" ]; then
55 echo "interface(${INTERFACE_PREFIX}) is not up"
59 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
60 @BIN_DIR@/dhcp -S -i $interface -s @TZ_SYS_RO_ETC@/wifi-direct/udhcp_script.non-autoip &
66 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname "" -f
67 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask "" -f
68 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway "" -f
69 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip "" -f
70 @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
75 @BIN_DIR@/pkill -x dhcp
76 @BIN_DIR@/pkill -x dhcpd
77 if [ "X${interface}" == "X" ]; then
78 echo "interface(${INTERFACE_PREFIX}) is not up"
82 if [ ! -f @SBIN_DIR@/ip ]; then
83 @SBIN_DIR@/ifconfig ${interface} "0.0.0.0"
85 @SBIN_DIR@/ip addr del ${local_ip_net} dev ${interface}
92 run=`/bin/ps -eo comm|/bin/grep ${program}`
93 if [ "X${run}" == "X" ]; then
94 echo "${program} is not running"
96 echo "${program} is already running"
102 is_running @BIN_DIR@/dhcp
103 is_running @SBIN_DIR@/dhcpd
125 /bin/echo wifi-direct-dhcp.sh [server] [client] [stop] [status]