HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/pyroute2/ext/__pycache__/rawsocket.cpython-311.pyc
�

�;f
����ddlZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZm
Z
mZmZmZm
Z
ddlmZdZdZdZgd�gZGd	�d
e��ZGd�de��Zd
�ZGd�de
��ZdS)�N)�	Structure�	addressof�c_ubyte�c_uint�c_ushort�c_void_p�sizeof�	string_at)�	AF_PACKET�SOCK_RAW�
SOL_SOCKET�errno�error�htons�socket)�IPRoute���)�rrrc�*�eZdZdefdefdefdefgZdS)�sock_filter�code�jt�jf�kN)�__name__�
__module__�__qualname__rrr�_fields_���I/opt/alt/python311/lib/python3.11/site-packages/pyroute2/ext/rawsocket.pyrrs2������	���	
�w��	
�w��	�f�
�	�H�H�Hr"rc��eZdZdefdefgZdS)�
sock_fprog�len�filterN)rrrrrr r!r"r#r%r%!s"��������!�H�h�#7�8�H�H�Hr"r%c��tt|��z}|d�|D���}tt|��t|d����}t	t|��t|����|fS)Nc� �g|]}t|���Sr!)r)�.0�lines  r#�
<listcomp>zcompile_bpf.<locals>.<listcomp>'s��@�@�@�4�K��.�@�@�@r"r)rr&r%rr
r	)r�ProgramType�program�sfps    r#�compile_bpfr0%so����D�	�	�)�K��k�@�@�4�@�@�@�A�G�
�S��Y�Y�	�'�!�*� 5� 5�
6�
6�C��Y�s�^�^�V�C�[�[�1�1�7�:�:r"c�,�eZdZdZdZdd�Zdd�Zd�ZdS)	�	RawSocketa�
    This raw socket binds to an interface and optionally installs a BPF
    filter.
    When created, the socket's buffer is cleared to remove packets that
    arrived before bind() or the BPF filter is installed.  Doing so
    requires calling recvfrom() which may raise an exception if the
    interface is down.
    In order to allow creating the socket when the interface is
    down, the ENETDOWN exception is caught and discarded.
    Nc��||_t��5}|���D]}|�d��|krn�t	dd���	ddd��n#1swxYwY|�d��|_|d|_tj|tttt����tj
||jtf��|rN|���t|��\}|_tj|t$t&|��dS|�d���dS)N�IFLA_IFNAME�zLink not found�IFLA_ADDRESS�indexT)�remove_total_filter)�ifnamer�	get_links�get_attr�IOError�l2addr�ifindexr�__init__rrr�	ETH_P_ALL�bind�clear_bufferr0�fprog�
setsockoptr
�SO_ATTACH_FILTER)�selfr9�bpf�ip�link�fstrings      r#r?zRawSocket.__init__:su�����
�Y�Y�	3�"������
3�
3���=�=��/�/�6�9�9��E�:��a�!1�2�2�2��	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3��m�m�N�3�3����G�}������i��5��3C�3C�D�D�D���D�4�;�	�2�3�3�3��	8�������"-�c�"2�"2��G�T�Z���d�J�0@�'�J�J�J�J�J����$��7�7�7�7�7s�AA&�&A*�-A*Fc��tt��\}}tj|tt
|��|�d��		|�d��n^#t$rQ}|j	dtjkrn+|j	dtjtj
fvrYd}~n�Yd}~nd}~wwxYw�v|�d��|r#tj|tt|��dSdS)NrT�)r0�total_filterrrDr
rE�setblocking�recvfromr�argsr�ENETDOWN�EAGAIN�EWOULDBLOCK�SO_DETACH_FILTER)rFr8�
total_fstring�prog�es     r#rBzRawSocket.clear_bufferOs$��*�,�7�7��
�t���$�
�,<�m�L�L�L��������	�

��
�
�a� � � � ���
�
�
��6�!�9���.�.���V�A�Y�5�<��1B�"C�C�C��E�E�E�E��	�D�D�D�D�����	
����	�	
��������	����j�"2�M�
�
�
�
�
�	�	s�A&�&
C�0AB<�6B<�<Cc����t���dzr�dz
�t�fd�tt���dz��D����}|dz	|dzz}||dz	z
}|dzS)Nr5�c	�h��g|].}tjd�|dz|dzdz���d��/S)z>Hr5r)�struct�unpack)r*�x�datas  �r#r,z"RawSocket.csum.<locals>.<listcomp>qsP���
�
�
���
�d�D��Q���Q����):�$;�<�<�Q�?�
�
�
r"�i��)r&�sum�range)rFr^�csums ` r#rbzRawSocket.csumms�����t�9�9�q�=�	��G�O�D��
�
�
�
��s�4�y�y�A�~�.�.�
�
�
�
�
����
�t�f�}�-�����
����u�v�~�r")N)F)rrr�__doc__rCr?rBrbr!r"r#r2r2,s\������	�	�
�E�8�8�8�8�*����<����r"r2)r[�ctypesrrrrrrr	r
rrrr
rrr�pyroute2.iproute.linuxrr@rErTrMrr%r0r2r!r"r#�<module>rfs}��
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�P�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�*�*�*�*�*�*�
�	����� ��� �������)����9�9�9�9�9��9�9�9�;�;�;�L�L�L�L�L��L�L�L�L�Lr"