$20 GRAYBYTE WORDPRESS FILE MANAGER $95

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 91.108.106.107 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python311/lib/python3.11/site-packages/pyroute2/iproute/

HOME
Current File : /opt/alt/python311/lib/python3.11/site-packages/pyroute2/iproute//parsers.py
import struct

from pyroute2.netlink import NLMSG_DONE, nlmsg
from pyroute2.netlink.rtnl.rtmsg import rtmsg


def default_routes(data, offset, length):
    '''
    Only for RTM_NEWROUTE.

    This parser returns:

    * rtmsg() -- only for default routes (no RTA_DST)
    * nlmsg() -- NLMSG_DONE
    * None for any other messages
    '''
    # get message header
    header = dict(
        zip(
            ('length', 'type', 'flags', 'sequence_number'),
            struct.unpack_from('IHHI', data, offset),
        )
    )
    header['error'] = None
    if header['type'] == NLMSG_DONE:
        msg = nlmsg()
        msg['header'] = header
        msg.length = msg['header']['length']
        return msg

    # skip to NLA: offset + nlmsg header + rtmsg data
    cursor = offset + 28

    # iterate NLA, if meet RTA_DST -- return None (not a default route)
    while cursor < offset + length:
        nla_length, nla_type = struct.unpack_from('HH', data, cursor)
        nla_length = (nla_length + 3) & ~3  # align, page size = 4
        cursor += nla_length
        if nla_type == 1:
            return

    # no RTA_DST, a default route -- spend time to decode using the
    # standard routine
    msg = rtmsg(data, offset=offset)
    msg.decode()
    msg['header']['error'] = None  # required
    return msg

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
8 May 2024 6.33 PM
root / root
0755
__pycache__
--
8 May 2024 6.33 PM
root / root
0755
__init__.py
4.805 KB
8 May 2024 6.33 PM
root / root
0644
bsd.py
10.286 KB
8 May 2024 6.33 PM
root / root
0644
ipmock.py
23.076 KB
8 May 2024 6.33 PM
root / root
0644
linux.py
81.359 KB
8 May 2024 6.33 PM
root / root
0644
parsers.py
1.282 KB
8 May 2024 6.33 PM
root / root
0644
windows.py
7.894 KB
8 May 2024 6.33 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF