From: Brendan Cully <brendan@cs.ubc.ca>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1 of 7] Remus: python netlink fixes
Date: Mon, 03 May 2010 11:53:48 -0700 [thread overview]
Message-ID: <c0ef3e29c328f52cc9fe.1272912828@kremvax.cs.ubc.ca> (raw)
In-Reply-To: <patchbomb.1272912827@kremvax.cs.ubc.ca>
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
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@cs.ubc.ca>
[-- Attachment #2: xen-4.0-1.patch --]
[-- Type: text/x-patch, Size: 3039 bytes --]
# HG changeset patch
# User Brendan Cully <brendan@cs.ubc.ca>
# Date 1272694696 25200
# Node ID c0ef3e29c328f52cc9fe1896d3056b42af4ea115
# Parent 40334179f45b9de88520fe082ba592d9ab0424b8
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@cs.ubc.ca>
diff --git a/tools/python/xen/remus/netlink.py b/tools/python/xen/remus/netlink.py
--- a/tools/python/xen/remus/netlink.py
+++ b/tools/python/xen/remus/netlink.py
@@ -1,5 +1,7 @@
# netlink wrappers
+# See include/linux/netlink.h and rtnetlink.h
+
import socket, struct
import xen.lowlevel.netlink
@@ -77,9 +79,9 @@
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 @@
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 --git a/tools/python/xen/remus/qdisc.py b/tools/python/xen/remus/qdisc.py
--- a/tools/python/xen/remus/qdisc.py
+++ b/tools/python/xen/remus/qdisc.py
@@ -35,7 +35,7 @@
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 @@
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 @@
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):
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-05-03 18:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 18:53 [PATCH 0 of 7] Remus: pvops dom0 support Brendan Cully
2010-05-03 18:53 ` Brendan Cully [this message]
2010-05-03 18:53 ` [PATCH 2 of 7] Remus: remove obsolete code Brendan Cully
2010-05-03 18:53 ` [PATCH 3 of 7] Remus: move device handling into its own module Brendan Cully
2010-05-03 18:53 ` [PATCH 4 of 7] Remus: fix VM stringification Brendan Cully
2010-05-03 19:21 ` Measuring the amount of memory read/written (basically touched) by a domU Yuvraj Agarwal
2010-05-03 19:32 ` Keir Fraser
2010-05-03 18:53 ` [PATCH 5 of 7] Remus: include device name in vif objects Brendan Cully
2010-05-03 18:53 ` [PATCH 6 of 7] Remus: add file locking and modprobe utility functions Brendan Cully
2010-05-03 18:53 ` [PATCH 7 of 7] Remus: use IFB for net buffer on newer kernels Brendan Cully
2010-05-03 20:05 ` [PATCH 0 of 7] Remus: pvops dom0 support Gilberto Nunes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0ef3e29c328f52cc9fe.1272912828@kremvax.cs.ubc.ca \
--to=brendan@cs.ubc.ca \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).