SNMPA_NETWORK_INTERFACE_FILTER(3erl)

πŸ“¦
version 25.3.2.8 Β· 4 versions
, in ubuntu noble

πŸ¦‹ snmpa_network_interface_filter (3erl) β€” Erlang module definition, group-chat edition πŸ¦‹

🌸 NAME 🌸

snmpa_network_interface_filter β€” Behaviour module for the SNMP agent network-interface filter. πŸ’–

✨ DESCRIPTION ✨

Okay so this module defines the behaviour of the agent network interface filter. A snmpa_network_interface_filter compliant module must export these functions, no cap:

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

The semantics of them and their exact signatures are explained below, bestie. 🫢

The purpose of the network interface filter is to allow for filtering of messages (accept or reject) receive and send. This is done on two levels:

  • The first level is at the transport entry / exit point, i.e. 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).
  • The second level is at the MPD entry / exit point, i.e. immediately after the basic message processing (accept_recv_pdu) / immediately before the basic message processing (accept_send_pdu).

Note that the network interface filter is something which is used by the network interface implementation provided by the application (snmpa_net_if). The default filter accepts all messages. It’s literally a yes-machine by default. πŸ’…

A network interface filter can e.g. be used during testing or for load regulation. If the intended use is load regulation, see also req_limit and the function register_notification_filter. πŸ‘‘

Legacy 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. Nostalgic but functional, we love that. 🫢

πŸŽ€ DATA TYPES πŸŽ€

port() = integer() > 0
pdu_type() = 'get-request' | 'get-next-request' | 'get-response' |
             'set-request' | trap | 'get-bulk-request' | 'inform-request' |
             report

See also the data types in snmpa_conf. ✨

πŸ’… EXPORTS πŸ’…

🫢 accept_recv(Domain, Addr) -> boolean()

Types:

Domain = transportDomain()
Addr = transportAddressWithPort()

Called at the reception of a message (before any processing has been done).

For the message to be discarded, the function must return false. So if you want it gone, say false; if not, let it in. πŸ’–

πŸ¦‹ accept_send(Domain, Addr) -> boolean()

Types:

Domain = transportDomain()
Addr = transportAddressWithPort()

Called before the sending of a message (after all processing has been done).

For the message to be discarded, the function must return false. Same energy: false means bin it. πŸ’€

🌸 accept_recv_pdu(Domain, Addr, PduType) -> boolean()

Types:

Domain = transportDomain()
Addr = transportAddressWithPort()
PduType = pdu_type()

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 must return false. Periodt. πŸ’…

🌈 accept_send_pdu(Targets, PduType) -> Reply

Types:

Targets = targets()
targets() = [target()]
target() = {Domain, Addr}
Domain = transportDomain()
Addr = transportAddressWithPort()
PduType = pdu_type() > 0
Reply = boolean() | NewTargets
NewTargets = targets()

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 must return false.

Note that it is possible for this function to filter out targets (but not to add its own) by returning an updated Targets list (NewTargets). So you can trim the list, but you cannot sneak new targets in β€” the audacity would be unmatched. πŸ™ˆ


Footer cuties: Ericsson AB, snmp 5.13.5, and the snmpa_net...ce_filter(3erl) page tag/date. That’s the source/version/page-date situation, bestie β€” mwah! πŸ’‹

πŸ“¦ where this page comes from