ConnmarkTarget

class ConnmarkTarget(*, mark: Optional[int] = None, restore_mark=False)[source]

This class provides access to the CONNMARK target

Parameters:
  • mark – value used to set the ctmark value (associated with a connection)

  • restore_mark – if True, copy the connection mark to the packet mark

and_mark(mask: int) Target

Clear the bits identified by mask

get_mark() Optional[int]

Returns the mark value set by this target

get_mask() Optional[int]

Returns the mask used by this target

get_op() Optional[int]

Returns the operation

Return type:

an integer with one of the following values: SET, XSET, AND, OR, XOR, or None

is_restoring_mark() bool[source]

Returns True if we are restoring the mark

mark_iptables_args(args: List[str]) List[str]

Converts the op/value/mask to a list of iptables(8) arguments for the MARK target

or_mark(mask) Target

Set the bits identified by mask

parse_op(val: str, field_iter) bool

Parse the operation identified by ‘val’

restore_mark() None[source]

Sets the restore mark flag

set_mark(value: int, mask: Optional[int] = None) Target

Set the mark

set_xmark(value: int, mask: Optional[int] = None) Target

Alternative way of setting the mark

to_iptables_args() List[str][source]

Returns a list of iptables(8) arguments

xor_mark(mask) Target

Xor the bits identified by mask