Module skb

Linux socket buffer interface.

Class skb

skb:__len ()
skb:checksum () Recomputes IP and transport-layer (TCP/UDP) checksums.
skb:connmark ([value]) Gets or sets the conntrack mark: with no argument reads it, with value sets it.
skb:copy () Returns an independent copy of the skb with its own data buffer.
skb:data ([layer])
skb:forward () Forwards the skb out through its ingress device.
skb:ifindex ()
skb:mark ([value]) Gets or sets the packet mark: with no argument reads it, with value sets it.
skb:priority ([value]) Gets or sets the packet priority: with no argument reads it, with value sets it.
skb:resize (n) Expands (skbput) or shrinks (skbtrim) the skb data area.
skb:vlan ()


Class skb

Represents a socket buffer (sk_buff). This is a userdata object handed to the hooks that receive packets; it is SINGLE, so it cannot be shared with another runtime.
skb:__len ()

Returns:

    integer skb length in bytes
skb:checksum ()
Recomputes IP and transport-layer (TCP/UDP) checksums.
skb:connmark ([value])
Gets or sets the conntrack mark: with no argument reads it, with value sets it. Returns the current (or new) mark, or nil if no conntrack is associated.

Parameters:

  • value integer 32-bit mark to set (optional)

Returns:

    integer 32-bit connmark, or nil if no conntrack is associated
skb:copy ()
Returns an independent copy of the skb with its own data buffer. The skb is linearized before copying to avoid failures on fragmented skbs (e.g. bridged traffic with paged data).

Returns:

    skb

Raises:

if skb is FRAGLIST GSO, linearization fails, or copy allocation fails
skb:data ([layer])

Parameters:

  • layer string "net" (default, L3) or "mac" (L2, includes MAC header) (optional)

Returns:

    data

Raises:

if linearization fails, MAC header is not set, or layer is invalid
skb:forward ()
Forwards the skb out through its ingress device.

Raises:

if skb has no device, MAC header is not set, or clone fails
skb:ifindex ()

Returns:

    integer network interface index, or nil if not available
skb:mark ([value])
Gets or sets the packet mark: with no argument reads it, with value sets it.

Parameters:

  • value integer the new packet mark (optional)

Returns:

    integer the packet mark
skb:priority ([value])
Gets or sets the packet priority: with no argument reads it, with value sets it.

Parameters:

  • value integer the new packet priority (optional)

Returns:

    integer the packet priority
skb:resize (n)
Expands (skbput) or shrinks (skbtrim) the skb data area.

Parameters:

  • n integer desired size in bytes

Raises:

if insufficient tailroom for expansion
skb:vlan ()

Returns:

    integer VLAN tag ID, or nil if not present
generated by LDoc 1.5.0 Last updated 2026-09-05 12:27:44