summaryrefslogtreecommitdiffstats
path: root/lib/agentx.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #15098 from donaldsharp/lib_zebra_h_cleanup_2Donatas Abraitis2024-01-111-0/+1
|\ | | | | Lib zebra h cleanup 2
| * *: zebra.h should not have fcntl.hDonald Sharp2024-01-091-0/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | lib: use snmp's large fd sets for agentxEdwin Brossette2024-01-101-9/+12
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The maximum number of file descriptors in an fd set is limited by FD_SETSIZE. This limitation is important because the libc macros FD_SET(), FD_CLR() and FD_ISSET() will invoke a sigabort if the size of the fd set given to them is above FD_SETSIZE. We ran into such a sigabort with bgpd because snmp can return an fd set of size higher than FD_SETSIZE when calling snmp_select_info(). An unfortunate FD_ISSET() call later causes the following abort: Received signal 6 at 1701115534 (si_addr 0xb94, PC 0x7ff289a16a7c); aborting... /lib/x86_64-linux-gnu/libfrr.so.0(zlog_backtrace_sigsafe+0xb3) [0x7ff289d62bba] /lib/x86_64-linux-gnu/libfrr.so.0(zlog_signal+0x1b4) [0x7ff289d62a1f] /lib/x86_64-linux-gnu/libfrr.so.0(+0x102860) [0x7ff289da4860] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7ff2899c2520] /lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c) [0x7ff289a16a7c] /lib/x86_64-linux-gnu/libc.so.6(raise+0x16) [0x7ff2899c2476] /lib/x86_64-linux-gnu/libc.so.6(abort+0xd3) [0x7ff2899a87f3] /lib/x86_64-linux-gnu/libc.so.6(+0x896f6) [0x7ff289a096f6] /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x2a) [0x7ff289ab676a] /lib/x86_64-linux-gnu/libc.so.6(+0x1350c6) [0x7ff289ab50c6] /lib/x86_64-linux-gnu/libc.so.6(+0x1366ab) [0x7ff289ab66ab] /lib/x86_64-linux-gnu/libfrrsnmp.so.0(+0x36f5) [0x7ff2897736f5] /lib/x86_64-linux-gnu/libfrrsnmp.so.0(+0x3c27) [0x7ff289773c27] /lib/x86_64-linux-gnu/libfrr.so.0(thread_call+0x1c2) [0x7ff289dbe105] /lib/x86_64-linux-gnu/libfrr.so.0(frr_run+0x257) [0x7ff289d56e69] /usr/bin/bgpd(main+0x4f4) [0x560965c40488] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7ff2899a9d90] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7ff2899a9e40] /usr/bin/bgpd(_start+0x25) [0x560965c3e965] in thread agentx_timeout scheduled from /build/make-pkg/output/_packages/cp-routing/src/lib/agentx.c:122 agentx_events_update() Also, the following error is logged by snmp just before the abort: snmp[err]: Use snmp_sess_select_info2() for processing large file descriptors snmp uses a custom struct netsnmp_large_fd_set to work above the limit imposed by FD_SETSIZE. It is noteworthy that, when calling snmp_select_info() instead of snmp_select_info2(), snmp uses the same code working with its custom, large structs, and copy/paste the result to a regular, libc compatible fd_set. So there should be no downside working with snmp_select_info2() instead of snmp_select_info(). Replace every use of the libc file descriptors sets by snmp's extended file descriptors sets in agentx to acommodate for the high number of file descriptors that can come out of snmp. This should prevent the abort seen above. Signed-off-by: Edwin Brossette <edwin.brossette@6wind.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-2/+2
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-7/+7
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-2/+2
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_cancelXXX to event_cancelXXXDonald Sharp2023-03-241-3/+3
| | | | | | Modify the code base so that thread_cancel becomes event_cancel Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-3/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-6/+6
| | | | | | | | | Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: On shutdown, disable snmp from workingDonald Sharp2022-12-151-0/+11
| | | | | | | When shutting down ensure that any daemon operating with snmp tells it to stop operating so no more data is sent. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: Convert agentx_enabled to a boolDonald Sharp2022-12-151-4/+4
| | | | | | FRR is using this as a bool. Let's just use a bool. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: Fix double set of event pointer to NULLDonald Sharp2022-11-031-2/+0
| | | | | | | | The event system when executing a thread already sets the pointer of it to NULL. No need to do it again. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib, vrrpd: Use THREAD_ARGDonald Sharp2022-07-211-2/+2
| | | | | | | Don't auto set the thread->arg pointer. It is private and should be only accessed through the THREAD_ARG pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: thread pointer is already null at this pointDonald Sharp2022-07-191-1/+0
| | | | | | | | in agentx_events_update the timeout_thr is canceled on line 88 just above. This already sets the pointer to NULL. No need to do this again. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-5/+3
| | | | | | | The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: don't pass pointers to a local variables to thread_add_*Igor Ryzhov2021-10-071-8/+12
| | | | | | | | We should never pass pointers to local variables to thread_add_* family. When an event is executed, the library writes into this pointer, which means it writes into some random memory on a stack. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* build: make builddir include path consistentDavid Lamparter2021-04-211-1/+1
| | | | | | | ... by referencing all autogenerated headers relative to the root directory. (90% of the changes here is `version.h`.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+1
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_HOOK & co.David Lamparter2021-03-171-1/+1
| | | | | | See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
* Merge pull request #7945 from volta-networks/feat_isis_snmpRenato Westphal2021-03-151-0/+10
|\ | | | | isisd: add support for read-only snmp mibs objects
| * isisd: support for snmplynne2021-03-021-0/+10
| | | | | | | | | | | | | | Add support for read only mib objects from RFC4444. Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* | Merge pull request #8023 from volta-networks/feat_add_agentx_enabled_hookQuentin Young2021-02-241-0/+13
|\ \ | |/ |/| lib: add agentx_enabled hook
| * lib: add agentx_enabled hookKaren Schoener2021-02-161-0/+13
| | | | | | | | | | | | | | | | | | Adding agentx_enabled hook. This permits the main LDP process to signal the lde and ldpe processes when agentx is enabled. Signed-off-by: Karen Schoener <karen@voltanet.io>
* | lib, bgpd: smux_trap return code is never usedDonald Sharp2021-02-141-8/+8
| | | | | | | | | | | | | | | | The return code from smux_trap is never used. If we have never used it after all this time. Remove the return from the function. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | Merge pull request #7917 from pjdruddy/l3vpn-mpls-snmp-upstream-1Martin Winter2021-02-101-2/+29
|\ \ | |/ |/| L3vpn mpls snmp upstream 1
| * lib: allow traps with differently indexed objectsPat Ruddy2021-02-021-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | The function smux_trap only allows the paaasin of one index which is applied to all indexed objects. However there is a requirement for differently indexed objects within a singe trap. This commit introduces a new function smux_trap_multi_index which can be called with an array of indices. If this array is onf length 1 the original smux_trap behaviour is maintained. smux_trap now calls the new function with and index array length of 1 to avoid changes to existing callers. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | lib/xref: put setup calls in librariesDavid Lamparter2021-02-011-0/+3
|/ | | | | | | | Our "true" libraries (i.e. not modules) don't invoke neither FRR_DAEMON_INFO nor FRR_MODULE_SETUP, hence XREF_SETUP isn't invoked either. Invoke it directly to get things working. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: unify thread/event cancel macrosMark Stapp2020-10-231-1/+1
| | | | | | | | | Replace all lib/thread cancel macros, use thread_cancel() everywhere. Only the THREAD_OFF macro and thread_cancel() api are supported. Also adjust thread_cancel_async() to NULL caller's pointer (if present). Signed-off-by: Mark Stapp <mjs@voltanet.io>
* * : update signature of thread_cancel apiMark Stapp2020-10-231-2/+3
| | | | | | | | Change thread_cancel to take a ** to an event, NULL-check before dereferencing, and NULL the caller's pointer. Update many callers to use the new signature. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: move CLI node names to cmd_node->nameDavid Lamparter2020-04-161-0/+1
| | | | | | | And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
* *: remove second parameter on install_node()David Lamparter2020-04-161-1/+3
| | | | | | | | | | There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
* *: remove cmd_node->vtyshDavid Lamparter2020-04-161-1/+0
| | | | | | | The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: clean up cmd_node initializersDavid Lamparter2020-04-161-3/+5
| | | | | | ... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
* *: Replace `sizeof something` to sizeof(something)Donatas Abraitis2020-03-081-1/+1
| | | | | | Satisfy checkpatch.pl requirements (check for sizeof without parenthesis) Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib: Test return of fcntl in agentx.cDonald Sharp2020-02-041-5/+19
| | | | | | | | | The agentx.c code was calling fcntl but not testing return code and handling it, thus making SA unhappy. Fix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: changes for making snmp socket non-blockingsudhanshukumar222019-10-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: The changes have been done to make the snmp socket non-blocking before calling snmp_read() Problem Description/Summary : vtysh hangs on first try to enter after a reboot with BGP dynamic peers Expected Behavior : VTYSH should not hang. When we debug more into bgpd docker by doing gdb on its threads, we find the below thread of bgpd, which is causing the issue. Thread 1 (Thread 0x7f1e1ec46d40 (LWP 47)): 0x00007f1e1d762593 in recvfrom () from /lib/x86_64-linux-gnu/libpthread.so.0 0x00007f1e1aadd09b in netsnmp_tcpbase_recv () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1aad9617 in netsnmp_transport_recv () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1aab2c07 in _sess_read () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1aab3a29 in snmp_sess_read2 () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1aab3a7b in snmp_read2 () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1aab3acf in snmp_read () from /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30 0x00007f1e1b44d7ec in agentx_read (t=0x7fffa75f0080) at lib/agentx.c:63 0x00007f1e1e7d6451 in thread_call (thread=0x7fffa75f0080) at lib/thread.c:1620 0x00007f1e1e770699 in frr_run (master=0x559396ea60f0) at lib/libfrr.c:1011 0x0000559395b4d953 in main (argc=5, argv=0x7fffa75f02b8) at bgpd/bgp_main.c:492 (gdb) bt 0x00007f830c89d210 in __read_nocancel () from /lib/x86_64-linux-gnu/libpthread.so.0 0x000056450e1e8238 in vtysh_client_run (vclient=0x56450e4a8b40 <vtysh_client+24768>, line=0x56450e21add0 enable, callback=0x0, cbarg=0x0) at vtysh/vtysh.c:216 0x000056450e1e8c6b in vtysh_client_run_all (head_client=0x56450e4a8b40 <vtysh_client+24768>, line=0x56450e21add0 enable, continue_on_err=0, callback=0x0, cbarg=0x0) at vtysh/vtysh.c:356 0x000056450e1e8ddb in vtysh_client_execute (head_client=0x56450e4a8b40 <vtysh_client+24768>, line=0x56450e21add0 enable) at vtysh/vtysh.c:393 0x000056450e1e9c82 in vtysh_execute_func (line=0x56450e21add0 enable, pager=0) at vtysh/vtysh.c:598 0x000056450e1e9dee in vtysh_execute_no_pager (line=0x56450e21add0 enable) at vtysh/vtysh.c:619 0x000056450e1f7d48 in vtysh_read_file (confp=0x56451000a9d0, top_cfg=1) at vtysh/vtysh_config.c:494 0x000056450e1f7ef2 in vtysh_read_config (config_default_dir=0x56450e4edc20 <frr_config> /etc/frr/frr.conf, top_cfg=1) at vtysh/vtysh_config.c:522 0x000056450e1e5de4 in vtysh_apply_top_level_config () at vtysh/vtysh_main.c:301 0x000056450e1e7842 in main (argc=2, argv=0x7ffc81e6f598, env=0x7ffc81e6f5b0) at vtysh/vtysh_main.c:692 The fix has been taken from the following link. https://sourceforge.net/p/net-snmp/patches/1348/ Signed-off-by: Preetham Singh <preetham.singh@broadcom.com>
* lib: remove agentx already enabled warningQuentin Young2018-10-281-2/+1
| | | | | | | | This duplicates itself N times since it's not wrappered in a vtysh command. In lieu of doing that, just remove the message, it's not really necessary. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: style for EC replacementsQuentin Young2018-09-131-8/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-5/+5
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: style for flog_warn conversionsQuentin Young2018-09-061-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Convert to flog_warn in agentx.cDonald Sharp2018-09-061-1/+2
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-4/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Add LIB_ERR_SNMPDonald Sharp2018-08-141-4/+9
| | | | | | | Add code to indicate a SNMP error of some sort that needs to be handled and addressed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-229/+225
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter2017-07-141-1/+1
|\ | | | | | | | | | | Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * vtysh: return non-zero for configuration failuresDaniel Walton2017-07-131-1/+1
| | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows frr-reload.py (or anything else that scripts via vtysh) to know if the vtysh command worked or hit an error.
* | *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-131-3/+3
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: fix more docstringsQuentin Young2017-07-061-4/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>