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.