Himanshu,

I haven't looked at that part of the code, but I wouldn't expect snmpd
to dynamically handle changing interfaces.  The only thing I could
suggest is to stop the service while initializing the wifi, and
restarting it when wifi is up.  When it starts, it should find all
interfaces, unless you've changed that in the configuration.

John

On 08-Jul-2020 5:53 PM, Himanshu Sharma wrote:
> Hi John,
>
> My system has two interfaces one for Ethernet eth0 and the other for
> wifi wlan0..but the problem is when system bootup (Ethernet)eth0
> Acquires ip address using dhcp..I can successful do snmp operation
> using the ip address of the ethernet..Problem is the moment I connect
> wifi(wlan0) to a wifi  router ..the wlan0 interface acquires ip
> address, and snmpd crashes.
>
> -Himanshu
>
>
> On Thu, Jul 9, 2020, 02:50 Himanshu Sharma
> <himanshusharma1...@gmail.com <mailto:himanshusharma1...@gmail.com>>
> wrote:
>
>     Hi John,
>
>     Thanks for prompt reply.
>     I am using net-snmp version 5.8.
>     I want SNMP to serve on both ethernet and wifi.When my system
>     bootup Ethernet eth0 in my case will acquire ip address using dhcp
>     immediately..At this moment my snmpd is already up.
>     Now, at some point later..I will connect my system to wifi
>     router(wlan0) and interface acquires IP address ,but snmpd crashes
>     immediately and backtrace change everytime..
>     Is this a valid scenario? I thought snmpd can support mutiple
>     interfaces at them same time..
>
>     Thank & Regards
>     Himanshu.
>
>     -Himanshu
>
>     On Thu, Jul 9, 2020, 02:35 John Bize <jb...@godswind.org
>     <mailto:jb...@godswind.org>> wrote:
>
>         Himanshu,
>
>         I don't know what type of system you are using, but I'm
>         guessing that without predictive interface names it might be
>         very old. 
>
>         I don't know what you are trying to accomplish.  Do you want
>         to serve SNMP on both the WiFi and Ethernet interfaces?  If
>         so, you may need to hold off starting snmpd until the
>         interfaces are up and your WiFi is connected.  I wouldn't
>         excpect snmpd to dynamically handle changing interfaces.  If
>         you only want to serve it on the Ethernet interface ans it is
>         statically configured, then specify that IP with the
>         "agentAddress" configuration directive. 
>
>         I am using DHCP on one interface of a dual-interface system.  
>         It is Debian Linux 10.  To prevent the snmpd from starting
>         until after the interfaces are up and configured, my snmpd
>         Unit file (snmpd.service) looks like this:
>
>             [Unit]
>             Description=Simple Network Management Protocol (SNMP) Daemon.
>             After=network.target
>             # Wait for network interfaces to be all the way up (incl.
>             DHCP)
>             After=systemd-networkd-wait-online.service
>             Wants=systemd-networkd-wait-online.service
>             ConditionPathExists=/etc/snmp/snmpd.conf
>
>
>             [Service]
>             
> Environment="MIBSDIR=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp"
>             Environment="MIBS="
>             Type=simple
>             ExecStart=/usr/sbin/snmpd -a -Lsd -Lf /var/log/snmpd.log
>             -u Debian-snmp -g Debian-snmp -I
>             -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid
>             ExecReload=/bin/kill -HUP $MAINPID
>
>             [Install]
>             WantedBy=multi-user.target
>
>         If none of this helps, please add more information about your
>         system, snmpd version, and what you are trying to do.
>
>         John
>
>
>         On 08-Jul-2020 4:42 PM, Himanshu Sharma wrote:
>>         +Bill and Larry
>>
>>         -Himanshu
>>
>>         On Thu, Jul 9, 2020 at 2:02 AM Himanshu Sharma
>>         <himanshusharma1...@gmail.com
>>         <mailto:himanshusharma1...@gmail.com>> wrote:
>>
>>             Hi All,
>>
>>             I am facing a very weird issue.
>>             I have 2  interfaces on my system.
>>             *The moment the wlan0 acquires the ip address snmpd crashes.*
>>             If there is only one interface let say *eth0*.,snmpd
>>             works fine.
>>             One more problem is *coredump* analysis of crash using
>>             gdb, shows different backtrace everytime.
>>             I am attaching the back trace for reference..Also the
>>             ifconfig of my local system.
>>             It would be great if anyone can help me.. I am not able
>>             to find any solution 😞
>>
>>             -Himanshu
>>
>>
>>             *#0  __libc_do_syscall () at
>>             ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
>>             #1  0xb6d6d1b2 in __libc_signal_restore_set
>>             (set=0xbeb7b320) at
>>             ../sysdeps/unix/sysv/linux/nptl-signals.h:79
>>             #2  __GI_raise (sig=sig@entry=6) at
>>             ../sysdeps/unix/sysv/linux/raise.c:48
>>             #3  0xb6d6de3a in __GI_abort () at abort.c:89
>>             #4  0xb6d947da in __libc_message
>>             (do_abort=do_abort@entry=2, fmt=<optimized out>) at
>>             ../sysdeps/posix/libc_fatal.c:175
>>             #5  0xb6d98b28 in malloc_printerr (action=<optimized
>>             out>, str=0xb6e14de4 "corrupted double-linked list",
>>             ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5087
>>             #6  0xb6d9b0d4 in _int_malloc (av=av@entry=0xb6e317a4
>>             <main_arena>, bytes=bytes@entry=12) at malloc.c:3743
>>             #7  0xb6d9c556 in __libc_calloc (n=<optimized out>,
>>             elem_size=<optimized out>) at malloc.c:3246
>>             #8  0xb6ecbcb8 in init_agent_snmp_session
>>             (session=0x1dceac0, pdu=<optimized out>) at snmp_agent.c:1587
>>             #9  0xb6ecd368 in handle_snmp_packet (session=<optimized
>>             out>, pdu=<optimized out>, magic=0x0, reqid=<optimized
>>             out>, op=<optimized out>) at snmp_agent.c:2227
>>             #10 0xb6e503e4 in _sess_process_packet_handle_pdu
>>             (isp=0x1dcea78, isp=0x1dcea78, transport=0x1dce888,
>>             pdu=0x1dd68e0, sp=0x1dceac0, sessp=<optimized out>) at
>>             snmp_api.c:5807
>>             #11 _sess_process_packet (sessp=sessp@entry=0x1dcea60,
>>             sp=sp@entry=0x1dceac0, isp=0x1dcea78,
>>             transport=transport@entry=0x1dce888,
>>             opaque=opaque@entry=0x1dd4b18, olength=olength@entry=60,
>>                 packetptr=0x1de5060 "0M\002\001", length=79) at
>>             snmp_api.c:5863
>>             #12 0xb6e50a3a in _sess_read
>>             (sessp=sessp@entry=0x1dcea60,
>>             fdset=fdset@entry=0xbeb7b9a0) at snmp_api.c:6124
>>             #13 0xb6e50b14 in snmp_sess_read2
>>             (sessp=sessp@entry=0x1dcea60,
>>             fdset=fdset@entry=0xbeb7b9a0) at snmp_api.c:6397
>>             #14 0xb6e50b44 in snmp_read2
>>             (fdset=fdset@entry=0xbeb7b9a0) at snmp_api.c:5912
>>             #15 0x00012c0c in receive () at snmpd.c:1342
>>             #16 0x000126a4 in main (argc=<optimized out>,
>>             argv=<optimized out>) at snmpd.c:1125
>>             *
>>
>>             *
>>             #1  0xb6d6d1b2 in __libc_signal_restore_set
>>             (set=0xbeb7b320) at
>>             ../sysdeps/unix/sysv/linux/nptl-signals.h:79
>>             #2  __GI_raise (sig=sig@entry=6) at
>>             ../sysdeps/unix/sysv/linux/raise.c:48
>>             #3  0xb6d6de3a in __GI_abort () at abort.c:89
>>             #4  0xb6d947da in __libc_message
>>             (do_abort=do_abort@entry=2, fmt=<optimized out>) at
>>             ../sysdeps/posix/libc_fatal.c:175
>>             #5  0xb6d98b28 in malloc_printerr (action=<optimized
>>             out>, str=0xb6e14de4 "corrupted double-linked list",
>>             ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5087
>>             #6  0xb6d9b0d4 in _int_malloc (av=av@entry=0xb6e317a4
>>             <main_arena>, bytes=bytes@entry=12) at malloc.c:3743
>>             #7  0xb6d9c556 in __libc_calloc (n=<optimized out>,
>>             elem_size=<optimized out>) at malloc.c:3246
>>             #8  0xb6ecbcb8 in init_agent_snmp_session
>>             (session=0x1dceac0, pdu=<optimized out>) at snmp_agent.c:1587
>>             #9  0xb6ecd368 in handle_snmp_packet (session=<optimized
>>             out>, pdu=<optimized out>, magic=0x0, reqid=<optimized
>>             out>, op=<optimized out>) at snmp_agent.c:2227
>>             #10 0xb6e503e4 in _sess_process_packet_handle_pdu
>>             (isp=0x1dcea78, isp=0x1dcea78, transport=0x1dce888,
>>             pdu=0x1dd68e0, sp=0x1dceac0, sessp=<optimized out>) at
>>             snmp_api.c:5807
>>             #11 _sess_process_packet (sessp=sessp@entry=0x1dcea60,
>>             sp=sp@entry=0x1dceac0, isp=0x1dcea78,
>>             transport=transport@entry=0x1dce888,
>>             opaque=opaque@entry=0x1dd4b18, olength=olength@entry=60,
>>                 packetptr=0x1de5060 "0M\002\001", length=79) at
>>             snmp_api.c:5863
>>             #12 0xb6e50a3a in _sess_read
>>             (sessp=sessp@entry=0x1dcea60,
>>             fdset=fdset@entry=0xbeb7b9a0) at snmp_api.c:6124
>>             #13 0xb6e50b14 in snmp_sess_read2
>>             (sessp=sessp@entry=0x1dcea60,
>>             fdset=fdset@entry=0xbeb7b9a0) at snmp_api.c:6397
>>             #14 0xb6e50b44 in snmp_read2 (fdset=0xbeb7b9a0) at
>>             snmp_api.c:5912*
>>
>>             *
>>             #1  0xb6dc21b2 in __libc_signal_restore_set
>>             (set=0xbec483a8) at
>>             ../sysdeps/unix/sysv/linux/nptl-signals.h:79
>>             #2  __GI_raise (sig=sig@entry=6) at
>>             ../sysdeps/unix/sysv/linux/raise.c:48
>>             #3  0xb6dc2e3a in __GI_abort () at abort.c:89
>>             #4  0xb6ded850 in __malloc_assert (assertion=<optimized
>>             out>, file=<optimized out>, line=3068686472,
>>             line@entry=3738, function=0xb6e6ab44 <__func__.15585>
>>             "_int_malloc") at malloc.c:296
>>             #5  0xb6df02c6 in _int_malloc (av=0x2,
>>             av@entry=0xb6e867a4 <main_arena>, bytes=bytes@entry=24)
>>             at malloc.c:3738
>>             #6  0xb6df1556 in __libc_calloc (n=<optimized out>,
>>             elem_size=<optimized out>) at malloc.c:3246
>>             #7  0xb6f1b5d2 in netsnmp_create_delegated_cache
>>             (handler=handler@entry=0xecf440,
>>             reginfo=reginfo@entry=0xecf6f8,
>>             reqinfo=reqinfo@entry=0xed57f8,
>>             requests=requests@entry=0xed6e60,
>>                 localinfo=localinfo@entry=0xeba978) at
>>             agent_handler.c:881
>>             #8  0xb6f232d4 in agentx_master_handler
>>             (handler=0xecf440, reginfo=0xecf6f8, reqinfo=0xed57f8,
>>             requests=0xed6e60) at mibgroup/agentx/master.c:610
>>             #9  0xb6f1b16c in netsnmp_call_handler
>>             (requests=0xed6e60, reqinfo=0xed57f8, reginfo=0xecf6f8,
>>             next_handler=0xecf440) at agent_handler.c:546
>>             #10 netsnmp_call_handlers (reginfo=0xecf6f8,
>>             reqinfo=0xed57f8, requests=0xed6e60) at agent_handler.c:631
>>             #11 0xb6f21bb4 in handle_var_requests
>>             (asp=asp@entry=0xed57a8) at snmp_agent.c:3017
>>             #12 0xb6f22076 in handle_pdu (asp=0xed57a8) at
>>             snmp_agent.c:3803
>>             #13 0xb6f22140 in netsnmp_handle_request
>>             (asp=asp@entry=0xed57a8, status=status@entry=0) at
>>             snmp_agent.c:3692
>>             #14 0xb6f2233e in handle_snmp_packet (session=<optimized
>>             out>, pdu=<optimized out>, magic=<optimized out>,
>>             reqid=<optimized out>, op=<optimized out>) at
>>             snmp_agent.c:2299
>>             #15 0xb6ea53e4 in _sess_process_packet_handle_pdu
>>             (isp=0xeb9aa0, isp=0xeb9aa0, transport=0xeb98b0,
>>             pdu=0xed55c8, sp=0xeb9ae8, sessp=<optimized out>) at
>>             snmp_api.c:5807
>>             #16 _sess_process_packet (sessp=sessp@entry=0xeb9a88,
>>             sp=sp@entry=0xeb9ae8, isp=0xeb9aa0,
>>             transport=transport@entry=0xeb98b0,
>>             opaque=opaque@entry=0xebd170, olength=olength@entry=60,
>>                 packetptr=0xebf0e8 "03\002\001", length=53) at
>>             snmp_api.c:5863
>>             #17 0xb6ea5a3a in _sess_read (sessp=sessp@entry=0xeb9a88,
>>             fdset=fdset@entry=0xbec489a0) at snmp_api.c:6124
>>             #18 0xb6ea5b14 in snmp_sess_read2
>>             (sessp=sessp@entry=0xeb9a88,
>>             fdset=fdset@entry=0xbec489a0) at snmp_api.c:6397
>>             #19 0xb6ea5b44 in snmp_read2 (fdset=0xbec489a0) at
>>             snmp_api.c:5912
>>             #20 0x00012c0c in ?? ()
>>             *
>>             *
>>             #0  __libc_do_syscall () at
>>             ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
>>             #1  0xb6e3d1b2 in __libc_signal_restore_set
>>             (set=0xbecc6320) at
>>             ../sysdeps/unix/sysv/linux/nptl-signals.h:79
>>             #2  __GI_raise (sig=sig@entry=6) at
>>             ../sysdeps/unix/sysv/linux/raise.c:48
>>             #3  0xb6e3de3a in __GI_abort () at abort.c:89
>>             #4  0xb6e647da in __libc_message
>>             (do_abort=do_abort@entry=2, fmt=<optimized out>) at
>>             ../sysdeps/posix/libc_fatal.c:175
>>             #5  0xb6e68b28 in malloc_printerr (action=<optimized
>>             out>, str=0xb6ee4de4 "corrupted double-linked list",
>>             ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5087
>>             #6  0xb6e6b0d4 in _int_malloc (av=av@entry=0xb6f017a4
>>             <main_arena>, bytes=bytes@entry=12) at malloc.c:3743
>>             #7  0xb6e6c556 in __libc_calloc (n=<optimized out>,
>>             elem_size=<optimized out>) at malloc.c:3246
>>             #8  0xb6f9bcb8 in init_agent_snmp_session
>>             (session=0x59cac0, pdu=<optimized out>) at snmp_agent.c:1587
>>             #9  0xb6f9d368 in handle_snmp_packet (session=<optimized
>>             out>, pdu=<optimized out>, magic=0x0, reqid=<optimized
>>             out>, op=<optimized out>) at snmp_agent.c:2227
>>             #10 0xb6f203e4 in _sess_process_packet_handle_pdu
>>             (isp=0x59ca78, isp=0x59ca78, transport=0x59c888,
>>             pdu=0x5bfe88, sp=0x59cac0, sessp=<optimized out>) at
>>             snmp_api.c:5807
>>             #11 _sess_process_packet (sessp=sessp@entry=0x59ca60,
>>             sp=sp@entry=0x59cac0, isp=0x59ca78,
>>             transport=transport@entry=0x59c888,
>>             opaque=opaque@entry=0x5a1118, olength=olength@entry=60,
>>                 packetptr=0x5a20e0 "00\002\001", length=50) at
>>             snmp_api.c:5863
>>             #12 0xb6f20a3a in _sess_read (sessp=sessp@entry=0x59ca60,
>>             fdset=fdset@entry=0xbecc69a0) at snmp_api.c:6124
>>             #13 0xb6f20b14 in snmp_sess_read2
>>             (sessp=sessp@entry=0x59ca60,
>>             fdset=fdset@entry=0xbecc69a0) at snmp_api.c:6397
>>             #14 0xb6f20b44 in snmp_read2 (fdset=0xbecc69a0) at
>>             snmp_api.c:5912
>>             #15 0x00012c0c in ?? ()
>>             Backtrace stopped: previous frame identical to this frame
>>             (corrupt stack?)
>>             *
>>
>>
>>             eth0      Link encap:Ethernet  HWaddr 62:96:0C:F6:A0:28
>>                       inet addr:15.77.45.114  Bcast:15.77.47.255
>>              Mask:255.255.252.0
>>                       inet6 addr:
>>             2620:0:a02:e00d:6096:cff:fef6:a028/64 Scope:Global
>>                       inet6 addr:
>>             2620:0:a02:e00e:7925:979f:3372:607e/128 Scope:Global
>>                       inet6 addr: fe80::6096:cff:fef6:a028/64 Scope:Link
>>                       UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>                       RX packets:108792 errors:0 dropped:0 overruns:0
>>             frame:0
>>                       TX packets:5110 errors:0 dropped:0 overruns:0
>>             carrier:0
>>                       collisions:0 txqueuelen:1000
>>                       RX bytes:121134374 (115.5 MiB)  TX
>>             bytes:5412555 (5.1 MiB)
>>                       Interrupt:42
>>
>>             lo        Link encap:Local Loopback
>>                       inet addr:127.0.0.1  Mask:255.0.0.0
>>                       inet6 addr: ::1/128 Scope:Host
>>                       UP LOOPBACK RUNNING  MTU:65536  Metric:1
>>                       RX packets:2901 errors:0 dropped:0 overruns:0
>>             frame:0
>>                       TX packets:2901 errors:0 dropped:0 overruns:0
>>             carrier:0
>>                       collisions:0 txqueuelen:1
>>                       RX bytes:379572 (370.6 KiB)  TX bytes:379572
>>             (370.6 KiB)
>>
>>             wlan0     Link encap:Ethernet  HWaddr 10:5B:AD:A6:77:A4
>>                       inet addr:192.168.16.30  Bcast:192.168.16.255
>>              Mask:255.255.255.0
>>                       inet6 addr:
>>             b706:6100:88e0:f21e:125b:adff:fea6:77a4/64 Scope:Global
>>                       inet6 addr:
>>             72e1:4617:c9d3:9f78:125b:adff:fea6:77a4/64 Scope:Global
>>                       inet6 addr: fe80::125b:adff:fea6:77a4/64 Scope:Link
>>                       inet6 addr:
>>             3e4:4137:147c:5726:125b:adff:fea6:77a4/64 Scope:Global
>>                       inet6 addr:
>>             b772:c829:5066:e75f:125b:adff:fea6:77a4/64 Scope:Global
>>                       inet6 addr: 1616::69cc:7484:3980:a5af/128
>>             Scope:Global
>>                       inet6 addr:
>>             b102:a15f:713b:c851:125b:adff:fea6:77a4/64 Scope:Global
>>                       UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>                       RX packets:1223 errors:0 dropped:294 overruns:0
>>             frame:0
>>                       TX packets:382 errors:0 dropped:2 overruns:0
>>             carrier:0
>>                       collisions:0 txqueuelen:1000
>>                       RX bytes:219993 (214.8 KiB)  TX bytes:152626
>>             (149.0 KiB)
>>
>>
>>
>>         _______________________________________________
>>         Net-snmp-users mailing list
>>         Net-snmp-users@lists.sourceforge.net 
>> <mailto:Net-snmp-users@lists.sourceforge.net>
>>         Please see the following page to unsubscribe or change other options:
>>         https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to