[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hotplug: fix ip_of for systems using a peer-to-peer link


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Thu, 26 Jul 2012 20:55:08 +0000
  • Delivery-date: Thu, 26 Jul 2012 20:55:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ian Campbell <ijc@xxxxxxxxxxxxxx>
# Date 1343234355 -3600
# Node ID c8f1e4a98f7f10c095377e8f7c61dc07fb203dfd
# Parent  d35e84ac821dea78667d81d6d75a69f946b09a76
hotplug: fix ip_of for systems using a peer-to-peer link

This is from an old Debian bug at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437127

I'm slightly inferring what the configuration which trigger this issue is, the
bug report says:

    This code however fails if no slash is present in the address, which is the
    case in my configuration:

    $ ip addr show dev eth0
    2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
        link/ether 00:16:17:90:b4:35 brd ff:ff:ff:ff:ff:ff
        inet 88.198.12.XXX peer 88.198.12.XXX/32 brd 88.255.255.255 scope 
global eth0

I hope either Marc or Stefan can correct me if I have surmised wrongly what
this configuration represents.

This function is used in the vif-route configuration.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r d35e84ac821d -r c8f1e4a98f7f tools/hotplug/Linux/vif-common.sh
--- a/tools/hotplug/Linux/vif-common.sh Wed Jul 25 17:39:14 2012 +0100
+++ b/tools/hotplug/Linux/vif-common.sh Wed Jul 25 17:39:15 2012 +0100
@@ -189,7 +189,7 @@ handle_iptable()
 #
 ip_of()
 {
-  ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed -n '1 s,/.*,,p'
+  ip -4 -o addr show primary dev "$1" | awk '$3 == "inet" {split($4,i,"/"); 
print i[1]; exit}'
 }
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.