The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Linux::Netfilter::Log::Packet - A logged packet

DESCRIPTION

This object represents a packet logged using NFLOG, all accessor methods return undef if the field isn't set.

INSTANCE METHODS

hw_type()

Returns the link layer type, such as ARPHRD_ETHER - see linux/if_arp.h.

hw_header()

Returns the link layer header.

hw_protocol()

Returns the link layer protocol number (if applicable), e.g. the EtherType field on Ethernet links.

hw_addr()

Retrieves the hardware address associated with the given packet. For ethernet packets, the hardware address returned (if any) will be the MAC address of the packet source host. The destination MAC address is not known until after POSTROUTING and a successful ARP request, so cannot currently be retrieved.

payload()

Returns the payload of the packet, which may be missing or truncated depending on the mode set using set_mode.

The payload consists of the "Layer 3" (e.g. IP) headers and everything "up" from there (TCP, etc).

netfilter_hook()

Returns the hook number of the hook (e.g. NF_INET_FORWARD) that NFLOG was invoked from.

(See nf_inet_hooks in linux/netfilter.h).

mark()

Returns the 32-bit "mark" set on the packet.

timestamp()

Returns the timestamp of the packet, as a floating point UNIX timestamp.

indev()

Returns the "ifindex" of the interface the packet arrived on.

physindev()

Returns the "ifindex" of the bridge port the packet arrived on, if the packet was received on a bridge.

outdev()

Returns the "ifindex" of the interface the packet is to be transmitted from.

physoutdev()

Returns the "ifindex" of the bridge port the packet is to be transmitted on, if the packet is to be transmitted from a bridge.

prefix()

Returns the "prefix" string specified as an option to the iptables NFLOG target.

uid()

Returns the UID of the local process sending the packet (if applicable).

gid()

Returns the GID of the local process sending the packet (if applicable).

seq()

Returns the "local" sequence number.

The local sequence number is an incrementing counter on THIS NFLOG HANDLE that increases each time a packet is received for a group which has local sequence numbering enabled.

This must be enabled using Group->set_flags().

seq_global()

Returns the "global" sequence number.

The global sequence number is an incrementing counter that increases each time any NFLOG rule is triggered.

This must be enabled using Group->set_flags().

SEE ALSO

Linux::Netfilter::Log, Linux::Netfilter::Log::Group