From: Liu Sheng <liush...@cn.ibm.com>

 When we perform the tap up operation, we should pass a 18Byte(16B for the name
 and a 2B short int size for the flag 0x0001) ifreq struct to the ioctl
 function. If we have a 4B int size flag instead, there is no problem on a x86
 machine as it's little-endian arch, the first 2B is [01 00] coincidently the
 same as we have a short int size flag. but on a big-endian arch like power. the
 first 2B is [00 00], which is not correct for the operation. so just change the
 flag size to 2B.

Signed-of-by: Liu Sheng <liush...@cn.ibm.com>
---
 client/virt/virt_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index b1543ac..ffc16ef 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -3351,7 +3351,7 @@ def bring_up_ifname(ifname):
     @param ifname: Name of the interface
     """
     ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
-    ifr = struct.pack("16si", ifname, IFF_UP)
+    ifr = struct.pack("16sh", ifname, IFF_UP)
     try:
         fcntl.ioctl(ctrl_sock, SIOCSIFFLAGS, ifr)
     except IOError:
-- 
1.7.4.1

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to