[snmp] TrapPduv1.getIpAddress() returns negative values
Josh Bers
jbers at bbn.com
Mon Nov 6 13:29:06 GMT 2006
This may be an issues with Java and not with the stack. Since Java assumes
all byte variables represent signed integers if you print them as such they
will appear as negative values, which would explain why you see
-64.-88.10.60. This is in fact the correct IP address (192.168.10.60). So it
sounds like your problem may just be one of representing the ip addresses as
strings. What function are you using to print them out?
Josh Bers
Mobile Networking Systems
BBN Technologies
jbers at bbn.com
ph. 617.873.4262
fax. 617.873.4523
www.bbn.com
> -----Original Message-----
> From: snmp-bounces at snmp.westhawk.co.uk
> [mailto:snmp-bounces at snmp.westhawk.co.uk] On Behalf Of Birgit
> Arkesteijn
> Sent: Monday, November 06, 2006 8:08 AM
> To: List for discussion of the Westhawk SNMP stack
> Subject: Re: [snmp] TrapPduv1.getIpAddress() returns negative values
>
>
> Hi Jordi,
>
> I've never seen this behaviour before.
>
> I just run the snmpv1 examples ReceiveTrap (on one machine) &
> SendTrap (on the other machine) against each other, using jdk
> 1.4 on Linux, successfully.
>
> run 1:
> trap id 1, v SNMPv1 from host 192.67.4.53, sent from port 33504
>
> run 2:
> raw pdu v SNMPv1 from host 192.67.4.53, sent from port 33504
>
>
> Which platform do you run the stack?
> Which jdk do you use?
>
> Which IP address are you talking about?
> - the TrapPduv1.getIpAddress()
> - TrapEvent.getPdu().getContext().getHost()
> - something else
> What do you use to print the IP address?
>
> Cheers, Birgit
>
>
> On Sun, Nov 05, 2006 at 07:14:28PM +0100, Jordi Vea wrote:
> > Hello,
> >
> > I'm quite new using the stack (v 5.1), but I have detected a strange
> > behaviour with the TrapPduv1.
> > I'm receiving traps from a SNMP agent at the IP 192.168.10.60, but
> > the stack gets the IP as -64.-88.10.60. ( -64=192-256, -88=168-256 )
> > I sniffed the SNMP PDU using Ethereal, and the Agent
> Address was ok,
> > so I think this might be a bug from the stack. It has an easy work
> > around, but has anyone detected this behaviour before?
> >
> > Thanks,
> > Jordi Vea
>
> --
> -- Birgit Arkesteijn, birgit at westhawk.co.uk,
> -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
> -- tel.: +44 (0)161 237 0660
> -- <URL: http://www.westhawk.co.uk>
> _______________________________________________
> snmp mailing list
> snmp at snmp.westhawk.co.uk
> http://snmp.westhawk.co.uk/mailman/listinfo/snmp
>
More information about the snmp
mailing list