snmpa_netw...ace_filter(3)
π 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/2accept_send/2accept_recv_pdu/3accept_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 returnfalse. 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 returnfalse. 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 returnfalse.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 returnfalse.
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
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms