summaryrefslogtreecommitdiffstats
path: root/lib/smux.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert event.h to frrevent.hDonald Sharp2023-03-241-1/+1
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-1/+1
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-1/+1
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-241-1/+1
| | | | | | | | | | | This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. 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/+3
| | | | | | | 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-1/+1
| | | | | | FRR is using this as a bool. Let's just use a bool. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry)Donatas Abraitis2022-11-141-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://www.circitor.fr/Mibs/Mib/B/BGP4V2-MIB.mib Compared with Arista BGP4V2-MIB implementation, almost identical (despite that Arista has slightly some additional MIBs). Example: ``` iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 01 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 02 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 179 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.64 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.65 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.64 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.65 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 54814 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.64 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.65 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = STRING: "dddd" iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.64 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.65 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.64 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.65 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.64 = Hex-STRING: 4F 4B 00 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.65 = Hex-STRING: 4F 4B 32 00 iso.3.6.1.3.5.1.1.2.1.14.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 69 70 76 36 00 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* lib, bgpd: add a specific oid_copy function for IPv6 addrsPat Ruddy2021-03-251-1/+2
| | | | | | | Do not overload the v4 oid_copy_addr function for ipv6 coverity does not like this kind of thing. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* *: 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/+4
|\ | | | | isisd: add support for read-only snmp mibs objects
| * isisd: support for snmplynne2021-03-021-0/+4
| | | | | | | | | | | | | | 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/+4
|\ \ | | | | | | lib: add agentx_enabled hook
| * | lib: add agentx_enabled hookKaren Schoener2021-02-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | bgpd, lib: add oid2in6_addr utility and use itPat Ruddy2021-02-171-0/+1
| |/ |/| | | | | | | | | | | | | The existing code was using the oid2in_addr API to copy IPv6 addresses passing an IPv6 length. Create a utility to do this properly and avoid annoying coverity with type checking. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | lib, bgpd: smux_trap return code is never usedDonald Sharp2021-02-141-3/+3
| | | | | | | | | | | | | | | | 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>
* | lib: allow traps with differently indexed objectsPat Ruddy2021-02-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | bgpd: add SNMP support for mplsL3VpnRte TablePat Ruddy2021-02-021-0/+5
| | | | | | | | | | | | Add MIB support for the route table in RFC4382 Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | lib: add SNMP_OCTET macroPat Ruddy2021-02-021-1/+5
| | | | | | | | | | | | Add SNMP macro to allow a singe octet to be returned Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | lib: add IANA defines and IPv6 macroPat Ruddy2021-02-021-0/+20
| | | | | | | | | | | | | | Add defines for IANA SNMP routing protocol values Add macro for returning an IPv6 address to the SNMP agent. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | lib: add utilities to encode/decode an int in SNMP oidPat Ruddy2021-02-021-0/+2
| | | | | | | | | | | | | | Add 2 functions to encode/decode intergers to/from SNMP OIDs. Make sure oid is in network format. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | bgpd, lib: add mplsL3VpnVrf tablePat Ruddy2021-02-021-0/+2
|/ | | | | | | Add SNMP support for L3vpn Vrf table as defined in [RFC4382] Keep track of vrf status for the table and for future traps. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* lib: make oid_copy_addr respect my constnessDonald Sharp2020-03-261-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add extern "C" {} blocks to all libfrr headersRenato Westphal2019-02-121-0/+8
| | | | | | | These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: 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-45/+36
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add missing includesDavid Lamparter2016-06-071-0/+2
| | | | | | | | Some places, particularly headers, were spewing warnings since they don't include neccessary other headers to get struct/enum definitions. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 388f8857eb81ef75014060976776523a58a99389)
* snmp: fix warningsDavid Lamparter2016-05-261-3/+3
| | | | | | | batch-fix all warnings that come up when enabling AgentX SNMP support. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit dfee58f1d41a2e36c7f5f38a3ef5712224131824)
* snmp: let handlers accept OID from a lesser prefixVincent Bernat2012-06-251-0/+2
| | | | | | | | | Most table handlers do not expect to be given an OID whose prefix is outside what they can handle. This is not a problem with the SMUX implementation since it always correct the OID such that the prefix matches. However, this is not the case for the AgentX implementation. A new function, smux_header_table() is used to do this normalization.
* agentx: handle SNMP trapsVincent Bernat2012-06-251-3/+28
| | | | | | | | | | | | | | | | smux_trap() signature has been changed to provide appropriate level information to send SNMPv2 notifications. This includes the addition of the enterprise OID to use (from which is derived the SNMP trap OID) and the MIB registry to locate the appropriate function for variable bindings provided by the trap. The SMUX implementation has been updated but ignore the provided enterprise OID. Instead, it still uses the SMUX peer OID to keep compatibility with previous versions of Quagga. The SMUX implementation also ignores the provided MIB registry since it uses smux_get() function to grab the appropriate values. This is not possible with the AgentX implementation since there is no such function provided by NetSNMP.
* smux: drop findVar element from trap object structVincent Bernat2012-06-251-2/+1
| | | | This element was not unused.
* smux: remove `tick` argument from smux_trap()Vincent Bernat2012-06-251-1/+1
| | | | | | | | | smux_trap() contains an argument whose use appears to be to set sysUpTime.0/timestamp field in SNMP trap. However, this value is not used in smux_trap(). Moreover, it is expected that this field is the value of sysUpTime.0 when the trap was sent and not any other time related to the trap. To avoid any confusion, we remove this field from the signature of the function.
* smux: isolate SMUX implementation from SNMP implementationVincent Bernat2012-06-251-77/+4
| | | | | | | | lib/snmp.c gets OID related helper functions that can be used with another SNMP interface. smux.h is cleaned of SMUX specific bits to only expose functions that may be used by an alternative implementation. We also do not redefine functions already present in NetSNMP. Just use the appropriate headers.
* [cleanup] Use const in smux interfaceStephen Hemminger2009-06-181-2/+3
| | | | smux_trap and oid_copy should allow read-only source.
* [smux] 64-bit fix for lib/smux.h SNMP_INTEGER() macroChris Caputo2009-06-021-2/+2
| | | | | | | | | | | | | | | | | | Macro SNMP_INTEGER() prepares data which is eventually processed by asn_build_int(). SNMP_INTEGER() was using "int32_t" whereas asn_build_int() uses "long". On 32-bit systems these are the same, both 4 bytes, but on x86 64-bit systems "long" is 8 bytes. asn_build_int()'s reaction to an improperly sized value is to return a NULL pointer. Quagga's smux.c would eventually get this NULL pointer and use it in calculations to determine how much data to send over the smux connection, resulting in garbage being sent to the SNMP agent. Corrected SNMP_INTEGER() to use "long". Tested on 32-bit and 64-bit x86 Linux 2.6.27.10 systems running Quagga 0.99.11 with bgpd smux.
* 2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>vincent2005-09-291-2/+2
| | | | | | | | * lib/smux.[ch]: allow to retreive global OID (identified by <0 namelen). * ospf_ism.c: generate SNMP traps on Interface state change * ospf_nsm.c: generate SNMP traps on Neighbour state change * ospf_snmp.[ch]: support for SNMP traps for interface and neighbours.
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | * (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
* Make initializing smux connection configurable - "smux peer OID" commandhasso2004-10-131-1/+1
| | | | | initializes connection, and "no smux peer" command terminates it. Fixes bugzilla #47 and #112.
* 2004-10-11 Paul Jakma <paul@dishone.st>paul2004-10-111-1/+1
| | | | | | * if.h: mtu's should be unsigned. * routemap.{c,h}: const char updates * smux.{c,h}: ditto
* 2003-06-19 Paul Jakma <paul@dishone.st>paul2003-06-191-2/+2
| | | | | * Fix lib/smux.c's reliance on daemons exporting struct thread_master *master.
* Initial revisionpaul2002-12-131-0/+159