[AGENT++] Problem with OctetStr and notifications...

Mr. AWD mrawd at excite.com
Thu Nov 4 05:48:30 CET 2004


Before I inser another text that didn't go through, I wona to appologies for those empty emails. I guess this Excite mail system is not cooperating today. Hopefully, this one will go through the way it should.
--------------------------------------------------------------------- 
Hello there!!

Well, for last few weeks I was working on the configuration file support and finally everything is done. I could specify users, access, views, groups, some of the system group objects and three more for the notification support (notify, address, and params entries). Down below you can see a part of the file that has notification configuration in there.

Here is a problem. For the address entries I have entered three different IP addresses and there where suppose to send notifications/traps to all three of them (at least that is what I hoped will happen). Unfortunately, traps/notification is sent only to the first item on the list and the rest is ignored. Even if I change the order that is down there, very same thing happens. Also, by specifying all three destinations with V2 notification, only the first one gets notified.

So, the question is whether this is normal behavior or just something wrong on my end? Basically, should I expect traps to be sent to more then one location if I enter more then one IP address as destination?

Hmmm, after looking into the code a bit more I was able to see that all three requests where processed, but I found another strange spot in there that I need some help with. Here is a part of the code that doesn’t behave the way it should:
//////////////// C O D E S T A R T ///////////////////
OctetStr oIndex;
OctetStr oTag;
OctetStr oParam;
Oidx oidDomain;
OctetStr oAddress;
UdpAddress udpAddress;
IpAddress ipAddress;
udpAddress = (*it_Address)->sAddress.c_str();
ipAddress = udpAddress;
for (int i = 0; i < 4; i++)
{
oAddress += (unsigned char)ipAddress[i];
}
oAddress += (udpAddress.get_port() >> 8);
oAddress += (udpAddress.get_port() & 0x00FF);
if (snmpTargetAddrEntry::instance->add_entry(oIndex, // row index
oidDomain, // UDP domain
oAddress, // target address
oTag, // tag
oParam)) // params entry
oIndex.clear();
oidDomain.clear();
oTag.clear();
oParam.clear();
oAddress.clear();
//////////////// C O D E E N D ///////////////////

This code is in the while loop, so it gets run as many times as there are address entries in the configuration file. During the first pass, everything is fine. During the second one, problem appears in the FOR loop. oAddress OctetStr object gets the second address 6 bytes later then it should!!! The first 6 are left at all zeros. It looks like that oAddress.clear() at the bottom of the code didn’t clear the counter and everything starts shifter 6 bytes.
Anyone can help with this?

Thanks

Fedja

########## C O N F I G F I L E ###############
#
# Name: NotifyEntry
# Syntax:
# Name <string>
# Tag <string>
# Type <trap, inform>
#
NotifyEntry Entry01 BaseTag trap
#
# Name: AddressEntry
# Syntax:
# AddressName <string>
# DomainName <UDPDomain, IPXDomain,...>
# TransportAddress <string>
# NotifyTag <string>
# ParamName <string>
#
AddressEntry Address1 UdpDomain 10.16.205.65/162 BaseTag v1Params
AddressEntry Address2 UdpDomain 10.16.205.107/162 BaseTag v2Params
AddressEntry Address3 UdpDomain 10.16.205.110/162 BaseTag v3Params
#
# Name: ParamsEntry
# Syntax:
# ParamsName <string>
# MessageProcessingModel <MPv1, MPv2, MPv3>
# SecurityModel <SNMPv1, SNMPv2, SNMPv3>
# SecurityName <string>
# SecurityLevel <noAuthNoPriv, authNoPriv, authPriv>
#
ParamsEntry v1Params MPv1 SNMPv1 public noAuthNoPriv
ParamsEntry v2Params MPv2 SNMPv2 public noAuthNoPriv
ParamsEntry v3Params MPv3 SNMPv3 MD5 authNoPriv

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



More information about the AGENTPP mailing list