From: Mitchell E Berger Date: Fri, 25 May 2018 07:07:31 +0000 (-0400) Subject: Don't pass a src argument to 'ip route del' in case the host's "main IP" X-Git-Tag: 0.0.54~1 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-xen-config.git/commitdiff_plain/4e74e79c1991d680b4efa61f8a9369f42f7325cd Don't pass a src argument to 'ip route del' in case the host's "main IP" has changed and the route was added with a different src than we expect. --- diff --git a/debian/changelog b/debian/changelog index 819085f..e2a7aee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,10 +10,13 @@ invirt-xen-config (0.0.54) unstable; urgency=low * vif-invirtroute: if there is an "other" IP address, DNAT it to the primary IP, set up routing to get it to the VM, and arp for it. Also, cut out the nonsense with backgrounding arpspoof, sleeping, and - killing it; we have the technology for 'timeout'. + killing it; we have the technology for 'timeout'. Finally, don't + pass a "src" argument to "ip route del" to ensure a match even if + the host's "main IP" has changed and caused the route to be inserted + with a different src. * templatize-xend-config: explicitly turn on the relocation server - -- Mitchell Berger Thu, 17 May 2018 01:55:00 -0400 + -- Mitchell Berger Fri, 25 May 2018 03:06:00 -0400 invirt-xen-config (0.0.53) unstable; urgency=low diff --git a/vif-invirtroute b/vif-invirtroute index 9f833dc..69ca710 100755 --- a/vif-invirtroute +++ b/vif-invirtroute @@ -77,7 +77,9 @@ if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then # (with metric 1) should take precedence over the vif # route and carry all the traffic. + src="" if [ $ipcmd == "add" ]; then + src="src ${main_ip}" case $dev in vif*) metric="metric 2" @@ -87,7 +89,7 @@ if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then ;; esac fi - ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip} $metric + ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} ${src} $metric case "$command" in online|add) timeout 5 arpspoof -i $(invirt-getconf xen.iface) -t ${gateway} ${addr} || : @@ -95,7 +97,7 @@ if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then esac done if [ -n "$other_ip" ]; then - ${cmdprefix} ip route ${ipcmd} ${other_ip} dev ${dev} src ${main_ip} $metric + ${cmdprefix} ip route ${ipcmd} ${other_ip} dev ${dev} ${src} $metric iptables -t nat ${ipt_action} PREROUTING -d ${other_ip} -j DNAT --to-destination ${addr} case "$command" in online|add)