vpnkit: Add a config to specify the socket

This commit is contained in:
YAMAMOTO Takashi 2020-03-21 11:55:58 +09:00 committed by Xiang Xiao
parent 12a97acaed
commit 702d82d052
4 changed files with 10 additions and 3 deletions

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -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.