PacketTypeMatch¶
Example:
>>> from linuxnet.iptables import PacketTypeMatch
>>> m = PacketTypeMatch()
>>> m.packet_type().equals('broadcast')
<linuxnet.iptables.matches.packettypematch.PacketTypeMatch object at 0x7f1bee6ae240>
>>> m.to_iptables_args()
['-m', 'pkttype', '--pkt-type', 'broadcast']
>>> print(m.packet_type().get_value())
broadcast
- class PacketTypeMatch[source]¶
Match against the packet type
- packet_type() PacketTypeCriterion[source]¶
Compare with the packet type
PacketTypeCriterion¶
- class PacketTypeCriterion(match: Match)[source]¶
Compare with the packet type
The comparison value is a string.
- any() Match¶
Match any value.
This method is used when creating a
Criterionin order to search an existing chain for rules that try to match against certain packet properties (e.g. input interface) without being particular about the specific property value (e.g.eth0).
- compare(is_equal: bool, *args, **kwargs) Match¶
Alternative method used for comparisons. It invokes
equals()(ornot_equals()) withargsandkwargsifis_equalisTrue(orFalse).
- get_iptables_option() str¶
Returns the iptables(8) option
- get_value() Any¶
Returns the criterion value
- is_positive() bool¶
Returns the ‘polarity’ of the criterion:
Trueforequals()orFalsefornot_equals()Raises
IptablesErrorif the criterion is not set
- is_set() bool¶
Returns
Trueif the criterion has been set