[Ocfs2-tools-devel] [PATCH 8/8] odump.py: fix getOCFS2Payload v2

Jeff Liu jeff.liu at oracle.com
Fri Aug 21 20:23:30 PDT 2009


this patch fix two issues.
first, the 2nd parameter for getOCFS2Payload is invalid, remove it.
second, if there is no Payload matched in wireshark dissected packets, the process do not need to move on,
just return the ethernet and o2net header info is ok.

Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
---
 ADDONS/odump.py |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/ADDONS/odump.py b/ADDONS/odump.py
index cf84287..ebc46d4 100755
--- a/ADDONS/odump.py
+++ b/ADDONS/odump.py
@@ -114,7 +114,7 @@ def getOCFS2Header(msg, fmtstr=MAGIC_FMT + TYPE_FMT + KEY_FMT):
 
     return pdict
 
-def getOCFS2Payload(plist, func):
+def getOCFS2Payload(plist):
     ''' return payload dictionary fill with the payload entries
         start from Payload to end, line by line '''
 
@@ -671,8 +671,17 @@ def main(srcfile, dstfile, o2type, verbose):
             packets = []
             continue
 
-        if magicABB in ('KQ', 'KS'):
-	    o2header = ocfs2dict['o2header']
+        # returns payload dictionary
+        ocfs2payload = getOCFS2Payload(ocfs2msg)
+
+        # if there is no payload string found, just return
+        # the ethernet and ocfs2 header entries which we are
+        # interested in.
+        if magicABB in ('KQ', 'KS') or not ocfs2payload:
+	    try:
+	        o2header = ocfs2dict['o2header']
+	    except KeyError:
+	        o2header = ''
 	    msgstr = ''.join([ethstr, o2header, '\n'])
 	    dfp.write(msgstr)
 	    packets = []
@@ -680,14 +689,12 @@ def main(srcfile, dstfile, o2type, verbose):
 
         # function name constructed from Message name
         func = ''.join(string.split(type, ' ')) + 'Msg'
-        # returns payload dictionary
-        ocfs2payload = getOCFS2Payload(ocfs2msg, func)
 
-        o2msgstr = ''
         try:
 	    o2msgstr = globals()[func](ocfs2payload)
         except KeyError: # DLM message do not support encountered
 	    sys.stderr.write('Error: Unknown message %s\n' %  func)
+	    o2msgstr = ''
 
         try:
 	    o2header = ocfs2dict['o2header']
-- 
1.5.4.3




More information about the Ocfs2-tools-devel mailing list