ifstate 2.0.1__py3-none-any.whl → 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/METADATA +3 -1
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/RECORD +9 -9
- libifstate/__init__.py +19 -10
- libifstate/tc/__init__.py +2 -2
- libifstate/util.py +0 -30
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/WHEEL +0 -0
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/entry_points.txt +0 -0
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/licenses/LICENSE +0 -0
- {ifstate-2.0.1.dist-info → ifstate-2.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ifstate
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Manage host interface settings in a declarative manner
|
|
5
5
|
Home-page: https://ifstate.net/
|
|
6
6
|
Author: Thomas Liske
|
|
7
7
|
Author-email: thomas@fiasko-nw.net
|
|
8
8
|
License: GPL3+
|
|
9
|
+
Requires-Python: >=3.10
|
|
9
10
|
Description-Content-Type: text/markdown
|
|
10
11
|
License-File: LICENSE
|
|
11
12
|
Requires-Dist: jsonschema
|
|
@@ -25,6 +26,7 @@ Dynamic: license
|
|
|
25
26
|
Dynamic: license-file
|
|
26
27
|
Dynamic: provides-extra
|
|
27
28
|
Dynamic: requires-dist
|
|
29
|
+
Dynamic: requires-python
|
|
28
30
|
Dynamic: summary
|
|
29
31
|
|
|
30
32
|
# IfState
|
|
@@ -2,11 +2,11 @@ ifstate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
ifstate/ifstate.py,sha256=Vot_Bo0MGT_5MUKD5-pt2xB-fLLkjwvJo24KgtETtR8,9329
|
|
3
3
|
ifstate/shell.py,sha256=7_JFpi4icr9MijynDzbb0v5mxhFsng6PCC4m3uQ255A,2177
|
|
4
4
|
ifstate/vrrp.py,sha256=FJ9b1eJseTtZFfknHU-xV68Qz7cPrRrc5PTcjUVj-fY,5953
|
|
5
|
-
ifstate-2.0.
|
|
6
|
-
libifstate/__init__.py,sha256=
|
|
5
|
+
ifstate-2.0.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
6
|
+
libifstate/__init__.py,sha256=QtL4RLZeAijw8PhXbNkpBpd2esgaHlaGu-xOtjbJmqM,34375
|
|
7
7
|
libifstate/exception.py,sha256=NmKqD9O8dRWBgO__Pt0_wGSR5GWZ1RHXZZEUI3ArVLo,2360
|
|
8
8
|
libifstate/log.py,sha256=rG0ISWyeGGlC_jRREoSpkdySc5EmyhOQIgSfvRqlaZA,4651
|
|
9
|
-
libifstate/util.py,sha256=
|
|
9
|
+
libifstate/util.py,sha256=f5HPazDNbwtADJwXwhgx9YMmMfDj5NDokhpaAJBUV4I,10745
|
|
10
10
|
libifstate/address/__init__.py,sha256=SobrZ9e2ItrmEidnKPBhUMitRDdTEajbkU9Rkmtx-gQ,3165
|
|
11
11
|
libifstate/bpf/__init__.py,sha256=NVzaunTmJU2PbIQg9eWBMKpFgLh3EnD3ujNa7Yt6rNc,7699
|
|
12
12
|
libifstate/bpf/ctypes.py,sha256=kLZJHZlba09Vc-tbsJAcKpDwdoNO2IjlYVLCopawHmA,4274
|
|
@@ -29,11 +29,11 @@ libifstate/parser/yaml.py,sha256=MC0kmwqt3P45z61fb_wfUqoj0iZyhFYkdPyr0UqMSZA,141
|
|
|
29
29
|
libifstate/routing/__init__.py,sha256=O4lbaCJvLgx-iQUa0WDgRmSPR4AKvveqPgxxb4HwYQ4,25305
|
|
30
30
|
libifstate/schema/2/ifstate.conf.schema.json,sha256=WYjy0BoRPCK59Fv7Z-rMu4-RVPT1v_9w7yVIlQVxros,221181
|
|
31
31
|
libifstate/sysctl/__init__.py,sha256=_QNmH0CirbBy8VAupTm6UhIhB88fGWqUy9TnfmS0j5I,3637
|
|
32
|
-
libifstate/tc/__init__.py,sha256=
|
|
32
|
+
libifstate/tc/__init__.py,sha256=48qZo1poc4v7KKiNpUsHVuRBQyu92LaNcEMtRHjDjt8,12093
|
|
33
33
|
libifstate/wireguard/__init__.py,sha256=VSn3PzQXwZeRV1qf5nOc_RbeePQlXu8FUh2Lg356-ZA,8869
|
|
34
34
|
libifstate/xdp/__init__.py,sha256=X1xhEIGng7R5d5F4KsChykT2g6H-XBRWbWABijoYDQA,7208
|
|
35
|
-
ifstate-2.0.
|
|
36
|
-
ifstate-2.0.
|
|
37
|
-
ifstate-2.0.
|
|
38
|
-
ifstate-2.0.
|
|
39
|
-
ifstate-2.0.
|
|
35
|
+
ifstate-2.0.2.dist-info/METADATA,sha256=nycqBEIXnGHt7UxjyTBjb3W99lQKGemkK1UZF2LCaz0,1653
|
|
36
|
+
ifstate-2.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
ifstate-2.0.2.dist-info/entry_points.txt,sha256=HF6jX7Uu_nF1Ly-J9uEPeiRapOxnM6LuHsb2y6Mt-k4,52
|
|
38
|
+
ifstate-2.0.2.dist-info/top_level.txt,sha256=A7peI7aKBaM69fsiSPvMbL3rzTKZZr5qDxKC-pHMGdE,19
|
|
39
|
+
ifstate-2.0.2.dist-info/RECORD,,
|
libifstate/__init__.py
CHANGED
|
@@ -54,7 +54,7 @@ import json
|
|
|
54
54
|
import errno
|
|
55
55
|
import logging
|
|
56
56
|
|
|
57
|
-
__version__ = "2.0.
|
|
57
|
+
__version__ = "2.0.2"
|
|
58
58
|
|
|
59
59
|
class IfState():
|
|
60
60
|
def __init__(self):
|
|
@@ -168,6 +168,7 @@ class IfState():
|
|
|
168
168
|
netns.bpf_progs.add(name, config)
|
|
169
169
|
|
|
170
170
|
# add interfaces from config
|
|
171
|
+
ifb_ifaces = {}
|
|
171
172
|
for name, ifstate in ifstates['interfaces'].items():
|
|
172
173
|
kind = ifstate['link']['kind']
|
|
173
174
|
defaults = self.get_defaults(
|
|
@@ -234,7 +235,7 @@ class IfState():
|
|
|
234
235
|
netns.sysctl.add(name, ifstate['sysctl'])
|
|
235
236
|
|
|
236
237
|
if 'cshaper' in ifstate:
|
|
237
|
-
profile_name = ifstate['
|
|
238
|
+
profile_name = ifstate['cshaper'].get(
|
|
238
239
|
'profile', 'default')
|
|
239
240
|
logger.debug('cshaper profile {} enabled'.format(profile_name),
|
|
240
241
|
extra={'iface': name, 'netns': netns})
|
|
@@ -246,8 +247,8 @@ class IfState():
|
|
|
246
247
|
logger.debug('cshaper ifb name {}'.format(ifb_name),
|
|
247
248
|
extra={'iface': name, 'netns': netns})
|
|
248
249
|
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
# prepare ifb interface settings
|
|
251
|
+
ifb_ifaces[ifb_name] = {
|
|
251
252
|
'link': {
|
|
252
253
|
'state': 'up',
|
|
253
254
|
'kind': 'ifb',
|
|
@@ -256,13 +257,19 @@ class IfState():
|
|
|
256
257
|
'qdisc': cshaper_profile['ingress_qdisc'],
|
|
257
258
|
}
|
|
258
259
|
}
|
|
259
|
-
|
|
260
|
+
|
|
261
|
+
# configure tc on ifb
|
|
262
|
+
ifb_ifaces[ifb_name]['tc']['qdisc']['bandwidth'] = ifstate['cshaper'].get(
|
|
260
263
|
'ingress', 'unlimited')
|
|
264
|
+
netns.tc[ifb_name] = TC(netns, ifb_name, ifb_ifaces[ifb_name]['tc'])
|
|
261
265
|
|
|
266
|
+
# clone vrrp settings
|
|
262
267
|
if 'vrrp' in ifstate:
|
|
263
|
-
|
|
268
|
+
ifb_ifaces[ifb_name]['vrrp'] = ifstate['vrrp']
|
|
264
269
|
|
|
265
|
-
|
|
270
|
+
# add ifb link to known links
|
|
271
|
+
netns.links[ifb_name] = Link(self,
|
|
272
|
+
netns, ifb_name, ifb_ifaces[ifb_name]["link"], {}, None, [], ifstate.get('vrrp'), None)
|
|
266
273
|
|
|
267
274
|
# egress
|
|
268
275
|
if 'tc' in ifstate:
|
|
@@ -289,10 +296,9 @@ class IfState():
|
|
|
289
296
|
]
|
|
290
297
|
}
|
|
291
298
|
|
|
292
|
-
ifstate['tc']['qdisc']['bandwidth'] = ifstate['
|
|
293
|
-
'egress', 'unlimited')
|
|
299
|
+
ifstate['tc']['qdisc']['bandwidth'] = ifstate['cshaper'].get('egress', 'unlimited')
|
|
294
300
|
|
|
295
|
-
del ifstate['
|
|
301
|
+
del ifstate['cshaper']
|
|
296
302
|
|
|
297
303
|
if 'tc' in ifstate:
|
|
298
304
|
netns.tc[name] = TC(
|
|
@@ -317,6 +323,9 @@ class IfState():
|
|
|
317
323
|
|
|
318
324
|
netns.xdp[name] = XDP(netns, name, ifstate['xdp'])
|
|
319
325
|
|
|
326
|
+
# cshaper: append ifb interfaces to config
|
|
327
|
+
ifstates['interfaces'].update(ifb_ifaces)
|
|
328
|
+
|
|
320
329
|
# add routing from config
|
|
321
330
|
if 'routing' in ifstates:
|
|
322
331
|
if netns.tables is None:
|
libifstate/tc/__init__.py
CHANGED
|
@@ -199,7 +199,7 @@ class TC():
|
|
|
199
199
|
"parent": parent,
|
|
200
200
|
}
|
|
201
201
|
try:
|
|
202
|
-
self.netns.ipr.
|
|
202
|
+
self.netns.ipr.tc("del-filter", **opts)
|
|
203
203
|
except Exception as err:
|
|
204
204
|
if not isinstance(err, netlinkerror_classes):
|
|
205
205
|
raise
|
|
@@ -241,7 +241,7 @@ class TC():
|
|
|
241
241
|
"info": tc_filter["prio"] << 16,
|
|
242
242
|
"parent": parent,
|
|
243
243
|
}
|
|
244
|
-
self.netns.ipr.
|
|
244
|
+
self.netns.ipr.tc("del-filter", **opts)
|
|
245
245
|
self.netns.ipr.tc("add-filter", **tc_filter)
|
|
246
246
|
|
|
247
247
|
except Exception as err:
|
libifstate/util.py
CHANGED
|
@@ -171,21 +171,6 @@ class IPRouteExt(IPRoute):
|
|
|
171
171
|
self.__sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
172
172
|
self.sysfs_path = "/sys"
|
|
173
173
|
|
|
174
|
-
def del_filter_by_info(self, index=0, handle=0, info=0, parent=0):
|
|
175
|
-
msg = tcmsg()
|
|
176
|
-
msg['index'] = index
|
|
177
|
-
msg['handle'] = handle
|
|
178
|
-
msg['info'] = info
|
|
179
|
-
if parent != 0:
|
|
180
|
-
msg['parent'] = parent
|
|
181
|
-
|
|
182
|
-
return tuple(self.nlm_request(
|
|
183
|
-
msg,
|
|
184
|
-
msg_type=RTM_DELTFILTER,
|
|
185
|
-
msg_flags=NLM_F_REQUEST |
|
|
186
|
-
NLM_F_ACK
|
|
187
|
-
))
|
|
188
|
-
|
|
189
174
|
def get_ifname_by_index(self, index):
|
|
190
175
|
link = next(iter(self.get_links(index)), None)
|
|
191
176
|
|
|
@@ -268,21 +253,6 @@ class NetNSExt(NetNS):
|
|
|
268
253
|
except OSError:
|
|
269
254
|
pass
|
|
270
255
|
|
|
271
|
-
def del_filter_by_info(self, index=0, handle=0, info=0, parent=0):
|
|
272
|
-
msg = tcmsg()
|
|
273
|
-
msg['index'] = index
|
|
274
|
-
msg['handle'] = handle
|
|
275
|
-
msg['info'] = info
|
|
276
|
-
if parent != 0:
|
|
277
|
-
msg['parent'] = parent
|
|
278
|
-
|
|
279
|
-
return tuple(self.nlm_request(
|
|
280
|
-
msg,
|
|
281
|
-
msg_type=RTM_DELTFILTER,
|
|
282
|
-
msg_flags=NLM_F_REQUEST |
|
|
283
|
-
NLM_F_ACK
|
|
284
|
-
))
|
|
285
|
-
|
|
286
256
|
def get_ifname_by_index(self, index):
|
|
287
257
|
link = next(iter(self.get_links(index)), None)
|
|
288
258
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|