snmp_sess_open using wrong port?

Eric Loos <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This problem has got me baffled, the problem appears in the RTG port,
but as far as I can see the problem is net-snmp related.

I am running rtg-0.7.4 (not very relevant to the discussion perhaps) on
a FreeBSD 6.1
./rtgpoll:
        libnetsnmp.so.9 => /usr/local/lib/libnetsnmp.so.9 (0x28078000)

[root@xxxxx /usr/ports/net/rtg/work/rtg-0.7.4/src]# pkg_info | grep snmp
net-snmp-5.2.2_2    An extendable SNMP implementation

I noticed (and a tcpdump confirms) that RTG is sending the queries to
port 161 while I have it configured for port 12406. I know this sounds
like a RTG problem, but in the following code snippet:

                session.remote_port = set.snmp_port;
      printf("Debug %d\n",session.remote_port);
            session.community = current->community;
            session.community_len = strlen(session.community);

            sessp = snmp_sess_open(&session);
            anOID_len = MAX_OID_LEN;
            pdu = snmp_pdu_create(SNMP_MSG_GET);
            read_objid(current->objoid, anOID, &anOID_len);
            entry = current;
            last_value = current->last_value;
            init = current->init;
            insert_val = 0;
            bits = current->bits;
            strncpy(storedoid, current->objoid, sizeof(storedoid));
                current = getNext();
        }
        if (set.verbose >= DEVELOP)
            printf("Thread [%d] unlocking (done grabbing current)\n",
worker->index);
        PT_MUTEX_UNLOCK(&crew->mutex);
        snmp_add_null_var(pdu, anOID, anOID_len);
        if (sessp != NULL)
           status = snmp_sess_synch_response(sessp, pdu, &response);
        else
           status = STAT_DESCRIP_ERROR;

        /* Collect response and process stats */
        PT_MUTEX_LOCK(&stats.mutex);
        if (status == STAT_DESCRIP_ERROR) {
            stats.errors++;
            printf("*** SNMP Error: (%s) Bad descriptor.\n",
session.peername);
        } else if (status == STAT_TIMEOUT) {
            stats.no_resp++;
            printf("*** SNMP No response: (%s@%s) on %d.\n",
session.peername,
               storedoid,session.remote_port);

at both the Debug statement and the session.remote_port at the bottom, I
am getting the correct port number 12406, but still my tcpdump shows the
traffic goes to 161:

Initializing SNMP (v1, port 12406).
Debug 12406
*** SNMP No response: ([email protected]) on 12406.
Thread [3] processing 192.168.255.2 .1.3.6.1.2.1.2.2.1.14.5 (9 work
units remain in queue)

[root@xxx /usr/ports/net-mgmt/net-snmp/work/net-snmp-5.2.2/man]#
snmpwalk -v 1 -c public x.y.74.197 .1.3.6.1.4.1.12342.4.4.4.2.0
Timeout: No Response from 217.113.74.197
[root@xxx/usr/ports/net-mgmt/net-snmp/work/net-snmp-5.2.2/man]# snmpwalk
- -v 1 -c public x.y.74.197:12406 .1.3.6.1.4.1.12342.4.4.4.2.0
Pivia::lruItemBulk.0 = Gauge32: 0

I would be glad to help but I don't know exactly where to look from here...


Sincerely,

Eric Loos

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFAYXoJFRCxf142KURAozAAJ9DJzPD7JFnGKf7eui0MEVI5TUNLgCfXnn4
1HjEQZTGrjyXv7KVJZuIyqg=
=JXtI
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.