Beispiel #1
0
DEVLINK_CMD_FLASH_UPDATE_STATUS = 60
DEVLINK_CMD_TRAP_GET = 61
DEVLINK_CMD_TRAP_SET = 62
DEVLINK_CMD_TRAP_NEW = 63
DEVLINK_CMD_TRAP_DEL = 64
DEVLINK_CMD_TRAP_GROUP_GET = 65
DEVLINK_CMD_TRAP_GROUP_SET = 66
DEVLINK_CMD_TRAP_GROUP_NEW = 67
DEVLINK_CMD_TRAP_GROUP_DEL = 68
DEVLINK_CMD_TRAP_POLICER_GET = 69
DEVLINK_CMD_TRAP_POLICER_SET = 70
DEVLINK_CMD_TRAP_POLICER_NEW = 71
DEVLINK_CMD_TRAP_POLICER_DEL = 72
DEVLINK_CMD_MAX = DEVLINK_CMD_TRAP_POLICER_DEL

(DEVLINK_NAMES, DEVLINK_VALUES) = map_namespace('DEVLINK_CMD_', globals())

# port type
DEVLINK_PORT_TYPE_NOTSET = 0
DEVLINK_PORT_TYPE_AUTO = 1
DEVLINK_PORT_TYPE_ETH = 2
DEVLINK_PORT_TYPE_IB = 3

# threshold type
DEVLINK_SB_POOL_TYPE_INGRESS = 0
DEVLINK_SB_POOL_TYPE_EGRESS = 1

DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 20


class devlinkcmd(genlmsg):
Beispiel #2
0
IFA_F_SECONDARY = 0x01
# IFA_F_TEMPORARY IFA_F_SECONDARY
IFA_F_NODAD = 0x02
IFA_F_OPTIMISTIC = 0x04
IFA_F_DADFAILED = 0x08
IFA_F_HOMEADDRESS = 0x10
IFA_F_DEPRECATED = 0x20
IFA_F_TENTATIVE = 0x40
IFA_F_PERMANENT = 0x80
IFA_F_MANAGETEMPADDR = 0x100
IFA_F_NOPREFIXROUTE = 0x200
IFA_F_MCAUTOJOIN = 0x400
IFA_F_STABLE_PRIVACY = 0x800

(IFA_F_NAMES, IFA_F_VALUES) = map_namespace('IFA_F', globals())
# 8<----------------------------------------------
IFA_F_TEMPORARY = IFA_F_SECONDARY
IFA_F_NAMES['IFA_F_TEMPORARY'] = IFA_F_TEMPORARY
IFA_F_VALUES6 = IFA_F_VALUES
IFA_F_VALUES6[IFA_F_TEMPORARY] = 'IFA_F_TEMPORARY'
# 8<----------------------------------------------


class ifaddrmsg(nlmsg):
    '''
    IP address information

    C structure::

        struct ifaddrmsg {
Beispiel #3
0
NTF_ROUTER = 0x80

# neighbor cache entry states
NUD_INCOMPLETE = 0x01
NUD_REACHABLE = 0x02
NUD_STALE = 0x04
NUD_DELAY = 0x08
NUD_PROBE = 0x10
NUD_FAILED = 0x20

# dummy states
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x00

(NTF_NAMES, NTF_VALUES) = map_namespace('NTF_', globals())
(NUD_NAMES, NUD_VALUES) = map_namespace('NUD_', globals())
flags = dict([(x[0][4:].lower(), x[1]) for x in NTF_NAMES.items()])
states = dict([(x[0][4:].lower(), x[1]) for x in NUD_NAMES.items()])


def states_a2n(s):
    # parse state string
    ss = s.split(',')
    ret = 0
    for state in ss:
        state = state.upper()
        if not state.startswith('NUD_'):
            state = 'NUD_' + state
        ret |= NUD_NAMES[state]
    return ret
Beispiel #4
0
from pr2modules.common import map_namespace
from pr2modules.netlink import nlmsg
from pr2modules.netlink import nla

FR_ACT_UNSPEC = 0
FR_ACT_TO_TBL = 1
FR_ACT_GOTO = 2
FR_ACT_NOP = 3
FR_ACT_BLACKHOLE = 6
FR_ACT_UNREACHABLE = 7
FR_ACT_PROHIBIT = 8
(FR_ACT_NAMES, FR_ACT_VALUES) = map_namespace('FR_ACT', globals())


class fibmsg(nlmsg):
    '''
    IP rule message

    C structure::

        struct fib_rule_hdr {
            __u8        family;
            __u8        dst_len;
            __u8        src_len;
            __u8        tos;
            __u8        table;
            __u8        res1;   /* reserved */
            __u8        res2;   /* reserved */
            __u8        action;
            __u32       flags;
        };
Beispiel #5
0
NL80211_CMD_GET_COALESCE = 100
NL80211_CMD_SET_COALESCE = 101
NL80211_CMD_CHANNEL_SWITCH = 102
NL80211_CMD_VENDOR = 103
NL80211_CMD_SET_QOS_MAP = 104
NL80211_CMD_ADD_TX_TS = 105
NL80211_CMD_DEL_TX_TS = 106
NL80211_CMD_GET_MPP = 107
NL80211_CMD_JOIN_OCB = 108
NL80211_CMD_LEAVE_OCB = 109
NL80211_CMD_CH_SWITCH_STARTED_NOTIFY = 110
NL80211_CMD_TDLS_CHANNEL_SWITCH = 111
NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH = 112
NL80211_CMD_WIPHY_REG_CHANGE = 113
NL80211_CMD_MAX = NL80211_CMD_WIPHY_REG_CHANGE
(NL80211_NAMES, NL80211_VALUES) = map_namespace('NL80211_CMD_', globals())

NL80211_BSS_ELEMENTS_SSID = 0
NL80211_BSS_ELEMENTS_SUPPORTED_RATES = 1
NL80211_BSS_ELEMENTS_CHANNEL = 3
NL80211_BSS_ELEMENTS_TIM = 5
NL80211_BSS_ELEMENTS_RSN = 48
NL80211_BSS_ELEMENTS_EXTENDED_RATE = 50
NL80211_BSS_ELEMENTS_VENDOR = 221

BSS_MEMBERSHIP_SELECTOR_HT_PHY = 127
BSS_MEMBERSHIP_SELECTOR_VHT_PHY = 126

# interface types
NL80211_IFTYPE_UNSPECIFIED = 0
NL80211_IFTYPE_ADHOC = 1
Beispiel #6
0
RTM_DELMDB = 85
RTM_GETMDB = 86
RTM_NEWNSID = 88
RTM_DELNSID = 89
RTM_GETNSID = 90
RTM_NEWSTATS = 92
RTM_GETSTATS = 94
RTM_NEWCACHEREPORT = 96
RTM_NEWLINKPROP = 108
RTM_DELLINKPROP = 109
RTM_GETLINKPROP = 110
# fake internal message types
RTM_NEWNETNS = 500
RTM_DELNETNS = 501
RTM_GETNETNS = 502
(RTM_NAMES, RTM_VALUES) = map_namespace('RTM_', globals())

TC_H_INGRESS = 0xFFFFFFF1
TC_H_CLSACT = TC_H_INGRESS
TC_H_ROOT = 0xFFFFFFFF

RTMGRP_DEFAULTS = (RTMGRP_IPV4_IFADDR
                   | RTMGRP_IPV6_IFADDR
                   | RTMGRP_IPV4_ROUTE
                   | RTMGRP_IPV6_ROUTE
                   | RTMGRP_IPV4_RULE
                   | RTMGRP_IPV6_RULE
                   | RTMGRP_NEIGH
                   | RTMGRP_LINK
                   | RTMGRP_TC
                   | RTMGRP_MPLS_ROUTE)
Beispiel #7
0
from socket import AF_UNSPEC
from socket import AF_INET
from socket import AF_INET6
from pr2modules.common import AF_MPLS
from pr2modules.common import hexdump
from pr2modules.common import map_namespace
from pr2modules.netlink import nlmsg
from pr2modules.netlink import nla
from pr2modules.netlink import nla_string

RTNH_F_DEAD = 1
RTNH_F_PERVASIVE = 2
RTNH_F_ONLINK = 4
RTNH_F_OFFLOAD = 8
RTNH_F_LINKDOWN = 16
(RTNH_F_NAMES, RTNH_F_VALUES) = map_namespace('RTNH_F', globals())

LWTUNNEL_ENCAP_NONE = 0
LWTUNNEL_ENCAP_MPLS = 1
LWTUNNEL_ENCAP_IP = 2
LWTUNNEL_ENCAP_ILA = 3
LWTUNNEL_ENCAP_IP6 = 4
LWTUNNEL_ENCAP_SEG6 = 5
LWTUNNEL_ENCAP_BPF = 6
LWTUNNEL_ENCAP_SEG6_LOCAL = 7


class nlflags(object):
    def encode(self):
        if isinstance(self['flags'], (set, tuple, list)):
            self['flags'] = self.names2flags(self['flags'])
Beispiel #8
0
IFF_NOTRAILERS = 0x20  # avoid use of trailers
IFF_RUNNING = 0x40  # interface RFC2863 OPER_UP
IFF_NOARP = 0x80  # no ARP protocol
IFF_PROMISC = 0x100  # receive all packets
IFF_ALLMULTI = 0x200  # receive all multicast packets
IFF_MASTER = 0x400  # master of a load balancer
IFF_SLAVE = 0x800  # slave of a load balancer
IFF_MULTICAST = 0x1000  # Supports multicast
IFF_PORTSEL = 0x2000  # can set media type
IFF_AUTOMEDIA = 0x4000  # auto media select active
IFF_DYNAMIC = 0x8000  # dialup device with changing addresses
IFF_LOWER_UP = 0x10000  # driver signals L1 up
IFF_DORMANT = 0x20000  # driver signals dormant
IFF_ECHO = 0x40000  # echo sent packets

(IFF_NAMES, IFF_VALUES) = map_namespace('IFF', globals())

IFF_MASK = (IFF_UP
            | IFF_DEBUG
            | IFF_NOTRAILERS
            | IFF_NOARP
            | IFF_PROMISC
            | IFF_ALLMULTI)

IFF_VOLATILE = (IFF_LOOPBACK
                | IFF_POINTOPOINT
                | IFF_BROADCAST
                | IFF_ECHO
                | IFF_MASTER
                | IFF_SLAVE
                | IFF_RUNNING
Beispiel #9
0
ARPHRD_FRAD = 770  # Frame Relay Access Device
ARPHRD_SKIP = 771  # SKIP vif
ARPHRD_LOOPBACK = 772  # Loopback device
ARPHRD_LOCALTLK = 773  # Localtalk device
ARPHRD_FDDI = 774  # Fiber Distributed Data Interface
ARPHRD_BIF = 775  # AP1000 BIF
ARPHRD_SIT = 776  # sit0 device - IPv6-in-IPv4
ARPHRD_IPDDP = 777  # IP over DDP tunneller
ARPHRD_IPGRE = 778  # GRE over IP
ARPHRD_PIMREG = 779  # PIMSM register interface
ARPHRD_HIPPI = 780  # High Performance Parallel Interface
ARPHRD_ASH = 781  # Nexus 64Mbps Ash
ARPHRD_ECONET = 782  # Acorn Econet
ARPHRD_IRDA = 783  # Linux-IrDA
# ARP works differently on different FC media .. so
ARPHRD_FCPP = 784  # Point to point fibrechannel
ARPHRD_FCAL = 785  # Fibrechannel arbitrated loop
ARPHRD_FCPL = 786  # Fibrechannel public loop
ARPHRD_FCFABRIC = 787  # Fibrechannel fabric
# 787->799 reserved for fibrechannel media types
ARPHRD_IEEE802_TR = 800  # Magic type ident for TR
ARPHRD_IEEE80211 = 801  # IEEE 802.11
ARPHRD_IEEE80211_PRISM = 802  # IEEE 802.11 + Prism2 header
ARPHRD_IEEE80211_RADIOTAP = 803  # IEEE 802.11 + radiotap header
ARPHRD_MPLS_TUNNEL = 899  # MPLS Tunnel Interface

ARPHRD_VOID = 0xFFFF  # Void type, nothing is known
ARPHRD_NONE = 0xFFFE  # zero header length

(ARPHRD_NAMES, ARPHRD_VALUES) = map_namespace("ARPHRD_", globals())