Hello,

I found an error where pglue was converting the max_entries and active_count fields of the Table_stats struct to python incorrectly.

It was using the Py_BuildValue code of 'l', which should convert them into signed long integers (32-bit, I think). For some reason, they were being converted to 64-bit signed, but that's a different issue in itself. I changed the code to 'I' for 32-bit unsigned.

Here's a patch to fix this.

-- Derek
>From 5f077992ee10a20f3136178a1f1ee288e468b502 Mon Sep 17 00:00:00 2001
From: Derek Cormier <[email protected]>
Date: Mon, 28 Feb 2011 14:59:54 +0900
Subject: [PATCH 24/24] Pyglue now converts Flow_table fields correctly.

The fields max_entries and active_count were not
being converted into unsigned 32-bit ints when
converting to Python.
---
 src/nox/coreapps/pyrt/pyglue.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/nox/coreapps/pyrt/pyglue.cc b/src/nox/coreapps/pyrt/pyglue.cc
index 176a9f4..69f0910 100644
--- a/src/nox/coreapps/pyrt/pyglue.cc
+++ b/src/nox/coreapps/pyrt/pyglue.cc
@@ -365,7 +365,7 @@ to_python(const Table_stats& ts)
     CONVERT_SWITCH_STAT(ts.matched_count,pyo_matched_count)
     CONVERT_CHECK(pyo_matched_count)
 
-    ret = Py_BuildValue((char*)"{s:l, s:s#, s:l, s:l, s:S, s:S}", 
+    ret = Py_BuildValue((char*)"{s:l, s:s#, s:I, s:I, s:S, s:S}",
             "table_id", ts.table_id, 
             "name", ts.name.c_str(), ts.name.size(),
             "max_entries",   ts.max_entries, 
-- 
1.7.0.4

_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to