saschpe / libvirt-hook-qemu

Libvirt hook for setting up iptables port-forwarding rules when using NAT-ed networking.
236 stars 69 forks source link

Fix host_ip when multiple default routes exist #18

Closed CyberShadow closed 7 years ago

CyberShadow commented 7 years ago

On systems with multiple default routes, the host_ip function misbehaved and passed garbage to iptables.

Add a | head -n1 at the end of the interface query command to only look at the first default route (which should have the highest metric in ip route's output).