2009/06/01

Trident Sign: Listener Adapters

It is a really interesting question why Gendarme think Listener.HandleMessage is a large function. But now I have the answer and today I finally refactored on this function, and designed a few new classes.

Listener Adapters
For an SNMP v1 manager, actually only TRAP v1 message is useful. So why it needs to be bothered by other versions of messages? Now you can use a simple listener adapter for v1 manager and hook it to the Listener object.

Yes, it sounds like filters for incoming messages. That's it.

I have also created a default adapter for backward compatibility, too. You can check how to use it in the samples.


Breaking Change Notice
Now all events for Listener component are obsolete except that one for exceptions. So you must follow the samples to update your code as so to adapt the changes.

Stay tuned.

2009/05/29

CrossRoad Billboard: More on IP v6 and 2.1

Here is the technical details about work item 4016 and release 2.1.

Background
I bought my notebook in 2007, which ships with Windows Vista Home Basic, so from then on I have worked on IP v6 enabled platforms (Windows Vista and Windows 7).

Before the release of 2.0 final, when I tried to make the library IP v6 compatible, I had a lot of tests executed on Windows 7. So I didn't realize that such tests are not enough.

Yes, I did learn a few key points about Windows XP and Windows Server 2003 in March. But I simply neglected them that day and left the bug there. (Next time surely I will do some tests on Windows XP.


Report
BACON report this bug on April 29th (three days after the release day), which soon drew my attention.

This is one of the best bug reports I ever saw, in which not only the problem description was comprehensive, but the solution was presented as well. Soon we closed the work item (on May 1).

I must thank BACON again as he/she did a great job.


Extra
The report was about the library, but in fact there was another relevant issue in the browser.

When I designed the notification panel, it also made use of IP v6 so that all TRAP and INFORM messages can be correctly handled. If we only fixed the library, the browser would still fail to work.

The good news is that both issues are addressed, and 2.1 contains both patches.


Side Notes
First, what if your application only targets Windows 6.0 (Vista and Server 2008) and the upcoming Windows 7 (Windows Server 2008 R2 as well)? Do you need to upgrade? I think you can continue using release 2.0.

Second, as I removed most obsolete items in 2.1 release, please compile your code against 2.0 and follow the migration suggestions. After those changes, you can move on to compile against 2.1.

If you meet any problem with 2.0/2.1, feel free to let me know via this blog or the discussion board.

2009/05/25

CrossRoad Billboard: CrossRoad Refresh (2.1)

This is a silent release, as it only contains important bug fixes for Windows XP/Server 2003, which do not have IP v6 installed by default.

If you meet socket exceptions with 2.0, please try if 2.1 works for you.

Trident Sign: Broken Builds

Is it OK to follow #SNMP builds at CodePlex.com? Probably not. The reason is quite simple, that I just can guarantee the builds can be compiled and that's all.

When I started to add SNMP v3 support, suddenly I noticed that a lot must be changed and no easy way available to keep everything fine. And as some users noticed, the browser in latest builds fails to work.
I have a plan to fix every broken pieces, but that will only happen in June. Please wait till then if you need a new browser to play with. In my opinion, the one in 2.0 (also 2.1) is good enough for basic usage.
Stay tuned.

2009/05/09

Trident Sign: Driving the Fast Car

I am rushed to my feet to explore on SNMP v3. Actually this time with good materials such as Essential SNMP, Net-SNMP agent, and Snmp#Net, the progress is unexpectedly smooth.

I plan to provide a detailed report once I finish the first revision of full SNMP v3 support. Now I just focus on snmpget command line tool and already finish noAuthNoPriv and authNoPriv modes. Tomorrow I will try to finish authPriv mode.

snmpget -v=3 -l=noAuthNoPriv -u=lextm localhost 1.3.6.1.2.1.1.1.0
snmpget -v=3 -l=authNoPriv -u=lexli -a=MD5 -A=testpass localhost 1.3.6.1.2.1.1.1.0
snmpget -v=3 -l=authNoPriv -u=lextudio -a=sha -A=passtest localhost 1.3.6.1.2.1.1.1.0
Above are the test command lines I use to test snmpget against Net-SNMP agent, and you may notice that I choose a style similar to Net-SNMP snmpget.

I do not yet have a driver license, but I think now I have control of this v3 fast car. :)

Stay tuned.

2009/05/03

Trident Sign: SNMP v3 Packet Format

RFC 3412 is the document who defines SNMP v3 packet format. This format is much more complicated than v1 and v2c, and it took me a long time to carefully analyze the structure.

http://www.ietf.org/rfc/rfc3412.txt

Well, actually parsing the entities from packets are easy, as the data types are the same. But v1 and v2c share the same format, which contains a small number of entities, while v3 packets have more entities to provide authentication and privacy features. Then it is rather hard to enhance GetRequestMessage class to support v3, without breaking existing v1 and v2c test cases.

Suddenly, I noticed that I can find v1 and v2c fields from v3 format.

http://www.tcpipguide.com/free/t_SNMPVersion3SNMPv3MessageFormat.htm

For example, community name is just like message user name, and PDU is part of scoped PDU. Therefore, finally I inserted a suite of segment classes into the library. For example, header segment contains necessary fields for v3, but it becomes null for v1 and v2c; security parameters segment becomes community name for v1 and v2c; scope PDU downgrades to PDU.

Well, luckily I still have enough test cases available to ensure my changes do not break existing code. Cool

2009/05/01

Trident Sign: Another Open Source SNMP Library via C#

I just came across another open source SNMP library for .NET, named SnmpSharpNet. Although this project is still a one-man show, and it started around November last year (well, younger than #SNMP), it did implement something missing in our project.


The key advantage of this new library is SNMP v3 support. I have to say it is good news that somebody already implemented that in C#. As SnmpSharpNet is licensed also under LGPL, I think I can visit its repository and grab everything we need.

I sent a mail to its author, but did not recieve any reply yet. But its dev blog is cool, which provides a lot of useful information about its design and evolution (just like this blog :)).

Finally #SNMP has a competitor in this field, and in this way I believe both can evolve faster and better. Yes, we are not alone in this open source community.

2009/04/26

Trident Sign: Road to SNMP v3

We shall finally come to work on SNMP v3. But how to go there step by step? I have a list below and hope that following it we can reach the land.

  1. Configure Net-SNMP agent so that I can test #SNMP against it.
  2. Develop an SNMP v3 compliant manager to talk to that agent.
  3. Design necessary agent parts so that it can perform basic functions like its Net-SNMP counterpart.
Good news is that I just finished the first critical task. Well, that's a good start. Cooking Trident must be cooler :)

Updated:
You must wonder how to configure Net-SNMP agent, so here are the links you must read,

Disclaimer

This is a personal web page. The views expressed on this blog are mine and do not necessarily reflect the views of my current employer, Microsoft Corporation.