ConnmarkTarget¶
- class ConnmarkTarget(*, mark: Optional[int] = None, restore_mark=False, save_mark=False, nfmask: Optional[int] = None, ctmask: Optional[int] = None)[source]¶
This class provides access to the
CONNMARKtarget- Parameters:
mark – value used to set the ctmark value (associated with a connection)
restore_mark – if
True, copy the connection mark to the packet marksave_mark – if
True, copy the packet mark to the connection marknfmask – applies to the save/restore operation (see iptables(8)); defaults to
0xffffffffif not presentctmask – applies to the save/restore operation (see iptables(8)); defaults to
0xffffffffif not present
- is_restoring_mark() bool[source]¶
Returns
Trueif this target object is set to restore the mark, i.e. copy the connection mark to the packet mark
- is_saving_mark() bool[source]¶
Returns
Trueif this target object is set to save the mark, i.e. copy the packet mark to the connection mark
- restore_mark(*, nfmask: Optional[int] = None, ctmask: Optional[int] = None) None[source]¶
Sets this target object to restore the mark.
- Parameters:
nfmask – defaults to
0xffffffffif not presentctmask – defaults to
0xffffffffif not present
- save_mark(*, nfmask: Optional[int] = None, ctmask: Optional[int] = None) None[source]¶
Sets this target object to save the mark.
- Parameters:
nfmask – defaults to
0xffffffffif not presentctmask – defaults to
0xffffffffif not present
- 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
Trueif this is a terminating target
- set_mark(value: int, mask: Optional[int] = None) Target¶
Perform the operation:
mark = (mark AND NOT(mask)) OR value
If
maskis not present, the operation becomesmark = value.