Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value mismatch for ipAddressIfIndex? #125

Open
samaity opened this issue Apr 18, 2020 · 1 comment
Open

Value mismatch for ipAddressIfIndex? #125

samaity opened this issue Apr 18, 2020 · 1 comment

Comments

@samaity
Copy link
Contributor

samaity commented Apr 18, 2020

Description
I am a bit confused about how we get information for 1.3.6.1.2.1.4.34.1.3 i.e. ipAddressIfIndex oid which connects the interface with it's assigned IP address. I can see we dont have support for this oid in snmpagent. But I see tha values for this oid. I am guessing it's taking value from snmpd function i.e. ipAddressIfIndex_get

Describe the results you received:

admin@lnos-x1-a-csw07:~$ docker exec -it snmp bash
root@lnos-x1-a-csw07:/# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 21:20 ?        00:00:01 /usr/bin/python /usr/bin/supervisord
root        24     1  0 21:20 ?        00:00:00 /usr/sbin/rsyslogd -n
Debian-+    34     1  0 21:20 ?        00:00:01 /usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux mteTrigger mteTriggerConf ifTable ifXTable inetCidrRouteTable ipCidr
root        42     1 12 21:20 ?        00:12:11 python3.6 -m sonic_ax_impl
root        49     0  1 22:56 ?        00:00:00 bash
root        55    49  0 22:56 ?        00:00:00 ps -ef
root@lnos-x1-a-csw07:/# gdb

(gdb) attach 34
Attaching to process 34

(gdb) b ipAddressIfIndex_get
Breakpoint 1 at 0x7f4b22739310: file ip-mib/ipAddressTable/ipAddressTable.c, line 504.

(gdb) b ip-mib/ipAddressTable/ipAddressTable.c:506
Breakpoint 2 at 0x7f4b2273931c: file ip-mib/ipAddressTable/ipAddressTable.c, line 506.

(gdb) b ip-mib/ipAddressTable/ipAddressTable.c:509
Breakpoint 3 at 0x7f4b22739325: file ip-mib/ipAddressTable/ipAddressTable.c, line 509.

(gdb) b ip-mib/ipAddressTable/ipAddressTable.c:512
Breakpoint 4 at 0x7f4b2273932e: file ip-mib/ipAddressTable/ipAddressTable.c, line 512.

(gdb) b ip-mib/ipAddressTable/ipAddressTable.c:518
Breakpoint 5 at 0x7f4b22739337: file ip-mib/ipAddressTable/ipAddressTable.c, line 518.

**After setting breakpoint, I ran snmpwalk for this oid**
(gdb) run -f -Lo
Starting program: /usr/sbin/snmpd -f -Lo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Turning on AgentX master support.
NET-SNMP version 5.7.3
Connection from UDP: [127.0.0.1]:41687->[127.0.0.1]:161

Breakpoint 1, ipAddressIfIndex_get (rowreq_ctx=rowreq_ctx@entry=0x70e860, ipAddressIfIndex_val_ptr=0x776f70) at ip-mib/ipAddressTable/ipAddressTable.c:504
504	ip-mib/ipAddressTable/ipAddressTable.c: No such file or directory.

(gdb) bt
#0  ipAddressIfIndex_get (rowreq_ctx=rowreq_ctx@entry=0x70e860, ipAddressIfIndex_val_ptr=0x776f70) at ip-mib/ipAddressTable/ipAddressTable.c:504
#1  0x00007ffff77b9579 in _ipAddressTable_get_column (column=3, var=0x776b40, rowreq_ctx=0x70e860) at ip-mib/ipAddressTable/ipAddressTable_interface.c:864
#2  _mfd_ipAddressTable_get_values (handler=<optimized out>, reginfo=<optimized out>, agtreq_info=<optimized out>, requests=0x76acd0)
    at ip-mib/ipAddressTable/ipAddressTable_interface.c:995
#3  0x00007ffff7b82e06 in _baby_steps_access_multiplexer (handler=0x6f76b0, reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x76acd0) at helpers/baby_steps.c:501
#4  0x00007ffff7b97435 in netsnmp_call_handler (requests=0x76acd0, reqinfo=0x7728d0, reginfo=0x6f7100, next_handler=0x6f76b0) at agent_handler.c:526
#5  netsnmp_call_next_handler (current=current@entry=0x6f6fd0, reginfo=reginfo@entry=0x6f7100, reqinfo=reqinfo@entry=0x7728d0, requests=requests@entry=0x76acd0)
    at agent_handler.c:640
#6  0x00007ffff7b832a0 in _baby_steps_helper (handler=0x6f6fd0, reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x76acd0) at helpers/baby_steps.c:312
#7  0x00007ffff7b97435 in netsnmp_call_handler (requests=0x76acd0, reqinfo=0x7728d0, reginfo=0x6f7100, next_handler=0x6f6fd0) at agent_handler.c:526
#8  netsnmp_call_next_handler (current=<optimized out>, reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x76acd0) at agent_handler.c:640
#9  0x00007ffff7b97435 in netsnmp_call_handler (requests=0x76acd0, reqinfo=0x7728d0, reginfo=0x6f7100, next_handler=0x6f7040) at agent_handler.c:526
#10 netsnmp_call_next_handler (current=<optimized out>, reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x76acd0) at agent_handler.c:640
#11 0x00007ffff7b8b007 in table_helper_handler (handler=0x70e860, reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x7ffff780c8f4) at helpers/table.c:712
#12 0x00007ffff7b96e9f in netsnmp_call_handler (requests=0x76acd0, reqinfo=0x7728d0, reginfo=0x6f7100, next_handler=0x6f9860) at agent_handler.c:526
#13 netsnmp_call_handlers (reginfo=0x6f7100, reqinfo=0x7728d0, requests=0x76acd0) at agent_handler.c:611
#14 0x00007ffff7ba4dce in handle_var_requests (asp=asp@entry=0x76b8a0) at snmp_agent.c:2676
#15 0x00007ffff7ba5a7f in handle_pdu (asp=asp@entry=0x76b8a0) at snmp_agent.c:3394
#16 0x00007ffff7ba5c78 in netsnmp_handle_request (asp=asp@entry=0x76b8a0, status=status@entry=0) at snmp_agent.c:3281
#17 0x00007ffff7ba6152 in handle_snmp_packet (op=<optimized out>, session=<optimized out>, reqid=<optimized out>, pdu=0x767ae0, magic=<optimized out>) at snmp_agent.c:1987
#18 0x00007ffff745bd31 in _sess_process_packet (sessp=0x7659d0, sp=0x765a00, isp=0x765690, transport=0x765740, opaque=0x7ac270, olength=<optimized out>,
    packetptr=0x7ae290 "00\002\001\001\004\006public\240#\002\004\027\227\361@\002\001", length=50) at snmp_api.c:5441
#19 0x00007ffff745ca79 in _sess_read (sessp=0x7659d0, fdset=0x7fffffffe9c0) at snmp_api.c:5876
#20 0x00007ffff745d859 in snmp_sess_read2 (sessp=sessp@entry=0x7659d0, fdset=fdset@entry=0x7fffffffe9c0) at snmp_api.c:5908
#21 0x00007ffff745d8ab in snmp_read2 (fdset=fdset@entry=0x7fffffffe9c0) at snmp_api.c:5504
#22 0x000000000040483f in receive () at snmpd.c:1328
#23 main (argc=<optimized out>, argv=<optimized out>) at snmpd.c:1115

Describe the results you expected:

I guess this is not giving correct output as the INTERGER value does not match with ifindex value which should be the case in ideal scenario.

as per net-snmp official doc,

"The index value that uniquely identifies the interface to which this entry is applicable. The interface identified by a particular value of this index is the same interface as identified by the same value of the IF-MIB's ifIndex."


admin@lnos-x1-a-csw06:~$ show ip int
Interface    IPv4 address/mask    Admin/Oper
-----------  -------------------  ------------
Ethernet0    10.2.1.0/31          up/up
Ethernet4    10.2.2.0/31          up/up

ifindex oid

root@lnos-x1-a-csw06:/#  snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.2.1.2.2.1.1
iso.3.6.1.2.1.2.2.1.1.1 = INTEGER: 0
iso.3.6.1.2.1.2.2.1.1.3 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.1.5 = INTEGER: 4
iso.3.6.1.2.1.2.2.1.1.7 = INTEGER: 6
iso.3.6.1.2.1.2.2.1.1.9 = INTEGER: 8

ipAddressIfIndex oid

admin@lnos-x1-a-csw06:~$ docker exec -it snmp bash
root@lnos-x1-a-csw06:/#  snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.2.1.4.34.1.3
iso.3.6.1.2.1.4.34.1.3.1.4.10.0.0.2 = INTEGER: 1
**iso.3.6.1.2.1.4.34.1.3.1.4.10.2.1.0 = INTEGER: 106**
**iso.3.6.1.2.1.4.34.1.3.1.4.10.2.2.0** = INTEGER: 108**
iso.3.6.1.2.1.4.34.1.3.1.4.127.0.0.1 = INTEGER: 1
iso.3.6.1.2.1.4.34.1.3.1.4.172.21.47.40 = INTEGER: 2
iso.3.6.1.2.1.4.34.1.3.1.4.240.127.1.1 = INTEGER: 4
@samaity samaity changed the title Do we have oid support for ipAddressIfIndex? Value mismatch for ipAddressIfIndex? Apr 18, 2020
@qiluo-msft
Copy link
Contributor

You are right "we dont have support for this oid in snmpagent".
If there is no implementation in snmpagent, snmpd will get the IfIndex from Linux kernel, which will be totally different from SONiC internal IfIndex.
Suggest you implement this OID in snmpagent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants