Tizen directory path migration 22/62022/1 submit/tizen/20160314.023602
authorYu Jiung <jiung.yu@samsung.com>
Mon, 14 Mar 2016 01:53:36 +0000 (10:53 +0900)
committerYu Jiung <jiung.yu@samsung.com>
Mon, 14 Mar 2016 01:53:50 +0000 (10:53 +0900)
Change-Id: I48d830b6a77c6afc5314fbab40f0c923713089c6
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
21 files changed:
CMakeLists.txt
files/dhcpd-notify.sh [deleted file]
files/dhcpd-notify.sh.in [new file with mode: 0755]
files/dhcpd.conf.in [moved from files/dhcpd.conf with 73% similarity]
files/p2p_supp.conf.in [moved from files/p2p_supp.conf with 87% similarity]
files/p2p_supp.sh [deleted file]
files/p2p_supp.sh.in [new file with mode: 0755]
files/udhcp_script.non-autoip.in [moved from files/udhcp_script.non-autoip with 71% similarity]
files/wifi-direct-dhcp.sh [deleted file]
files/wifi-direct-dhcp.sh.in [new file with mode: 0644]
files/wifi-direct-server.sh.in [moved from files/wifi-direct-server.sh with 92% similarity]
include/wifi-direct-ipc.h
include/wifi-direct-util.h
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/CMakeLists.txt
plugin/wpasupplicant/ctrl_iface_dbus/include/wfd-plugin-wpasupplicant.h
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c
plugin/wpasupplicant/ctrl_iface_sock/CMakeLists.txt
plugin/wpasupplicant/ctrl_iface_sock/include/wfd-plugin-wpasupplicant.h
plugin/wpasupplicant/ctrl_iface_sock/wfd-plugin-wpasupplicant.c
src/wifi-direct-util.c

index 8979ab3..12be6f0 100755 (executable)
@@ -1,12 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(wfd-manager C)
 
-#SET(PREFIX $(CMAKE_INSTALL_PREFIX))
-SET(prefix "/usr")
-SET(EXEC_PREFIX "\${prefix}")
-SET(LIBDIR "\${prefix}/lib")
-SET(INCLUDEDIR "\${prefix}/include")
-
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED capi-network-wifi-direct glib-2.0 gio-2.0 gobject-2.0 dlog libnl-2.0 capi-appfw-application vconf cynara-client cynara-creds-socket cynara-session aul${MDM_REQUIRED_PKGS})
 FOREACH(flag ${pkgs_CFLAGS})
@@ -93,16 +87,25 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl)
 
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/dhcpd-notify.sh.in ${CMAKE_SOURCE_DIR}/files/dhcpd-notify.sh @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/dhcpd.conf.in ${CMAKE_SOURCE_DIR}/files/dhcpd.conf @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/p2p_supp.conf.in ${CMAKE_SOURCE_DIR}/files/p2p_supp.conf @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/p2p_supp.sh.in ${CMAKE_SOURCE_DIR}/files/p2p_supp.sh @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/udhcp_script.non-autoip.in ${CMAKE_SOURCE_DIR}/files/udhcp_script.non-autoip @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/wifi-direct-dhcp.sh.in ${CMAKE_SOURCE_DIR}/files/wifi-direct-dhcp.sh @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/files/wifi-direct-server.sh.in ${CMAKE_SOURCE_DIR}/files/wifi-direct-server.sh @ONLY)
+
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/udhcp_script.non-autoip DESTINATION etc/wifi-direct)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/wifi-direct-server.sh DESTINATION bin)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.sh DESTINATION sbin)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/ccode.conf DESTINATION etc/wifi-direct)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/dhcpd-notify.sh DESTINATION bin)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.conf DESTINATION etc/wifi-direct)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.conf DESTINATION /opt/etc)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/dhcpd.conf DESTINATION etc/wifi-direct)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/wifi-direct-dhcp.sh DESTINATION bin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/udhcp_script.non-autoip DESTINATION ${TZ_SYS_RO_ETC}/wifi-direct)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/wifi-direct-server.sh DESTINATION ${BIN_DIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.sh DESTINATION ${SBIN_DIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/ccode.conf DESTINATION ${TZ_SYS_RO_ETC}/wifi-direct)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/dhcpd-notify.sh DESTINATION ${BIN_DIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.conf DESTINATION ${TZ_SYS_RO_ETC}/wifi-direct)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/p2p_supp.conf DESTINATION ${TZ_SYS_ETC})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/dhcpd.conf DESTINATION ${TZ_SYS_RO_ETC}/wifi-direct)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/files/wifi-direct-dhcp.sh DESTINATION ${BIN_DIR})
 
 IF("${ARCH}" MATCHES "^arm.*|.*86.*")
        IF(CTRL_IFACE_DBUS)
diff --git a/files/dhcpd-notify.sh b/files/dhcpd-notify.sh
deleted file mode 100755 (executable)
index e6c0afe..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-# Dump DHCP lease data: MAC IP Time
-/usr/bin/dumpleases -f /opt/var/lib/misc/dhcpd.leases | /bin/awk '$1!="Mac" {print $1, $2, $3}' > /tmp/dhcp-client-table
-
-#Update vconf value to notify wifi-direct
-/usr/bin/vconftool set -t int memory/private/wifi_direct_manager/dhcp_ip_lease 1 -f
-#cat /tmp/dhcp-client-table
diff --git a/files/dhcpd-notify.sh.in b/files/dhcpd-notify.sh.in
new file mode 100755 (executable)
index 0000000..c81cef5
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Dump DHCP lease data: MAC IP Time
+@BIN_DIR@/dumpleases -f @TZ_SYS_VAR@/lib/misc/dhcpd.leases | /bin/awk '$1!="Mac" {print $1, $2, $3}' > /tmp/dhcp-client-table
+
+#Update vconf value to notify wifi-direct
+@BIN_DIR@/vconftool set -t int memory/private/wifi_direct_manager/dhcp_ip_lease 1 -f
+#cat /tmp/dhcp-client-table
similarity index 73%
rename from files/dhcpd.conf
rename to files/dhcpd.conf.in
index 7668a36..5ed780c 100644 (file)
@@ -1,8 +1,8 @@
 start           192.168.49.20             #default: 192.168.0.20
 end             192.168.49.40             #default: 192.168.0.254
 max_leases      20                        #default: 254
-notify_file     /usr/bin/dhcpd-notify.sh
-lease_file      /opt/var/lib/misc/dhcpd.leases  #default: /var/lib/misc/udhcpd.leases
+notify_file     @BIN_DIR@/dhcpd-notify.sh
+lease_file      @TZ_SYS_VAR@/lib/misc/dhcpd.leases  #default: /var/lib/misc/udhcpd.leases
 
 option          subnet     255.255.255.0
 option          router     192.168.49.1
similarity index 87%
rename from files/p2p_supp.conf
rename to files/p2p_supp.conf.in
index 36f32ca..3310467 100644 (file)
@@ -1,5 +1,5 @@
 ##### p2p_supplicant configuration file template #####
-ctrl_interface=/var/run/wpa_supplicant
+ctrl_interface=@TZ_SYS_RUN@/wpa_supplicant
 update_config=1
 eapol_version=1
 ap_scan=1
diff --git a/files/p2p_supp.sh b/files/p2p_supp.sh
deleted file mode 100755 (executable)
index 3393616..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-
-PROGRAM="/usr/sbin/wpa_supplicant"
-
-start()
-{
-       HARDWARE_MODEL=`/bin/grep Hardware /proc/cpuinfo | /bin/awk "{print \\$3}"`
-       /bin/echo "Hardware Model=${HARDWARE_MODEL}"
-
-       if [ -e /opt/etc/p2p_supp.conf ]; then
-               echo "File exist: /opt/etc/p2p_supp.conf"
-       else
-               echo "File not exist. Reinstall: /opt/etc/p2p_supp.conf"
-                /bin/cp /usr/etc/wifi-direct/p2p_supp.conf /opt/etc/
-       fi
-       ## For Hawk-P Platform, Hardware model is Samsung
-       if [ $HARDWARE_MODEL = "Samsung" ];then
-               /usr/sbin/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c/opt/etc/p2p_supp.conf -g/var/run/wpa_global  -f/var/log/wpa_supplicant.log
-        else
-               /usr/sbin/wpa_supplicant -t -B -C/var/run/wpa_supplicant -ddd -Dnl80211 -iwlan0 -c/opt/etc/p2p_supp.conf -f/var/log/wpa_supplicant.log
-       fi
- }
-
-start_p2p0()
-{
-       if [ -e /opt/etc/p2p_supp.conf ]; then
-               echo "File exist: /opt/etc/p2p_supp.conf"
-       else
-               echo "File not exist. Reinstall: /opt/etc/p2p_supp.conf"
-                /bin/cp /usr/etc/wifi-direct/p2p_supp.conf /opt/etc/
-       fi
-       /usr/sbin/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c/opt/etc/p2p_supp.conf -f/var/log/wpa_supplicant.log
-}
-
-start_dbus()
-{
-       program=${PROGRAM}
-       run=`/bin/ps -eo comm|/bin/grep ${program}`
-       if [ "X${run}" == "X" ]; then
-               echo "${program} is not running"
-               if [ -e /opt/etc/p2p_supp.conf ]; then
-                       echo "File exist: /opt/etc/p2p_supp.conf"
-               else
-                       echo "File not exist. Reinstall: /opt/etc/p2p_supp.conf"
-                        /bin/cp /usr/etc/wifi-direct/p2p_supp.conf /opt/etc/
-               fi
-               /usr/sbin/wpa_supplicant -t -B -u -ddd -K -f/var/log/wpa_supplicant.log
-       else
-               echo "${program} is already running"
-       fi
-}
-
-stop()
-{
-       /usr/bin/pkill -x wpa_supplicant
-}
-
-case $1 in
-"start")
-start
-;;
-"start_p2p0")
-start_p2p0
-;;
-"start_dbus")
-start_dbus
-;;
-"stop")
-stop
-;;
-*)
-/bin/echo p2p_supp.sh [start] [start_p2p0] [start_dbus] [stop]
-exit 1
-;;
-esac
diff --git a/files/p2p_supp.sh.in b/files/p2p_supp.sh.in
new file mode 100755 (executable)
index 0000000..63b43ff
--- /dev/null
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+PROGRAM="@SBIN_DIR@/wpa_supplicant"
+
+start()
+{
+       HARDWARE_MODEL=`/bin/grep Hardware /proc/cpuinfo | /bin/awk "{print \\$3}"`
+       /bin/echo "Hardware Model=${HARDWARE_MODEL}"
+
+       if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
+               echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
+       else
+               echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
+                /bin/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
+       fi
+       ## For Hawk-P Platform, Hardware model is Samsung
+       if [ $HARDWARE_MODEL = "Samsung" ];then
+               @SBIN_DIR@/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c@TZ_SYS_ETC@/p2p_supp.conf -g@TZ_SYS_RUN@/wpa_global  -f/var/log/wpa_supplicant.log
+        else
+               @SBIN_DIR@/wpa_supplicant -t -B -C@TZ_SYS_RUN@/wpa_supplicant -ddd -Dnl80211 -iwlan0 -c@TZ_SYS_ETC@/p2p_supp.conf -f/var/log/wpa_supplicant.log
+       fi
+ }
+
+start_p2p0()
+{
+       if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
+               echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
+       else
+               echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
+                /bin/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
+       fi
+       @SBIN_DIR@/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c@TZ_SYS_ETC@/p2p_supp.conf -f/var/log/wpa_supplicant.log
+}
+
+start_dbus()
+{
+       program=${PROGRAM}
+       run=`/bin/ps -eo comm|/bin/grep ${program}`
+       if [ "X${run}" == "X" ]; then
+               echo "${program} is not running"
+               if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
+                       echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
+               else
+                       echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
+                        /bin/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
+               fi
+               @SBIN_DIR@/wpa_supplicant -t -B -u -ddd -K -f/var/log/wpa_supplicant.log
+       else
+               echo "${program} is already running"
+       fi
+}
+
+stop()
+{
+       @BIN_DIR@/pkill -x wpa_supplicant
+}
+
+case $1 in
+"start")
+start
+;;
+"start_p2p0")
+start_p2p0
+;;
+"start_dbus")
+start_dbus
+;;
+"stop")
+stop
+;;
+*)
+/bin/echo p2p_supp.sh [start] [start_p2p0] [start_dbus] [stop]
+exit 1
+;;
+esac
similarity index 71%
rename from files/udhcp_script.non-autoip
rename to files/udhcp_script.non-autoip.in
index 0163ac6..4083881 100755 (executable)
@@ -53,11 +53,11 @@ case "$1" in
                        local_gateway="0.0.0.0"
                fi
 
-               /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f
-               /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f
-               /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${local_gateway} -f
-               /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip ${serverid} -f
-               /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${ip} -f
+               @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f
+               @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f
+               @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${local_gateway} -f
+               @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip ${serverid} -f
+               @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${ip} -f
                echo $i >> $TEMP_DHCP_FILE
                ;;
 esac
diff --git a/files/wifi-direct-dhcp.sh b/files/wifi-direct-dhcp.sh
deleted file mode 100644 (file)
index d95428e..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/bin/sh
-if [ $2 ]; then
-INTERFACE_NAME="$2"
-else
-INTERFACE_NAME="p2p0"
-fi
-INTERFACE_PREFIX="p2p"
-TARGET="TM1"
-DEFAULT_IP="192.168.49.1"
-DEFAULT_NET="192.168.49.1/24"
-DEFAULT_BRD="192.168.49.255"
-
-#interface=`/sbin/ifconfig|/bin/grep ^${INTERFACE_NAME}|/usr/bin/cut -d" " -f1`
-interface=`/sbin/ifconfig|/bin/grep ^${INTERFACE_NAME}|/usr/bin/cut -d":" -f1`
-#interface=`/usr/sbin/ip link|/bin/grep ^${INTERFACE_NAME}|/usr/bin/cut -d":" -f2`
-echo "Target is ${TARGET} and interface ${INTERFACE_PREFIX}: ${interface}."
-
-start_dhcp_server()
-{
-       if [ "X${interface}" == "X" ]; then
-               echo "interface(${INTERFACE_PREFIX}) is not up"
-               return 0
-       fi
-
-       /bin/rm /opt/var/lib/misc/dhcpd.leases
-       /bin/touch /opt/var/lib/misc/dhcpd.leases
-       /usr/sbin/ip addr add ${DEFAULT_NET} brd ${DEFAULT_BRD} dev ${interface}
-       /usr/sbin/dhcpd -S -i ${interface} /usr/etc/wifi-direct/dhcpd.conf -f &
-
-       route=`/bin/cat /usr/etc/wifi-direct/dhcpd.conf | /bin/grep router | /bin/awk '{print $3}'`
-       if [ -z $route ]; then
-               route="192.168.49.1"
-       fi
-       subnet=`/bin/cat /usr/etc/wifi-direct/dhcpd.conf | /bin/grep subnet | /bin/awk '{print $3}'`
-
-       if [ -z $subnet ]; then
-               subnet="255.255.255.0"
-       fi
-
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${route} -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${DEFAULT_IP} -f
-}
-
-start_dhcp_client()
-{
-       if [ "X${interface}" == "X" ]; then
-               echo "interface(${INTERFACE_PREFIX}) is not up"
-               return 0
-       fi
-
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
-       /usr/bin/dhcp -S -i $interface -s /usr/etc/wifi-direct/udhcp_script.non-autoip &
-}
-
-
-clean_vconfs()
-{
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname "" -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask "" -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway "" -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip "" -f
-       /usr/bin/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
-}
-
-stop_dhcp()
-{
-       /usr/bin/pkill -x dhcp
-       /usr/bin/pkill -x dhcpd
-       if [ "X${interface}" == "X" ]; then
-               echo "interface(${INTERFACE_PREFIX}) is not up"
-               return 0
-       fi
-       /usr/sbin/ip addr del ${local_ip_net} dev ${interface}
-}
-
-is_running()
-{
-       program=$1
-       run=`/bin/ps -eo comm|/bin/grep ${program}`
-       if [ "X${run}" == "X" ]; then
-               echo "${program} is not running"
-       else
-               echo "${program} is already running"
-       fi
-}
-
-status_dhcp()
-{
-       is_running /usr/bin/dhcp
-       is_running /usr/sbin/dhcpd
-}
-
-
-case $1 in
-"server")
-stop_dhcp
-start_dhcp_server
-;;
-"client")
-clean_vconfs
-stop_dhcp
-start_dhcp_client
-;;
-"stop")
-clean_vconfs
-stop_dhcp
-;;
-"status")
-status_dhcp
-;;
-*)
-/bin/echo wifi-direct-dhcp.sh [server] [client] [stop] [status]
-exit 1
-;;
-esac
-
diff --git a/files/wifi-direct-dhcp.sh.in b/files/wifi-direct-dhcp.sh.in
new file mode 100644 (file)
index 0000000..65e6fec
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/sh
+if [ $2 ]; then
+INTERFACE_NAME="$2"
+else
+INTERFACE_NAME="p2p0"
+fi
+INTERFACE_PREFIX="p2p"
+TARGET="TM1"
+DEFAULT_IP="192.168.49.1"
+DEFAULT_NET="192.168.49.1/24"
+DEFAULT_BRD="192.168.49.255"
+
+#interface=`/sbin/ifconfig|/bin/grep ^${INTERFACE_NAME}|@BIN_DIR@/cut -d" " -f1`
+interface=`/sbin/ifconfig|/bin/grep ^${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f1`
+#interface=`@SBIN_DIR@/ip link|/bin/grep ^${INTERFACE_NAME}|@BIN_DIR@/cut -d":" -f2`
+echo "Target is ${TARGET} and interface ${INTERFACE_PREFIX}: ${interface}."
+
+start_dhcp_server()
+{
+       if [ "X${interface}" == "X" ]; then
+               echo "interface(${INTERFACE_PREFIX}) is not up"
+               return 0
+       fi
+
+       /bin/rm /@TZ_SYS_VAR@/lib/misc/dhcpd.leases
+       /bin/touch @TZ_SYS_VAR@/lib/misc/dhcpd.leases
+       @SBIN_DIR@/ip addr add ${DEFAULT_NET} brd ${DEFAULT_BRD} dev ${interface}
+       @SBIN_DIR@/dhcpd -S -i ${interface} @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf -f &
+
+       route=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep router | /bin/awk '{print $3}'`
+       if [ -z $route ]; then
+               route="192.168.49.1"
+       fi
+       subnet=`/bin/cat @TZ_SYS_RO_ETC@/wifi-direct/dhcpd.conf | /bin/grep subnet | /bin/awk '{print $3}'`
+
+       if [ -z $subnet ]; then
+               subnet="255.255.255.0"
+       fi
+
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${route} -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${DEFAULT_IP} -f
+}
+
+start_dhcp_client()
+{
+       if [ "X${interface}" == "X" ]; then
+               echo "interface(${INTERFACE_PREFIX}) is not up"
+               return 0
+       fi
+
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
+       @BIN_DIR@/dhcp -S -i $interface -s @TZ_SYS_RO_ETC@/wifi-direct/udhcp_script.non-autoip &
+}
+
+
+clean_vconfs()
+{
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname "" -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask "" -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway "" -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip "" -f
+       @BIN_DIR@/vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip "0.0.0.0" -f
+}
+
+stop_dhcp()
+{
+       @BIN_DIR@/pkill -x dhcp
+       @BIN_DIR@/pkill -x dhcpd
+       if [ "X${interface}" == "X" ]; then
+               echo "interface(${INTERFACE_PREFIX}) is not up"
+               return 0
+       fi
+       @SBIN_DIR@/ip addr del ${local_ip_net} dev ${interface}
+}
+
+is_running()
+{
+       program=$1
+       run=`/bin/ps -eo comm|/bin/grep ${program}`
+       if [ "X${run}" == "X" ]; then
+               echo "${program} is not running"
+       else
+               echo "${program} is already running"
+       fi
+}
+
+status_dhcp()
+{
+       is_running @BIN_DIR@/dhcp
+       is_running @SBIN_DIR@/dhcpd
+}
+
+
+case $1 in
+"server")
+stop_dhcp
+start_dhcp_server
+;;
+"client")
+clean_vconfs
+stop_dhcp
+start_dhcp_client
+;;
+"stop")
+clean_vconfs
+stop_dhcp
+;;
+"status")
+status_dhcp
+;;
+*)
+/bin/echo wifi-direct-dhcp.sh [server] [client] [stop] [status]
+exit 1
+;;
+esac
+
similarity index 92%
rename from files/wifi-direct-server.sh
rename to files/wifi-direct-server.sh.in
index 5da7089..ba91a00 100755 (executable)
@@ -7,7 +7,7 @@ start_wifi_direct()
        if [ "X${target}" == "X" ]; then
                echo "${program} is not running"
                echo "Launching ${program}"
-               /usr/bin/${program}&
+               @BIN_DIR@/${program}&
                /bin/sleep 1
        else
                echo "${program} is already running"
@@ -20,7 +20,7 @@ stop_wifi_direct()
                echo "${program} is not running"
        else
                echo "${program} is running.. Killing it"
-               /usr/bin/pkill -x ${program}
+               @BIN_DIR@/pkill -x ${program}
        fi
 }
 
index f2bc77a..72b1329 100755 (executable)
@@ -52,7 +52,6 @@ typedef unsigned int ipv4_addr_t;
 #define WIFI_DIRECT_MAX_SSID_LEN 32
 #define WIFI_DIRECT_MAX_DEVICE_NAME_LEN 32
 #define WIFI_DIRECT_WPS_PIN_LEN 8
-#define WIFI_DIRECT_MAC_ADDRESS_INFO_FILE "/opt/etc/.mac.info"
 #define WIFI_DIRECT_MAX_SERVICES_LEN 1024
 #define WIFI_DIRECT_MAX_SERVICE_NAME_LEN 256
 
index 9605ed6..a7c71a3 100755 (executable)
 #ifndef __WIFI_DIRECT_UTIL_H__
 #define __WIFI_DIRECT_UTIL_H__
 
-#if defined TIZEN_MOBILE
-#      define DEFAULT_MAC_FILE_PATH "/opt/etc/.mac.info"
-#endif /* TIZEN_MOBILE */
-
-#if defined TIZEN_TV
-#      if defined TIZEN_WIFI_MODULE_BUNDLE
-#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
-#      else /* TIZEN_WIFI_MODULE_BUNDLE */
-#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
-#      endif /* TIZEN_WIFI_MODULE_BUNDLE */
-#endif /* TIZEN_TV */
-
-#ifndef DEFAULT_MAC_FILE_PATH
-#      define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
-#endif
-
 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
@@ -58,7 +42,6 @@
 #define VCONFKEY_DHCPC_SERVER_IP "memory/private/wifi_direct_manager/dhcpc_server_ip"
 #define VCONFKEY_LOCAL_IP "memory/private/wifi_direct_manager/p2p_local_ip"
 #define DHCP_DUMP_FILE "/tmp/dhcp-client-table"
-#define COUNTRY_CODE_FILE "/usr/etc/wifi-direct/ccode.conf"
 #define MAX_DHCP_DUMP_SIZE 64    // Single lease format: [99:66:dd:00:11:aa 192.168.16.20 00:00:60]
 
 #define SOCK_FD_MIN 3
index 5ee9d9d..2032e26 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.141
+Version:       1.2.143
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
@@ -19,6 +19,9 @@ BuildRequires:        pkgconfig(cynara-creds-socket)
 BuildRequires: pkgconfig(cynara-session)
 
 BuildRequires: pkgconfig(capi-appfw-application)
+
+BuildRequires: pkgconfig(libtzplatform-config)
+
 BuildRequires: cmake
 #BuildRequires:  model-build-features
 Requires:      net-tools
@@ -48,6 +51,7 @@ cp -a %{SOURCE1} ./wfd-manager.conf
 cp -a %{SOURCE2} .
 
 %build
+
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
@@ -103,7 +107,13 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
--DCMAKE_LIB_DIR=%{_libdir}
+-DLIB_DIR=%{_libdir} \
+-DBIN_DIR=%{_bindir} \
+-DSBIN_DIR=%{_sbindir} \
+-DTZ_SYS_RO_ETC=%TZ_SYS_RO_ETC \
+-DTZ_SYS_VAR=%TZ_SYS_VAR \
+-DTZ_SYS_ETC=%TZ_SYS_ETC \
+-DTZ_SYS_RUN=%TZ_SYS_RUN
 
 make %{?_smp_mflags}
 
@@ -119,42 +129,35 @@ mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/
 cp net.wifidirect.service %{buildroot}%{_datadir}/dbus-1/system-services/net.wifidirect.service
 
 %post
-chmod 644 /usr/etc/wifi-direct/dhcpd.*.conf
-chmod 755 /usr/bin/dhcpd-notify.sh
-chmod 755 /usr/etc/wifi-direct/udhcp_script.non-autoip
-chmod 755 /usr/bin/wifi-direct-server.sh
-chmod 755 /usr/bin/wifi-direct-dhcp.sh
-chmod 755 /usr/sbin/p2p_supp.sh
-
-%if "%{profile}" == "tv"
-       if [ ! -d /opt/var/lib/misc ]; then
-               mkdir -p /opt/var/lib/misc
-       fi
-
-       touch /opt/var/lib/misc/dhcpd.leases
-       chmod 666 /opt/var/lib/misc/dhcpd.leases
-%else
-       if [ ! -d /var/lib/misc ]; then
-               mkdir -p /var/lib/misc
-       fi
-
-       touch /var/lib/misc/dhcpd.leases
-       chmod 666 /var/lib/misc/dhcpd.leases
-%endif
+chmod 644 %{TZ_SYS_RO_ETC}/wifi-direct/dhcpd.conf
+chmod 755 %{_bindir}/dhcpd-notify.sh
+chmod 755 %{TZ_SYS_RO_ETC}/wifi-direct/udhcp_script.non-autoip
+chmod 755 %{_bindir}/wifi-direct-server.sh
+chmod 755 %{_bindir}/wifi-direct-dhcp.sh
+chmod 755 %{_sbindir}/p2p_supp.sh
 
-%postun
+if [ ! -d %{TZ_SYS_VAR}/lib/misc ]; then
+       mkdir -p %{TZ_SYS_VAR}/lib/misc
+fi
 
+touch %{TZ_SYS_VAR}/lib/misc/dhcpd.leases
+chmod 666 %{TZ_SYS_VAR}/lib/misc/dhcpd.leases
 
 %files
 %manifest wifi-direct-manager.manifest
 %license LICENSE
 %defattr(-,root,root,-)
 %{_bindir}/wfd-manager
-/usr/etc/wifi-direct/dhcpd.conf
-/usr/etc/wifi-direct/udhcp_script.non-autoip
-/usr/etc/wifi-direct/p2p_supp.conf
-/opt/etc/p2p_supp.conf
-/usr/etc/wifi-direct/ccode.conf
+%config %TZ_SYS_RO_ETC/wifi-direct/ccode.conf 
+%config %TZ_SYS_RO_ETC/wifi-direct/dhcpd.conf
+%config %TZ_SYS_RO_ETC/wifi-direct/p2p_supp.conf
+%config %TZ_SYS_RO_ETC/wifi-direct/udhcp_script.non-autoip
+%config %{_sysconfdir}/dbus-1/system.d/wfd-manager.conf
+%TZ_SYS_RO_ETC/wifi-direct/ccode.conf
+%TZ_SYS_RO_ETC/wifi-direct/dhcpd.conf
+%TZ_SYS_RO_ETC/wifi-direct/p2p_supp.conf
+%TZ_SYS_RO_ETC/wifi-direct/udhcp_script.non-autoip
+%TZ_SYS_ETC/p2p_supp.conf
 %{_bindir}/dhcpd-notify.sh
 %{_bindir}/wifi-direct-server.sh
 %{_bindir}/wifi-direct-dhcp.sh
@@ -162,7 +165,7 @@ chmod 755 /usr/sbin/p2p_supp.sh
 %attr(755,-,-) %{_bindir}/dhcpd-notify.sh
 %attr(755,-,-) %{_bindir}/wifi-direct-server.sh
 %attr(755,-,-) %{_bindir}/wifi-direct-dhcp.sh
-%attr(755,-,-) /usr/etc/wifi-direct/udhcp_script.non-autoip
+%attr(755,-,-) %{TZ_SYS_RO_ETC}/wifi-direct/udhcp_script.non-autoip
 %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/*
 %attr(644,root,root) %{_datadir}/dbus-1/system-services/*
 %attr(755,-,-) %{_sbindir}/p2p_supp.sh
index c281985..c1b5259 100755 (executable)
@@ -8,7 +8,6 @@ FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(LIBDIR ${CMAKE_LIB_DIR})
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/oem)
 INCLUDE_DIRECTORIES(SRCS include)
 
@@ -28,4 +27,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME ${PROJECT_NAME})
 
 # install
-INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBDIR})
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIB_DIR})
index afa5dc9..1802559 100755 (executable)
 #define IPSECSTR "%d..%d"
 #define OBJECT_PATH_MAX 150
 
+#define CONF_FILE_PATH "/etc/wpa_supplicant/wpa_supplicant.conf"
+
 #if defined TIZEN_MOBILE
-#      define CONF_FILE_PATH "/etc/wpa_supplicant/wpa_supplicant.conf"
-#      define DEFAULT_MAC_FILE_PATH "/opt/etc/.mac.info"
-#      define COMMON_IFACE_NAME "wlan0"
+#define COMMON_IFACE_NAME "wlan0"
 
 #      if defined TIZEN_WLAN_BOARD_SPRD
 #              define P2P_IFACE_NAME "p2p0"
 #endif /* TIZEN_MOBILE */
 
 #if defined TIZEN_TV
-#      define CONF_FILE_PATH "/opt/etc/p2p_supp.conf"
 
 #      if defined TIZEN_WIFI_MODULE_BUNDLE
-#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
 #              define COMMON_IFACE_NAME "wlan0"
 #              define GROUP_IFACE_NAME "wlan0"
 #              define GROUP_IFACE_PREFIX "wlan"
 #      else /* TIZEN_WIFI_MODULE_BUNDLE */
-#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
 #              define COMMON_IFACE_NAME "p2p0"
 #              define GROUP_IFACE_NAME "p2p0"
 #              define GROUP_IFACE_PREFIX "p2p"
index 6ab2471..6d84537 100755 (executable)
@@ -43,6 +43,8 @@
 #include <glib.h>
 #include <gio/gio.h>
 
+#include <tzplatform_config.h>
+
 #include "wifi-direct-oem.h"
 #include "wfd-plugin-log.h"
 #include "wfd-plugin-wpasupplicant.h"
 
 #define NETCONFIG_DBUS_REPLY_TIMEOUT (10 * 1000)
 
+#if defined TIZEN_MOBILE
+#define DEFAULT_MAC_FILE_PATH tzplatform_mkpath(TZ_SYS_ETC, ".mac.info")
+#endif
+
+#if defined TIZEN_WIFI_MODULE_BUNDLE
+#define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
+#endif
+
+#ifndef DEFAULT_MAC_FILE_PATH
+#define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
+#endif
+
 static wfd_oem_ops_s supplicant_ops = {
        .init = ws_init,
        .deinit = ws_deinit,
@@ -435,14 +449,15 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac)
 {
        __WDP_LOG_FUNC_ENTER__;
        FILE *fd = NULL;
-       unsigned char local_mac[WS_MACSTR_LEN] = {0, };
+       const char *file_path = DEFAULT_MAC_FILE_PATH;
+       char local_mac[OEM_MACSTR_LEN] = {0, };
        char *ptr = NULL;
        int res = 0;
 
        errno = 0;
-       fd = fopen(DEFAULT_MAC_FILE_PATH, "r");
+       fd = fopen(file_path, "r");
        if (!fd) {
-               WDP_LOGE("Failed to open MAC info file (%s)", strerror(errno));
+               WDP_LOGE("Failed to open MAC info file [%s] (%s)",file_path, strerror(errno));
                __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
@@ -458,7 +473,7 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac)
        WDP_SECLOGD("Local MAC address [%s]", ptr);
        WDP_SECLOGD("Local MAC address [%s]", local_mac);
 
-       res = __ws_txt_to_mac(local_mac, dev_mac);
+       res = __ws_txt_to_mac((unsigned char *)local_mac, dev_mac);
        if (res < 0) {
                WDP_LOGE("Failed to convert text to MAC address");
                fclose(fd);
index 3ca0282..f97e2cb 100755 (executable)
@@ -8,7 +8,6 @@ FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(LIBDIR ${CMAKE_LIB_DIR})
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/oem)
 INCLUDE_DIRECTORIES(SRCS include)
 
@@ -26,4 +25,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME ${PROJECT_NAME})
 
 # install
-INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBDIR})
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIB_DIR})
index cdfcfa1..2efb934 100755 (executable)
 
 #define SOCK_FD_MIN 3
 #define GLOBAL_INTF_PATH "/tmp/wpa_ctrl_global"
-#define SUPPL_GLOBAL_INTF_PATH "/var/run/wpa_global"
-#define SUPPL_IFACE_PATH "/var/run/wpa_supplicant/"
-#define SUPPL_GROUP_IFACE_PATH "/var/run/wpa_supplicant/"
-
-#if defined TIZEN_MOBILE
-#define DEFAULT_MAC_FILE_PATH "/opt/etc/.mac.info"
-#endif
-
-#if defined TIZEN_WIFI_MODULE_BUNDLE
-#define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
-#endif
-
-#ifndef DEFAULT_MAC_FILE_PATH
-#define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
-#endif
 
 #if defined TIZEN_MOBILE
 #define COMMON_IFACE_NAME "wlan0"
index 6c75fed..8763d14 100755 (executable)
@@ -44,6 +44,8 @@
 #include <glib.h>
 #include <gio/gio.h>
 
+#include <tzplatform_config.h>
+
 #include "wifi-direct-oem.h"
 #include "wfd-plugin-log.h"
 #include "wfd-plugin-wpasupplicant.h"
 
 #define NETCONFIG_DBUS_REPLY_TIMEOUT   (10 * 1000)
 
+#define SUPPL_GLOBAL_INTF_PATH tzplatform_getenv(TZ_SYS_RUN, "wpa_global/")
+#define SUPPL_IFACE_PATH tzplatform_getenv(TZ_SYS_RUN, "wpa_supplicant/")
+#define SUPPL_GROUP_IFACE_PATH tzplatform_getenv(TZ_SYS_RUN, "wpa_supplicant/")
+
+#if defined TIZEN_MOBILE
+#define DEFAULT_MAC_FILE_PATH tzplatform_mkpath(TZ_SYS_ETC, ".mac.info")
+#endif
+
+#if defined TIZEN_WIFI_MODULE_BUNDLE
+#define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
+#endif
+
+#ifndef DEFAULT_MAC_FILE_PATH
+#define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
+#endif
+
 ws_string_s ws_event_strs[] = {
        // discovery
        {"P2P-DEVICE-FOUND", WS_EVENT_DEVICE_FOUND},
@@ -2654,14 +2672,15 @@ static int _ws_update_local_dev_addr_from_file()
 {
        __WDP_LOG_FUNC_ENTER__;
        FILE *fd = NULL;
+       const char *file_path = DEFAULT_MAC_FILE_PATH;
        char local_mac[OEM_MACSTR_LEN] = {0, };
        char *ptr = NULL;
        int res = 0;
 
        errno = 0;
-       fd = fopen(DEFAULT_MAC_FILE_PATH, "r");
+       fd = fopen(file_path, "r");
        if (!fd) {
-               WDP_LOGE("Failed to open MAC info file (%s)", strerror(errno));
+               WDP_LOGE("Failed to open MAC info file [%s] (%s)",file_path, strerror(errno));
                __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
@@ -2676,7 +2695,7 @@ static int _ws_update_local_dev_addr_from_file()
        }
        WDP_SECLOGD("Local MAC address [%s]", ptr);
 
-       res = _ws_txt_to_mac(local_mac, g_pd->local_dev_addr);
+       res = _ws_txt_to_mac((unsigned char *)local_mac, g_pd->local_dev_addr);
        if (res < 0) {
                WDP_LOGE("Failed to convert text to MAC address");
                fclose(fd);
index abad70a..e04a72a 100755 (executable)
@@ -43,6 +43,7 @@
 #include <glib.h>
 
 #include <vconf.h>
+#include <tzplatform_config.h>
 #if defined(TIZEN_FEATURE_DEFAULT_CONNECTION_AGENT)
 #include <app_control.h>
 #include <aul.h>
 #define TIZEN_P2P_GO_IPADDR "192.168.49.1"
 #define MAX_SIZE_ERROR_BUFFER 256
 
+#if defined TIZEN_MOBILE
+#define DEFAULT_MAC_FILE_PATH tzplatform_mkpath(TZ_SYS_ETC, ".mac.info")
+#endif /* TIZEN_MOBILE */
+
+#if defined TIZEN_TV
+#      if defined TIZEN_WIFI_MODULE_BUNDLE
+#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/wlan0/address"
+#      else /* TIZEN_WIFI_MODULE_BUNDLE */
+#              define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
+#      endif /* TIZEN_WIFI_MODULE_BUNDLE */
+#endif /* TIZEN_TV */
+
+#ifndef DEFAULT_MAC_FILE_PATH
+#      define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
+#endif
+
+#define COUNTRY_CODE_FILE tzplatform_mkpath(TZ_SYS_RO_ETC, "wifi-direct/ccode.conf")
+
 static int _txt_to_mac(char *txt, unsigned char *mac)
 {
        int i = 0;
@@ -288,6 +307,7 @@ void _wfd_util_check_country_cb(keynode_t *key, void *data)
        char mcc[4] = {0, };
        char *ccode;
        GKeyFile *keyfile = NULL;
+       const char *file_path = COUNTRY_CODE_FILE;
        GError * err = NULL;
 
        if (!manager) {
@@ -304,7 +324,7 @@ void _wfd_util_check_country_cb(keynode_t *key, void *data)
        snprintf(mcc, 4, "%d", plmn);
 
        keyfile = g_key_file_new();
-       res = g_key_file_load_from_file(keyfile, COUNTRY_CODE_FILE, 0, &err);
+       res = g_key_file_load_from_file(keyfile, file_path, 0, &err);
        if (!res) {
                WDS_LOGE("Failed to load key file(%s)", err->message);
                g_key_file_free(keyfile);
@@ -525,15 +545,16 @@ int wfd_util_set_wifi_direct_state(int state)
 int wfd_util_get_local_dev_mac(unsigned char *dev_mac)
 {
        __WDS_LOG_FUNC_ENTER__;
+       const char *file_path = DEFAULT_MAC_FILE_PATH;
        FILE *fd = NULL;
        char local_mac[MACSTR_LEN] = {0, };
        char *ptr = NULL;
        int res = 0;
 
        errno = 0;
-       fd = fopen(DEFAULT_MAC_FILE_PATH, "r");
+       fd = fopen(file_path, "r");
        if (!fd) {
-               WDS_LOGE("Failed to open MAC info file (%s)", strerror(errno));
+               WDS_LOGE("Failed to open MAC info file [%s] (%s)",file_path , strerror(errno));
                __WDS_LOG_FUNC_EXIT__;
                return -1;
        }