From 751f91525735c6ecd163484567390adb236f4d1b Mon Sep 17 00:00:00 2001 From: Mitchell E Berger Date: Fri, 18 May 2018 04:09:29 -0400 Subject: [PATCH] Add the ridiculous arp remctl we all want but shouldn't need --- debian/changelog | 6 ++++++ host/usr/sbin/invirt-vmcontrol | 16 ++++++++++++++++ server/usr/sbin/invirt-remctl-help | 1 + 3 files changed, 23 insertions(+) diff --git a/debian/changelog b/debian/changelog index 470c551..ba2843f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.4.21) precise; urgency=low + + * Add the long-awaited arp remctl + + -- Mitchell Berger Fri, 18 May 2018 04:08:00 -0400 + invirt-remote (0.4.20) precise; urgency=low * Fix a typo. diff --git a/host/usr/sbin/invirt-vmcontrol b/host/usr/sbin/invirt-vmcontrol index 66f5ca6..eaac5ac 100755 --- a/host/usr/sbin/invirt-vmcontrol +++ b/host/usr/sbin/invirt-vmcontrol @@ -41,6 +41,22 @@ case "$ACTION" in vnctoken) invirt-vnc-authtoken "$ORIGMACHINE" ;; + arp) + iface=`invirt-getconf xen.iface` + xs_prefix="/local/domain/0/backend/vif" + domid=`xm domid $MACHINE` + for vif in `xenstore-list $xs_prefix/$domid`; do + ip=`xenstore-read $xs_prefix/$domid/$vif/ip` + script=`xenstore-read $xs_prefix/$domid/$vif/script` + gw=`echo $script | sed -ne 's/.* gateway=\([0-9\.]*\).*/\1/p'` + oip=`echo $script | sed -ne 's/.* other_ip=\([0-9\.]*\).*/\1/p'` + ogw=`echo $script | sed -ne 's/.* other_gateway=\([0-9\.]*\).*/\1/p'` + timeout 5 /usr/sbin/arpspoof -i $iface -t $gw $ip + if [ -n "$oip" ]; then + timeout 5 /usr/sbin/arpspoof -i $iface -t $ogw $oip + fi + done + ;; *) echo "ERROR: Invalid Command" exit 34 diff --git a/server/usr/sbin/invirt-remctl-help b/server/usr/sbin/invirt-remctl-help index 33c67a6..98ea9bd 100755 --- a/server/usr/sbin/invirt-remctl-help +++ b/server/usr/sbin/invirt-remctl-help @@ -17,6 +17,7 @@ help = [ ('reboot', 'reboot your VM (with xm reboot)'), ('install', 'autoinstall your VM (takes a series of key=value pairs; \n\t\tvalid arguments include mirror, dist, arch, imagesize,\n\t\tand noinstall)'), #also CD images on create/reboot + ('arp', 'attempt to repair broken network connectivity by sending\n\t\tgratuitous ARP reply messages to the router'), ] helpdict = dict(help) -- 1.7.9.5