OpenVPN and no specified local-host defaults to udp6

When adding an openvpn tunnel and no “local-host” is specified the default protocol selected will be udp6. On a system with no ipv6 addresses his will lead to openvpn for that tunnel just restarting logging the error “RESOLVE: Cannot resolve host address: x.x.x.x:port (Address family for hostname not supported)” in /var/log/messages.

Adding a local-host and specifying an ipv4-address for openvpn to listen on will allow the tunnel to work and no error message is generated.

In the configuration parsing file /usr/libexec/vyos/conf_mode/interfaces-openvpn.py the code for stripping the “6” from udp6/tcp6-client/tcp6-server would probably need to be reworked to allow openvpn to listen to all addresses (the default behavior if no local-host is specified).

The current code is:

if is_ipv4(openvpn['local_host']):
    # takes out the '6'
    openvpn['protocol_real'] = openvpn['protocol_real'][:3] + openvpn['protocol_real'][4:]

Can confirm that i am also having the same issues. Both with DNS addresses and IP addresses.

May 15 22:00:05 vyos-dmz openvpn-vtun101[6295]: RESOLVE: Cannot resolve host address: domain.id.redacted.com:1194 (Name or service not known)

Running VyOS 1.3-rolling-202005130117