Hello all.
I have a problem with setting the IpAddress with scli. Accordingly to the RFC: --- The IpAddress type represents a 32-bit internet address. It is represented as an OCTET STRING of length 4, in network byte-order. --- And I'm using the inet_aton function to convert the string representation. But tcpdump says that the value is not 4 bytes length, and agent sets the random value.
The pieces of code follows:
struct in_addr addr; inet_aton(argv[2], &addr); ... if (info && info[idx]) { info[idx]->sipProxyTableOutAddr=&addr; sss_dgw_mib_set_sipProxyTableEntry(interp->peer, info[idx], SSS_DGW_MIB_SIPPROXYTABLEOUTADDR); }
Where argv[2] is string representation (i.e. "127.0.0.1") of IP address. info contains previously retreived value.
Best Regards, Ruslan.
On Tue, Jul 08, 2008 at 04:26:33PM +0400, rbondar@rich-logic.com wrote:
I have a problem with setting the IpAddress with scli. Accordingly to the RFC:
The IpAddress type represents a 32-bit internet address. It is represented as an OCTET STRING of length 4, in network byte-order.
And I'm using the inet_aton function to convert the string representation. But tcpdump says that the value is not 4 bytes length, and agent sets the random value.
So what is actually contained in the packet?
The pieces of code follows:
struct in_addr addr; inet_aton(argv[2], &addr);
... if (info && info[idx]) { info[idx]->sipProxyTableOutAddr=&addr; sss_dgw_mib_set_sipProxyTableEntry(interp->peer, info[idx], SSS_DGW_MIB_SIPPROXYTABLEOUTADDR); }
Where argv[2] is string representation (i.e. "127.0.0.1") of IP address. info contains previously retreived value.
The code snippet is not sufficient to figure this out; it is for example unclear whether sipProxyTableOutAddr is part of an instance identifier.
/js
PS: If this is a MIB under development, please avoid using IpAddress and instead use the version neutral InetAddress.
On Tue, 8 Jul 2008 22:44:43 +0200, Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de wrote:
On Tue, Jul 08, 2008 at 04:26:33PM +0400, rbondar@rich-logic.com wrote:
I have a problem with setting the IpAddress with scli. Accordingly to the RFC:
The IpAddress type represents a 32-bit internet address. It is represented as an OCTET STRING of length 4, in network byte-order.
And I'm using the inet_aton function to convert the string
representation.
But tcpdump says that the value is not 4 bytes length, and agent sets
the
random value.
So what is actually contained in the packet?
The pieces of code follows:
struct in_addr addr; inet_aton(argv[2], &addr);
... if (info && info[idx]) { info[idx]->sipProxyTableOutAddr=&addr; sss_dgw_mib_set_sipProxyTableEntry(interp->peer, info[idx], SSS_DGW_MIB_SIPPROXYTABLEOUTADDR); }
Where argv[2] is string representation (i.e. "127.0.0.1") of IP address. info contains previously retreived value.
The code snippet is not sufficient to figure this out; it is for example unclear whether sipProxyTableOutAddr is part of an instance identifier.
/js
PS: If this is a MIB under development, please avoid using IpAddress and instead use the version neutral InetAddress.
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
tcpdump follows: 11:20:05.374293 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 79) localhost.44927 > localhost.snmp: [bad udp cksum bbc7!] { SNMPv2c { SetRequest(36) R=1804289391 E:20379.2.1.3.2.3.1.4.1=[inetaddr len!=4] } } 11:20:05.374666 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 83) localhost.snmp > localhost.44927: [bad udp cksum acb7!] { SNMPv2c { GetResponse(40) R=1804289391 E:20379.2.1.3.2.3.1.4.1=0.0.0.0 } }
Definition of sss_dgw_mib_sipProxyTableEntry_t: typedef struct { ... guchar *sipProxyTableOutAddr; /* rw SNMPv2-SMI::IpAddress */ #define SSS_DGW_MIB_SIPPROXYTABLEOUTADDRLENGTH 4 .... } sss_dgw_mib_sipProxyTableEntry_t;
static int set_dgw_proto_sip_proxy_out_addr(scli_interp_t *interp, int argc, char **argv) { sss_dgw_mib_sipProxyTableEntry_t **info = NULL; g_return_val_if_fail(interp, SCLI_ERROR); int idx; ... char* value=argv[2]; int len=strlen(value);
unsigned char raw_addr[5]; struct in_addr addr; inet_aton(argv[2], &addr); sss_dgw_mib_get_protocolSIPProxyTable(interp->peer, &info, SSS_DGW_MIB_SIPPROXYTABLEOUTADDR); ... if (info && info[idx]) { info[idx]->sipProxyTableOutAddr=&addr; sss_dgw_mib_set_sipProxyTableEntry(interp->peer, info[idx], SSS_DGW_MIB_SIPPROXYTABLEOUTADDR); sss_dgw_mib_free_sipProxyTableEntry(info[idx]); } return SCLI_OK; }
Best regards, Ruslan.
P.S. Thanks for advice.
On Wed, Jul 09, 2008 at 11:23:25AM +0400, rbondar@rich-logic.com wrote:
tcpdump follows:
[...]
Definition of sss_dgw_mib_sipProxyTableEntry_t:
[...]
I tracked this down and found that fixed length octet strings in general seem to be broken. To fix this problem, I have to make changes to gsnmp and libsmi. If you can upgrade your development environment to the SVN versions, the problem should hopefully go away.
/js
On Tue, 15 Jul 2008 23:49:22 +0200, Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de wrote:
On Wed, Jul 09, 2008 at 11:23:25AM +0400, rbondar@rich-logic.com wrote:
tcpdump follows:
[...]
Definition of sss_dgw_mib_sipProxyTableEntry_t:
[...]
I tracked this down and found that fixed length octet strings in general seem to be broken. To fix this problem, I have to make changes to gsnmp and libsmi. If you can upgrade your development environment to the SVN versions, the problem should hopefully go away.
/js
-- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 http://www.jacobs-university.de/
Can you notify me, when I can checkout. Today I've fetched the latest versions of scli and gsnmp. gsnmp is unable to configure (It wants ltmain.sh at autoconf stage), and libsmi wasn't changed since 2008-04-18.
Best regards, Ruslan.
On Wed, Jul 16, 2008 at 03:53:26PM +0400, rbondar@rich-logic.com wrote:
Can you notify me, when I can checkout.
I checked in the changes before sending my email...
Today I've fetched the latest versions of scli and gsnmp. gsnmp is unable to configure (It wants ltmain.sh at autoconf stage),
I don't know; works for me. You have to run autogen.sh though.
and libsmi wasn't changed since 2008-04-18.
$ svn log dump-scli.c | head ------------------------------------------------------------------------ r9576 | schoenw | 2008-07-15 23:46:07 +0200 (Tue, 15 Jul 2008) | 2 lines
Added support for fixed length string types.
/js
Hello all. I have another one problem after installing the latest versions of gsnmp, libsmi and scli from subversion. tcpdump shows that the IP address transferred from agent to scli is correct, but scli shows an empty string. Sometimes I see that the entire content of variable holding the IP address is '\001' repeats 100 times. Looks like trash (memory wasn't allocated?). Also, when I'm trying to fmt_ipv4_address valgrind says "Invalid read of address xxxxxx. Memory wasn't allocated or stack'd." And I've noticed the same issue with some integers, some strings. It looks like some problems with memory, but I haven't any clue to it. Everithing was fine before the update (except the setting of IP address).
tcpdump log: 12:57:24.155589 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 114) localhost.40136 > localhost.snmp: [bad udp cksum 54c1!] { SNMPv2c { GetNextRequest(71) R=1804289386 SSS-DGW-MIB::protocolRADIUSEnable SSS-DGW-MIB::protocolRADIUSServerIP SSS-DGW-MIB::protocolRADIUSSecret } }
12:57:24.156088 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 132) localhost.snmp > localhost.40136: [bad udp cksum b219!] { SNMPv2c { GetResponse(89) R=1804289386 SSS-DGW-MIB::protocolRADIUSEnable.0=1 SSS-DGW-MIB::protocolRADIUSServerIP.0=127.0.0.1 SSS-DGW-MIB::protocolRADIUSSecret.0="bad secret" } }
The GDB view into the variable: 2321 sss_dgw_mib_get_protocolRADIUS(interp->peer, &info, 0); 2323 if (interp->peer->error_status) (gdb) print *info $1 = {protocolRADIUSEnable = 0x81705b4, protocolRADIUSServerIP = 0x8170004 "", protocolRADIUSSecret = 0x8170678 "bad secret", _protocolRADIUSSecretLength = 10} (gdb) print *info->protocolRADIUSServerIP $3 = 0 '\0'
The definition of struct: typedef struct { gint32 *protocolRADIUSEnable; /* rw */ guchar *protocolRADIUSServerIP; /* rw SNMPv2-SMI::IpAddress */ #define SSS_DGW_MIB_PROTOCOLRADIUSSERVERIPLENGTH 4 guchar *protocolRADIUSSecret; /* rw OctetString */ #define SSS_DGW_MIB_PROTOCOLRADIUSSECRETMINLENGTH 0 #define SSS_DGW_MIB_PROTOCOLRADIUSSECRETMAXLENGTH 65535 guint16 _protocolRADIUSSecretLength; } sss_dgw_mib_protocolRADIUS_t;
On Wed, Jul 23, 2008 at 03:25:02PM +0400, rbondar@rich-logic.com wrote:
I have another one problem after installing the latest versions of gsnmp, libsmi and scli from subversion.
Everything works fine here. Can you double check your installation? If you use dynamically linked binaries, please make sure that you get the correct library.
/js
participants (2)
-
Juergen Schoenwaelder
-
rbondar@rich-logic.com