snmpa_netw...ace_filter(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– snmpa_network_interface_filter β€” the vibe

okay bestie, buckle up, we're looking at snmpa_network_interface_filter(3) from the Erlang Module Definition era of the snmp manual. this is the behaviour module for the SNMP agent network-interface filter πŸŽ€


✨ NAME ✨

snmpa_network_interface_filter β€” it's giving behaviour module for the SNMP agent network-interface filter. no cap, that's literally the whole thing.


🌸 DESCRIPTION 🌸

so this module defines the behaviour of the agent network interface filter. if you wanna be a snmpa_network_interface_filter compliant module, you must export these four functions, periodt:

  • accept_recv/2
  • accept_send/2
  • accept_recv_pdu/3
  • accept_send_pdu/2

the semantics and exact signatures of all of them? explained below, bestie, keep scrolling πŸ’…

the whole point of the network interface filter is to let you filter messages β€” accept or reject β€” on receive and on send. and listen, this happens on two levels, and the way that this is structured is lowkey iconic:

  • Level one: the transport entry / exit point. that means immediately after the receipt of the message, before any message processing is done (accept_recv), and immediately before sending the message, after all message processing is done (accept_send).
  • Level two: the MPD entry / exit point. that's immediately after the basic message processing (accept_recv_pdu) / immediately before the basic message processing (accept_send_pdu).

ngl you should know: the network interface filter is something that's used by the network interface implementation provided by the application (snmpa_net_if). and the default filter accepts all messages β€” she's chill like that πŸ¦‹

you can use a network interface filter for stuff like testing or for load regulation. if load regulation is your intended use, go look at req_limit and the function register_notification_filter too. iykyk 🌟

legacy tea πŸ«–: old-school network interface filter modules used arguments on the form (IpAddr, PortNumber,...) instead of (Domain, Addr, ...). and if the SNMP agent is run without changing the configuration to use transport domains, the network interface filter will still get the old arguments and work as before. she's backwards compatible, we love to see it.

also, see the data types in snmpa_conf. go look, it's right there πŸ’œ


🌈 DATA TYPES 🌈

  • pdu_type() :: snmpa:pdu_type().
transportAddressWithPort() ::
          snmpa_conf:transportAddressWithPort().
transportDomain() :: snmpa_conf:transportDomain().

πŸ‘‘ FUNCTIONS πŸ‘‘


πŸŽ€ CALLBACKS πŸŽ€

  • accept_recv(Domain, Addr) β€” called at the reception of a message (before any processing has been done). for the message to be discarded, the function has to return false. bye bye message πŸ’€
  • accept_recv_pdu(Domain, Addr, PduType) β€” called after the basic message processing (MPD) has been done, but before the pdu is handed over to the master-agent for primary processing. for the pdu to be discarded, the function has to return false. she's a gatekeeper and honestly? valid.
  • accept_send(Domain, Addr) β€” called before the sending of a message (after all processing has been done). for the message to be discarded, the function has to return false.
  • accept_send_pdu(Targets, PduType) β€” called before the basic message processing (MPD) is done, when a pdu has been received from the master-agent. for the message to be discarded all together, the function has to return false.

also β€” and this is the fun part β€” it is possible for this function to filter out targets (but not to add its own) by returning an updated Targets list (NewTargets). she can subtract, she cannot plus. the math is not mathing but that's the rules πŸ’…


and that's the whole page, bestie!! ✨🫢 this absolute banger of a manpage dropped as part of snmp 5.20.5, courtesy of Ericsson AB, and the page itself is snmpa_netw...ace_filter(3). mwah, iconic, no notes πŸ’–πŸ§šπŸŒΈ

πŸ“¦ where this page comes from