MarkTarget

class MarkTarget(mark: Optional[int] = None)[source]

This class provides access to the MARK target

Parameters:

mark – value used to set the mark value in the packet

to_iptables_args() List[str][source]

Returns a list of iptables(8) arguments

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

get_target_name() str

Returns the target name

is_terminating() bool

Returns True if this is a terminating target

or_mark(mask: int) Target

Set the bits identified by mask

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

Perform the operation:

mark = (mark AND NOT(mask)) OR value

If mask is not present, the operation becomes mark = value.

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

Perform the operation:

mark = (mark AND NOT(mask)) XOR value

If mask is not present, the operation becomes mark = value.

xor_mark(mask: int) Target

Xor the bits identified by mask