File: //opt/alt/python311/lib/python3.11/site-packages/pyroute2/__pycache__/ipset.cpython-311.pyc
�
�;fD^ � � � d Z ddlZddlZddlmZ ddlmZmZmZm Z m
Z
mZ ddlm
Z
mZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z: d � Z; G d
� de<� � Z= G d� d
e<� � Z> G d� de:� � Z? G d� de
� � Z@dS )a.
ipset support.
This module is tested with hash:ip, hash:net, list:set and several
other ipset structures (like hash:net,iface). There is no guarantee
that this module is working with all available ipset modules.
It supports almost all kernel commands (create, destroy, flush,
rename, swap, test...)
� N)�
basestring)�NETLINK_NETFILTER� NLM_F_ACK�
NLM_F_DUMP�
NLM_F_EXCL�
NLM_F_REQUEST�NLMSG_ERROR)�
IPSetError�NetlinkError��NFNL_SUBSYS_IPSET)'�
IPSET_CMD_ADD�IPSET_CMD_CREATE�
IPSET_CMD_DEL�IPSET_CMD_DESTROY�IPSET_CMD_FLUSH�IPSET_CMD_GET_BYINDEX�IPSET_CMD_GET_BYNAME�IPSET_CMD_HEADER�IPSET_CMD_LIST�IPSET_CMD_PROTOCOL�IPSET_CMD_RENAME�IPSET_CMD_SWAP�IPSET_CMD_TEST�IPSET_CMD_TYPE�IPSET_ERR_BUSY�IPSET_ERR_COMMENT�IPSET_ERR_COUNTER�IPSET_ERR_EXIST�IPSET_ERR_EXIST_SETNAME2�IPSET_ERR_FIND_TYPE�IPSET_ERR_INVALID_CIDR�IPSET_ERR_INVALID_FAMILY�IPSET_ERR_INVALID_MARKMASK�IPSET_ERR_INVALID_NETMASK�IPSET_ERR_IPADDR_IPV4�IPSET_ERR_IPADDR_IPV6�IPSET_ERR_MAX_SETS�IPSET_ERR_PROTOCOL�IPSET_ERR_REFERENCED�IPSET_ERR_SKBINFO�IPSET_ERR_TIMEOUT�IPSET_ERR_TYPE_MISMATCH�IPSET_FLAG_IFACE_WILDCARD�IPSET_FLAG_PHYSDEV�IPSET_FLAG_WITH_COMMENT�IPSET_FLAG_WITH_COUNTERS�IPSET_FLAG_WITH_FORCEADD�IPSET_FLAG_WITH_SKBINFO� ipset_msg)�
NetlinkSocketc �0 � | d d t k S )N�header�type)r )�msgs �A/opt/alt/python311/lib/python3.11/site-packages/pyroute2/ipset.py�_nlmsg_errorr; F s � ��x�=�� �K�/�/� c � � e Zd ZdZdd�ZdS )� PortRangeaF A simple container for port range with optional protocol
Note that optional protocol parameter is not supported by all
kernel ipset modules using ports. On the other hand, it's sometimes
mandatory to set it (like for hash:net,port ipsets)
Example::
udp_proto = socket.getprotobyname("udp")
port_range = PortRange(1000, 2000, protocol=udp_proto)
ipset.create("foo", stype="hash:net,port")
ipset.add("foo", ("192.0.2.0/24", port_range), etype="net,port")
ipset.test("foo", ("192.0.2.0/24", port_range), etype="net,port")
Nc �0 � || _ || _ || _ d S �N)�begin�end�protocol)�selfrA rB rC s r: �__init__zPortRange.__init__Z s � ���
���� ��
�
�
r<