OpenMediaVault-Plugin-Developers / openmediavault-openvpn

OpenMediaVault plugin for OpenVPN
19 stars 19 forks source link

Use interface from config.xml when looking up ip address for iptables… #10

Closed kangolo closed 7 years ago

kangolo commented 7 years ago

I was running into issues with my docker0 ip address being used for the iptables rule. This patch uses the first ethernet/wifi interface from config.xml instead of just the first interface returned by ifconfig.

ghost commented 7 years ago

It would be great if you could take this one step further and make it possible to select which interface to use from the web interface.

kangolo commented 7 years ago

Sure, I'll take a look - might take me a few days.

kangolo commented 7 years ago

Done, let me know if anything looks off or if the new field should be renamed.

kangolo commented 7 years ago

OK, I think I got everything. I left the get_ip function as-is as we'd still have to do the ifconfig call for the netmask and for troubleshooting down the line it makes sense for them to both use the same mechanism. I made two other minor changes:

I changed the capitalization on the label to match the rest of the page - "Gateway interface" rather than "Gateway Interface".

I moved the gateway_interface setting to be above the default_gateway setting so it's clear it's still required even if default_gateway is off/false.

ghost commented 7 years ago

Looks fine now except for one line. When you've fixed that last issue commented on I'm fine with merging it. :)

kangolo commented 7 years ago

Done, thanks!

ghost commented 7 years ago

Thanks for the improvement! 👍