Minor bugs in the sample script for ns-routing
Jason A. Donenfeld
Jason at zx2c4.com
Sat Feb 8 22:33:09 CET 2020
On Sat, Feb 8, 2020 at 10:28 PM Isaac Nickaein <nickaein.i at gmail.com> wrote:
>
> The sample script provided at "Routing and Network Namespace
> Intergration" page seems to have a few bugs, at least on Ubuntu 19.10:
>
> 1. The execi command seems to have an extra "exec" at the beginning. Instead of:
>
> exec ip netns exec physical sudo -E -u \#${SUDO_UID:-$(id -u)} -g
> \#${SUDO_GID:-$(id -g)} -- "$@"
>
> It should say:
>
> ip netns exec physical sudo -E -u \#${SUDO_UID:-$(id -u)} -g
> \#${SUDO_GID:-$(id -g)} -- "$@"
No. The intent is that the ip process replaces the bash process
without fork(2)+wait(2), via execve(2).
> 2. The "shift" command should be moved into "execi" function.
Why? What does that accomplish? The structure is that the subcommands
inherit their arguments as though they've been called directly.
> 3. dhcpd seems to be replaced by dhclient. It would be nice if the
> script set it (and other configurations) as a variable, e.g. to make
> it easier for user to adopt the script:
>
> DHCP_DAEMON=dhcpd
> WG_IFACE=wgvpn0
> WLAN_IFACE=wlan0
> WLAN_PHY=phy0
You're free to reorganize this to work with any network daemon you
won't. For most users, dhcpcd+wpa_supplicant probably doesn't describe
their network setup, since most folks are in the habit of using large
management tools.
More information about the WireGuard
mailing list