/
opt
/
imh-python
/
lib
/
python3.9
/
site-packages
/
pyroute2
/
netlink
/
rtnl
/
tcmsg
/
/opt/imh-python/lib/python3.9/site-packages/pyroute2/netlink/rtnl/tcmsg
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
act_bpf.py
979
0644
edit
dl
rm
act_connmark.py
1234
0644
edit
dl
rm
act_gact.py
709
0644
edit
dl
rm
act_mirred.py
1725
0644
edit
dl
rm
act_police.py
1866
0644
edit
dl
rm
act_skbedit.py
3337
0644
edit
dl
rm
act_vlan.py
1465
0644
edit
dl
rm
cls_basic.py
8478
0644
edit
dl
rm
cls_flow.py
4613
0644
edit
dl
rm
cls_fw.py
1427
0644
edit
dl
rm
cls_matchall.py
986
0644
edit
dl
rm
cls_u32.py
8034
0644
edit
dl
rm
common.py
10728
0644
edit
dl
rm
common_act.py
2063
0644
edit
dl
rm
common_ematch.py
3148
0644
edit
dl
rm
em_cmp.py
2776
0644
edit
dl
rm
em_ipset.py
1741
0644
edit
dl
rm
em_meta.py
5933
0644
edit
dl
rm
sched_bpf.py
2571
0644
edit
dl
rm
sched_cake.py
12833
0644
edit
dl
rm
sched_choke.py
3432
0644
edit
dl
rm
sched_clsact.py
1011
0644
edit
dl
rm
sched_codel.py
1607
0644
edit
dl
rm
sched_drr.py
755
0644
edit
dl
rm
sched_fq_codel.py
2658
0644
edit
dl
rm
sched_hfsc.py
2353
0644
edit
dl
rm
sched_htb.py
5739
0644
edit
dl
rm
sched_ingress.py
214
0644
edit
dl
rm
sched_netem.py
5142
0644
edit
dl
rm
sched_pfifo.py
196
0644
edit
dl
rm
sched_pfifo_fast.py
215
0644
edit
dl
rm
sched_plug.py
446
0644
edit
dl
rm
sched_sfq.py
2717
0644
edit
dl
rm
sched_tbf.py
1087
0644
edit
dl
rm
sched_template.py
1250
0644
edit
dl
rm
__init__.py
2743
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/site-packages/pyroute2/netlink/rtnl/tcmsg/common_ematch.py
(3148B)
from pyroute2.netlink.rtnl.tcmsg import em_cmp, em_ipset, em_meta plugins = { # 0: em_container, 1: em_cmp, # 2: em_nbyte, # 3: em_u32, 4: em_meta, # 5: em_text, # 6: em_vlan, # 7: em_canid, 8: em_ipset, # 9: em_ipt, } plugins_translate = { 'container': 0, 'cmp': 1, 'nbyte': 2, 'u32': 3, 'meta': 4, 'text': 5, 'vlan': 6, 'canid': 7, 'ipset': 8, 'ipt': 9, } TCF_EM_REL_END = 0 TCF_EM_REL_AND = 1 TCF_EM_REL_OR = 2 TCF_EM_INVERSE_MASK = 4 RELATIONS_DICT = { 'and': TCF_EM_REL_AND, 'AND': TCF_EM_REL_AND, '&&': TCF_EM_REL_AND, 'or': TCF_EM_REL_OR, 'OR': TCF_EM_REL_OR, '||': TCF_EM_REL_OR, } class nla_plus_tcf_ematch_opt(object): @staticmethod def parse_ematch_options(self, *argv, **kwarg): if 'kind' not in self: raise ValueError('ematch requires "kind" parameter') kind = self['kind'] if kind in plugins: ret = plugins[kind].data(data=argv[0]) ret.decode() return ret return self.hex def get_ematch_parms(kwarg): if 'kind' not in kwarg: raise ValueError('ematch requires "kind" parameter') if kwarg['kind'] in plugins: return plugins[kwarg['kind']].get_parameters(kwarg) else: return [] def get_tcf_ematches(kwarg): ret = {'attrs': []} matches = [] header = {'nmatches': 0, 'progid': 0} # Get the number of expressions expr_count = len(kwarg['match']) header['nmatches'] = expr_count # Load plugin and transfer data for i in range(0, expr_count): match = {'matchid': 0, 'kind': None, 'flags': 0, 'pad': 0, 'opt': None} cur_match = kwarg['match'][i] # Translate string kind into numeric kind kind = plugins_translate[cur_match['kind']] match['kind'] = kind data = plugins[kind].data() data.setvalue(cur_match) data.encode() # Add ematch encoded data match['opt'] = data.data # Safety check if i == expr_count - 1 and 'relation' in cur_match: raise ValueError('Could not set a relation to the last expression') if i < expr_count - 1 and 'relation' not in cur_match: raise ValueError( 'You must specify a relation for every expression' ' except the last one' ) # Set relation to flags if 'relation' in cur_match: relation = cur_match['relation'] if relation in RELATIONS_DICT: match['flags'] |= RELATIONS_DICT.get(relation) else: raise ValueError('Unknown relation {0}'.format(relation)) else: match['flags'] = TCF_EM_REL_END # Handle inverse flag if 'inverse' in cur_match: if cur_match['inverse']: match['flags'] |= TCF_EM_INVERSE_MASK # Append new match to list of matches matches.append(match) ret['attrs'].append(['TCA_EMATCH_TREE_HDR', header]) ret['attrs'].append(['TCA_EMATCH_TREE_LIST', matches]) return ret
Save
cmd:
run