WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] Remus: python netlink fixes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] Remus: python netlink fixes
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Jun 2010 23:35:26 -0700
Delivery-date: Mon, 21 Jun 2010 23:36:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1277187914 -3600
# Node ID 9cd6e71b5cc77c2c7d6a6e89658eb08ef83658df
# Parent  cde182fde88c0709b9d37b64da7312b77f19d98d
Remus: python netlink fixes

Fix deprecation warning in Qdisc class under python 2.6.
Fix rtattr length and padding (rta_len is unaligned).
Null-terminate qdisc name in rtnl messages.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
xen-unstable changeset:   21238:99a85cb72c9f
xen-unstable date:        Tue May 04 09:30:53 2010 +0100
---
 tools/python/xen/remus/netlink.py |   10 +++++++---
 tools/python/xen/remus/qdisc.py   |    6 +++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff -r cde182fde88c -r 9cd6e71b5cc7 tools/python/xen/remus/netlink.py
--- a/tools/python/xen/remus/netlink.py Tue Jun 22 07:24:27 2010 +0100
+++ b/tools/python/xen/remus/netlink.py Tue Jun 22 07:25:14 2010 +0100
@@ -1,4 +1,6 @@
 # netlink wrappers
+
+# See include/linux/netlink.h and rtnetlink.h
 
 import socket, struct
 import xen.lowlevel.netlink
@@ -77,9 +79,9 @@ class rtattr(object):
         return align(self.rta_len)
 
     def pack(self):
-        self.rta_len = self.fmtlen + align(len(self.body), 2)
+        self.rta_len = self.fmtlen + len(self.body)
         s = struct.pack(self.fmt, self.rta_len, self.rta_type) + self.body
-        pad = self.rta_len - len(s)
+        pad = align(self.rta_len) - len(s)
         if pad:
             s += '\0' * pad
         return s
@@ -127,14 +129,16 @@ class nlmsg(object):
         attr.rta_type = type
         attr.body = data
         self.rta += attr.pack()
+        self.nlmsg_len = len(self)
 
     def settype(self, cmd):
         self.nlmsg_type = cmd
 
     def pack(self):
-        return struct.pack(self.fmt, len(self), self.nlmsg_type,
+        s = struct.pack(self.fmt, len(self), self.nlmsg_type,
                            self.nlmsg_flags, self.nlmsg_seq,
                            self.nlmsg_pid) + self.body + self.rta
+        return s
 
     def unpack(self, msg):
         args = struct.unpack(self.fmt, msg[:self.fmtlen])
diff -r cde182fde88c -r 9cd6e71b5cc7 tools/python/xen/remus/qdisc.py
--- a/tools/python/xen/remus/qdisc.py   Tue Jun 22 07:24:27 2010 +0100
+++ b/tools/python/xen/remus/qdisc.py   Tue Jun 22 07:25:14 2010 +0100
@@ -35,7 +35,7 @@ class addrequest(request):
         flags = netlink.NLM_F_EXCL|netlink.NLM_F_CREATE
         super(addrequest, self).__init__(netlink.RTM_NEWQDISC, flags=flags,
                                          dev=dev, handle=handle)
-        self.n.addattr(netlink.TCA_KIND, qdisc.kind)
+        self.n.addattr(netlink.TCA_KIND, qdisc.kind + '\0')
         opts = qdisc.pack()
         if opts:
             self.n.addattr(netlink.TCA_OPTIONS, opts)
@@ -49,7 +49,7 @@ class changerequest(request):
     def __init__(self, dev, handle, qdisc):
         super(changerequest, self).__init__(netlink.RTM_NEWQDISC,
                                             dev=dev, handle=handle)
-        self.n.addattr(netlink.TCA_KIND, qdisc.kind)
+        self.n.addattr(netlink.TCA_KIND, qdisc.kind + '\0')
         opts = qdisc.pack()
         if opts:
             self.n.addattr(netlink.TCA_OPTIONS, opts)
@@ -59,7 +59,7 @@ class Qdisc(object):
         if qdict:
             kind = qdict.get('kind')
             cls = qdisc_kinds.get(kind, cls)
-        obj = super(Qdisc, cls).__new__(cls, qdict=qdict, *args, **opts)
+        obj = super(Qdisc, cls).__new__(cls)
         return obj
 
     def __init__(self, qdict):

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] Remus: python netlink fixes, Xen patchbot-4.0-testing <=