diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index 8861b14b05..aa4d0a6020 100644 --- a/arch/sim/Kconfig +++ b/arch/sim/Kconfig @@ -142,6 +142,11 @@ endchoice endif +config SIM_NETDEV_VPNKIT_PATH + string "Unix domain socket to communicate with VPNKit" + default "/tmp/vpnkit-nuttx" + depends on SIM_NETDEV_VPNKIT + if HOST_LINUX choice prompt "Simulation Network Type" diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index b6a5ae64f9..8aced456f7 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -175,6 +175,7 @@ else # HOSTOS != Cygwin endif # HOSTOS != Cygwin else ifeq ($(CONFIG_SIM_NETDEV_VPNKIT),y) CSRCS += up_netdriver.c + HOSTCFLAGS += -DCONFIG_SIM_NETDEV_VPNKIT_PATH=\"$(CONFIG_SIM_NETDEV_VPNKIT_PATH)\" HOSTSRCS += up_vpnkit.c VPATH += :sim/vpnkit HOSTSRCS += protocol.c negotiate.c diff --git a/arch/sim/src/sim/up_vpnkit.c b/arch/sim/src/sim/up_vpnkit.c index 26225d7905..0e98c72419 100644 --- a/arch/sim/src/sim/up_vpnkit.c +++ b/arch/sim/src/sim/up_vpnkit.c @@ -55,7 +55,7 @@ * Private Data ****************************************************************************/ -static const char *g_vpnkit_socket_path = "/tmp/vpnkit-nuttx"; /* XXX config */ +static const char *g_vpnkit_socket_path = CONFIG_SIM_NETDEV_VPNKIT_PATH; static struct vif_info g_vifinfo; static int g_vpnkit_fd = -1; static bool g_connect_warned; diff --git a/boards/sim/sim/sim/NETWORK-VPNKIT.txt b/boards/sim/sim/sim/NETWORK-VPNKIT.txt index 983af7bf3f..1e5af3afb4 100644 --- a/boards/sim/sim/sim/NETWORK-VPNKIT.txt +++ b/boards/sim/sim/sim/NETWORK-VPNKIT.txt @@ -11,6 +11,7 @@ Configuration CONFIG_SIM_NETDEV=y CONFIG_SIM_NETDEV_TAP is not set CONFIG_SIM_NETDEV_VPNKIT=y + CONFIG_SIM_NETDEV_VPNKIT_PATH="/tmp/vpnkit-nuttx" You can use the sim:vpnkit configuration, which includes the above settings. @@ -35,5 +36,5 @@ You can use it as the following: % vpnkit --ethernet /tmp/vpnkit-nuttx & % ./nuttx -NOTE: The unix domain socket path (/tmp/vpnkit-nuttx) is -currently hardcoded in the code. +NuttX's CONFIG_SIM_NETDEV_VPNKIT_PATH should match vpnkit's +--ethernet option.