February 21, 2008

Hand-decoding tcpdump'ed SNMPv1 packets

I can't go into too many details about what I'm working on right now, but it involves processing SNMP requests and generating SNMP responses. The hard part is that I'm writing all my own code to parse and process them, as I can't use the Net-SNMP library to do it for various reasons. (Trust me, I wish I could.)

What makes this so much fun (not!) is having to debug and troubleshoot my code by hand-decoding the SNMP messages, captured off the network using tcpdump. If you've never done this, I'd compare it to performing long division on really large numbers. It's not particularly hard, but it sure is tedious. Here's an example of a pair of request/response packets that I've hand-annotated:

Screenshot of hand-annotated tcpdump of an SNMP request/response pair

Yeah. This certainly isn't one of the glorious parts of software development. But, it needs to be done, right?

Tags: ,

Posted by dossy at 11:40 AM | 602 | Link | Comments (3) | Trackbacks (0) | Bloglines | Feedster | Technorati | BlogPulse
Overstock.com, Inc.


Comments
1
Gravatar Icon

Can't you get Ethereal to do this for you?

Posted by: Guan Yang on February 21, 2008 at 11:47 AM | Permalink
2
Gravatar Icon

Guan: At first, I thought not--I can't run Ethereal on the host that's able to capture the packets. However, I can write the capture file and ship that to another machine where I can run Ethereal. Duh!

This also helped me track down the bug I've been fighting with for the last half-hour: I'm apparently computing the IP header and UDP header checksums wrong, which Ethereal clearly tells me I got wrong--and, what it should have been! Yay!

Thanks!

Posted by: Dossy on February 21, 2008 at 12:11 PM | Permalink
3
Gravatar Icon

Ethereal is probably sufficient for whatever you're doing, but new development is being done under the name "Wireshark".
http://www.wireshark.org/

Posted by: Jamie Rasmussen on March 2, 2008 at 09:55 PM | Permalink
Post a comment

Who are you?

(what is this?)
(what is this?)
(what is this?)
(what is this?)


(required)
(required, not displayed)


Allowed markup: a href title, abbr title, acronym title, b, blockquote cite type, br, code, dd, dl, dt, em, i, li, ol, p, pre, strike, strong, tt, ul.

Please type in the letters shown in the image below:
Graphical CAPTCHA.

A preview of your comment:

Posted by: