ifstate 1.11.8__py3-none-any.whl → 1.11.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ifstate
3
- Version: 1.11.8
3
+ Version: 1.11.9
4
4
  Summary: Manage host interface settings in a declarative manner
5
5
  Home-page: https://ifstate.net/
6
6
  Author: Thomas Liske
@@ -2,18 +2,18 @@ ifstate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  ifstate/ifstate.py,sha256=1xXJmVt_w6X7K5KTqfeTDZ1y-wJxgtrtLJJ1bUFN5I0,8031
3
3
  ifstate/shell.py,sha256=7_JFpi4icr9MijynDzbb0v5mxhFsng6PCC4m3uQ255A,2177
4
4
  ifstate/vrrp.py,sha256=GOSwQFf3IrcWF5DbQCJQqZ7p33TaFMEVp8LwyRDolWM,4016
5
- libifstate/__init__.py,sha256=sqn9jGnNnyIjzyqCSA_Ij2NTfhj5v7LSpzeywnAgp_Y,30914
5
+ libifstate/__init__.py,sha256=UBj-_U7UY6ar2ds0ZS9yb15bR4813RJ3NUQwN8uSWHg,30914
6
6
  libifstate/exception.py,sha256=jCFub2kWSpntcxwL-yJkOpw9sqCmCypBqN_qaIzwEQU,2480
7
- libifstate/log.py,sha256=M-wyjU-QcauMmZd0QK65dgdoDSZC-LmQ-ZDeiPfhGzc,3953
7
+ libifstate/log.py,sha256=CKETu-GUyhBgs4WVtbIYhm_Lzgilap9ALLPeSkO1sWc,4136
8
8
  libifstate/util.py,sha256=NYY6Yoy4t42z_Q_Auy_vRHZ_MWT_XXCBZGZj61YMuWQ,10111
9
- libifstate/address/__init__.py,sha256=usa9VqX-xOmwek9mkAuSYjx9aXnuZa1-qhCmoQdEKME,2716
9
+ libifstate/address/__init__.py,sha256=wDs0JgLBdZjKzLAnCsMgsyQwgCzXNckcRBL7NIGS_aI,3056
10
10
  libifstate/bpf/__init__.py,sha256=NVzaunTmJU2PbIQg9eWBMKpFgLh3EnD3ujNa7Yt6rNc,7699
11
11
  libifstate/bpf/ctypes.py,sha256=kLZJHZlba09Vc-tbsJAcKpDwdoNO2IjlYVLCopawHmA,4274
12
12
  libifstate/bpf/map.py,sha256=cLHNMvRBDNW2yVCEf3z242_oRdU0HqVbFEYVkKXng0w,10818
13
13
  libifstate/brport/__init__.py,sha256=NzdA8F4hr2se1bXKNnyKZbvOFlCWBq_cdjwsL1H0Y-o,2964
14
14
  libifstate/fdb/__init__.py,sha256=jMplRZZQKkgwFQT2L7Ua4YCdLKwOzkd43_6OFtet2No,6262
15
15
  libifstate/link/__init__.py,sha256=QZggoC-bIscqwVedqVycaSqS1CmXB3Bx3m2FZei8Q_4,115
16
- libifstate/link/base.py,sha256=TVxOCNTpDNvpDnu1wvBqPmxcB0FTmgD9-IfEklNLw4Q,32899
16
+ libifstate/link/base.py,sha256=BLdFUXTmzzE1dj3eBAnLf3JNSISI6fIODqI1EK2uNwI,33028
17
17
  libifstate/link/physical.py,sha256=cJiq-MCfy-3XQoU-OxzgfPZZtu_pJ8u2ioJgn9VYdGk,560
18
18
  libifstate/link/tun.py,sha256=m55o5cwO3h3DCLofUR-68fM4ggLoTKElp6ZJ2LrJSCc,959
19
19
  libifstate/link/veth.py,sha256=DtohI4PNlWoPijROf6AA6pikCvDhFXh15zQSWQBbfsA,1989
@@ -22,15 +22,15 @@ libifstate/netns/__init__.py,sha256=lKv43oEcpVUmL494MNOOG_Uh4ght50uu8n8nb9TIwsA,
22
22
  libifstate/parser/__init__.py,sha256=byz1W0G7UewVc5FFie-ti3UZjGK3-75wHIaOeq0oySQ,88
23
23
  libifstate/parser/base.py,sha256=4Y_kaUysbgQRM9u_Kg3Lr_5GWFGdTXDmP4EC3McsNzU,4628
24
24
  libifstate/parser/yaml.py,sha256=u9D9nPfVhYADTd01EYxFYIywnTBccNF1solOcGeLUjM,1345
25
- libifstate/routing/__init__.py,sha256=ufNsUoe-YecKOyVO3m4rtZdSMqblbd3sazFflsb7otQ,19159
25
+ libifstate/routing/__init__.py,sha256=DBX8wv386rMii2gZf9n-8vbPikSqqaZO1NoHJX8Bjn4,19666
26
26
  libifstate/sysctl/__init__.py,sha256=L2gkoLnac_HM6RbCaKmsEuDTNj2m7U4Rjw42TEti0kg,3074
27
27
  libifstate/tc/__init__.py,sha256=inPdampCOIr_4oKNB3awqMkW0Eh4fpPh9jvSba6sPVg,12092
28
28
  libifstate/wireguard/__init__.py,sha256=vM7vxioV9vQ3gq9SE_URf97ZfGhLsxNiam16y_gXZ5E,6225
29
29
  libifstate/xdp/__init__.py,sha256=X1xhEIGng7R5d5F4KsChykT2g6H-XBRWbWABijoYDQA,7208
30
- schema/ifstate.conf.schema.json,sha256=oIYIEtEgNGrBOno7XoCbJKdS0v_N5zOS59i-AMjlUWw,186956
31
- ifstate-1.11.8.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
32
- ifstate-1.11.8.dist-info/METADATA,sha256=tPX_0upzhtU9JA8xNinUbHDDxDkCj6FkgcI3ZbYaHsw,1385
33
- ifstate-1.11.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
34
- ifstate-1.11.8.dist-info/entry_points.txt,sha256=HF6jX7Uu_nF1Ly-J9uEPeiRapOxnM6LuHsb2y6Mt-k4,52
35
- ifstate-1.11.8.dist-info/top_level.txt,sha256=A7peI7aKBaM69fsiSPvMbL3rzTKZZr5qDxKC-pHMGdE,19
36
- ifstate-1.11.8.dist-info/RECORD,,
30
+ schema/ifstate.conf.schema.json,sha256=-ACPDuqnemSbdoy2ZapMpUzXzabrLPoruE7BO7P080Q,195193
31
+ ifstate-1.11.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
32
+ ifstate-1.11.9.dist-info/METADATA,sha256=hxlJKKkeBkbm4m7y4Ddi3ujTDpMwzN_OMbF2P0ls5qE,1385
33
+ ifstate-1.11.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
34
+ ifstate-1.11.9.dist-info/entry_points.txt,sha256=HF6jX7Uu_nF1Ly-J9uEPeiRapOxnM6LuHsb2y6Mt-k4,52
35
+ ifstate-1.11.9.dist-info/top_level.txt,sha256=A7peI7aKBaM69fsiSPvMbL3rzTKZZr5qDxKC-pHMGdE,19
36
+ ifstate-1.11.9.dist-info/RECORD,,
libifstate/__init__.py CHANGED
@@ -48,7 +48,7 @@ import json
48
48
  import errno
49
49
  import logging
50
50
 
51
- __version__ = "1.11.8"
51
+ __version__ = "1.11.9"
52
52
 
53
53
 
54
54
  class IfState():
@@ -1,7 +1,7 @@
1
1
  from libifstate.util import logger, IfStateLogging
2
2
  from libifstate.exception import netlinkerror_classes
3
3
  from ipaddress import ip_interface
4
- from pyroute2.netlink.rtnl.ifaddrmsg import IFA_F_PERMANENT
4
+ from pyroute2.netlink.rtnl.ifaddrmsg import IFA_F_DADFAILED, IFA_F_PERMANENT
5
5
 
6
6
 
7
7
  class Addresses():
@@ -25,20 +25,25 @@ class Addresses():
25
25
  # get active ip addresses
26
26
  ipr_addr = {}
27
27
  addr_add = []
28
+ addr_dad = []
28
29
  for addr in self.netns.ipr.get_addr(index=idx):
30
+ flags = addr.get_attr('IFA_FLAGS', 0)
29
31
  ip = ip_interface(addr.get_attr('IFA_ADDRESS') +
30
32
  '/' + str(addr['prefixlen']))
33
+ if flags & IFA_F_DADFAILED == IFA_F_DADFAILED:
34
+ logger.debug('{} has failed dad'.format(ip), extra={'iface': self.iface, 'netns': self.netns})
35
+ addr_dad.append(ip)
31
36
  ipr_addr[ip] = addr
32
37
 
33
38
  for addr in self.addresses:
34
- if addr in ipr_addr:
39
+ if addr in ipr_addr and addr not in addr_dad:
35
40
  logger.log_ok('addresses', '= {}'.format(addr.with_prefixlen))
36
41
  del ipr_addr[addr]
37
42
  else:
38
43
  addr_add.append(addr)
39
44
 
40
45
  for ip, addr in ipr_addr.items():
41
- if not any(ip in net for net in ignore):
46
+ if addr in addr_dad or not any(ip in net for net in ignore):
42
47
  if not ign_dynamic or ipr_addr[ip]['flags'] & IFA_F_PERMANENT == IFA_F_PERMANENT:
43
48
  logger.log_del('addresses', '- {}'.format(ip.with_prefixlen))
44
49
  try:
libifstate/link/base.py CHANGED
@@ -76,6 +76,12 @@ class Link(ABC):
76
76
  0x88a8: '802.1ad',
77
77
  0x8100: '802.1q',
78
78
  },
79
+ # === vxlan ===
80
+ 'vxlan_df': {
81
+ 0: 'unset',
82
+ 1: 'set',
83
+ 2: 'inherit',
84
+ },
79
85
  }
80
86
  attr_value_lookup = {
81
87
  'group': RTLookups.group,
libifstate/log.py CHANGED
@@ -10,6 +10,8 @@ logger.log_add = lambda option, oper='add': logger.info(oper, extra={'option': o
10
10
  logger.log_change = lambda option, oper='change': logger.info(oper, extra={'option': option, 'style': IfStateLogging.STYLE_CHG})
11
11
  logger.log_ok = lambda option, oper='ok': logger.info(oper, extra={'option': option, 'style': IfStateLogging.STYLE_OK})
12
12
  logger.log_del = lambda option, oper='del': logger.info(oper, extra={'option': option, 'style': IfStateLogging.STYLE_DEL})
13
+ logger.log_err = lambda option, oper='warn': logger.error(oper, extra={'option': option})
14
+ logger.log_warn = lambda option, oper='warn': logger.warning(oper, extra={'option': option})
13
15
 
14
16
  formatter = logging.Formatter('%(bol)s%(prefix)s%(style)s%(message)s%(eol)s')
15
17
 
@@ -309,8 +309,17 @@ class Tables(collections.abc.Mapping):
309
309
 
310
310
  for route in croutes:
311
311
  if 'oif' in route and type(route['oif']) == str:
312
- route['oif'] = next(
312
+ oif = next(
313
313
  iter(self.netns.ipr.link_lookup(ifname=route['oif'])), None)
314
+ if oif is None:
315
+ if 'gateway' in route:
316
+ logger.log_warn(log_str, '! {}: dev {} is unknown'.format(route['dst'], route['oif']))
317
+ del route['oif']
318
+ else:
319
+ logger.log_err(log_str, '! {}: dev {} is unknown'.format(route['dst'], route['oif']))
320
+ continue
321
+ else:
322
+ route['oif'] = oif
314
323
  found = False
315
324
  identical = False
316
325
  matched = vrrp_match(route, by_vrrp, vrrp_type, vrrp_name, vrrp_state)
@@ -554,7 +563,7 @@ class Rules():
554
563
  if ignore:
555
564
  continue
556
565
 
557
- logger.log_del(log_str)
566
+ logger.log_del('#{}'.format(rule['priority']))
558
567
  try:
559
568
  if do_apply:
560
569
  self.netns.ipr.rule('del', **rule)
@@ -2,7 +2,7 @@
2
2
  "$id": "https://ifstate.net/schema/ifstate.conf.schema.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "ifstate.conf",
5
- "description": "IfState 1.11.8 Configuration Schema",
5
+ "description": "IfState 1.11.9 Configuration Schema",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "interfaces"
@@ -1783,7 +1783,8 @@
1783
1783
  "items": {
1784
1784
  "type": "object",
1785
1785
  "required": [
1786
- "name"
1786
+ "name",
1787
+ "link"
1787
1788
  ],
1788
1789
  "additionalProperties": false,
1789
1790
  "properties": {
@@ -1887,7 +1888,9 @@
1887
1888
  "items": {
1888
1889
  "type": "object",
1889
1890
  "additionalProperties": false,
1890
- "required": ["lladdr"],
1891
+ "required": [
1892
+ "lladdr"
1893
+ ],
1891
1894
  "properties": {
1892
1895
  "lladdr": {
1893
1896
  "description": "destination link layer address",
@@ -1959,6 +1962,9 @@
1959
1962
  "link": {
1960
1963
  "description": "link settings of the interface",
1961
1964
  "type": "object",
1965
+ "required": [
1966
+ "kind"
1967
+ ],
1962
1968
  "oneOf": [
1963
1969
  {
1964
1970
  "description": "Intermediate Functional Block device",
@@ -2805,7 +2811,7 @@
2805
2811
  "null"
2806
2812
  ],
2807
2813
  "description": "specifies the peer's netns name or null if the peer isn't in a netns namespace"
2808
- },
2814
+ },
2809
2815
  "state": {
2810
2816
  "$ref": "#/$defs/iface-link_state"
2811
2817
  },
@@ -2920,17 +2926,154 @@
2920
2926
  "$ref": "#/$defs/iface-link_ifalias"
2921
2927
  },
2922
2928
  "vxlan_id": {
2923
- "type": [
2924
- "integer"
2925
- ],
2929
+ "type": "integer",
2926
2930
  "minimum": 0,
2927
2931
  "maximum": 16777215,
2928
2932
  "description": "specifies the VNI"
2929
2933
  },
2934
+ "vxlan_ageing": {
2935
+ "type": "integer",
2936
+ "minimum": 0,
2937
+ "maximum": 4294967296,
2938
+ "description": "specifies the lifetime in seconds of FDB entries learnt by the kernel (0: none)",
2939
+ "default": 300
2940
+ },
2941
+ "vxlan_df": {
2942
+ "enum": [
2943
+ 0,
2944
+ "unset",
2945
+ 1,
2946
+ "set",
2947
+ 2,
2948
+ "inherit"
2949
+ ],
2950
+ "default": "unset",
2951
+ "description": "specifies the usage of the DF bit in outgoing packets with IPv4 headers"
2952
+ },
2953
+ "vxlan_label": {
2954
+ "type": "integer",
2955
+ "minimum": 0,
2956
+ "maximum": 1048575,
2957
+ "description": "specifies a fixed flowlabel"
2958
+ },
2959
+ "vxlan_learning": {
2960
+ "type": "integer",
2961
+ "minimum": 0,
2962
+ "maximum": 1,
2963
+ "description": "specifies if unknown source link layer addresses and IP addresses are entered into the VXLAN device fdb",
2964
+ "default": 1
2965
+ },
2966
+ "vxlan_limit": {
2967
+ "type": "integer",
2968
+ "minimum": 0,
2969
+ "maximum": 4294967296,
2970
+ "description": "specifies the maximum number of FDB entries (0: none)",
2971
+ "default": 0
2972
+ },
2973
+ "vxlan_proxy": {
2974
+ "type": "integer",
2975
+ "minimum": 0,
2976
+ "maximum": 1,
2977
+ "description": "specifies if ARP proxy is turned on",
2978
+ "default": 0
2979
+ },
2980
+ "vxlan_rsc": {
2981
+ "type": "integer",
2982
+ "minimum": 0,
2983
+ "maximum": 1,
2984
+ "description": "specifies if route short circuit is turned on",
2985
+ "default": 0
2986
+ },
2987
+ "vxlan_l2miss": {
2988
+ "type": "integer",
2989
+ "minimum": 0,
2990
+ "maximum": 1,
2991
+ "description": "specifies if netlink LLADDR miss notifications are generated",
2992
+ "default": 0
2993
+ },
2994
+ "vxlan_l3miss": {
2995
+ "type": "integer",
2996
+ "minimum": 0,
2997
+ "maximum": 1,
2998
+ "description": "specifies if netlink IP ADDR miss notifications are generated",
2999
+ "default": 0
3000
+ },
3001
+ "vxlan_udp_csum": {
3002
+ "type": "integer",
3003
+ "minimum": 0,
3004
+ "maximum": 1,
3005
+ "description": "specifies if UDP checksum is calculated for tx packets over IPv4",
3006
+ "default": 1
3007
+ },
2930
3008
  "vxlan_link": {
2931
3009
  "$ref": "#/$defs/iface-link_tun-dev"
3010
+ },
3011
+ "vxlan_local": {
3012
+ "type": "string",
3013
+ "description": "tunnel source ip address",
3014
+ "oneOf": [
3015
+ {
3016
+ "format": "ipv4"
3017
+ },
3018
+ {
3019
+ "format": "ipv6"
3020
+ }
3021
+ ]
3022
+ },
3023
+ "vxlan_group": {
3024
+ "type": "string",
3025
+ "description": "remote unicast destination or multicast group IPv4 address",
3026
+ "format": "ipv4"
3027
+ },
3028
+ "vxlan_group6": {
3029
+ "type": "string",
3030
+ "description": "remote unicast destination or multicast group IPv6 address",
3031
+ "format": "ipv6"
3032
+ },
3033
+ "vxlan_tos": {
3034
+ "type": "integer",
3035
+ "description": "specifies the TOS value to use in outgoing packets (0: inherit)",
3036
+ "minimum": 0,
3037
+ "maximum": 255,
3038
+ "default": 0
3039
+ },
3040
+ "vxlan_ttl": {
3041
+ "type": "integer",
3042
+ "description": "specifies the TTL value to use in outgoing packets (0: auto)",
3043
+ "minimum": 0,
3044
+ "maximum": 255,
3045
+ "default": 0
3046
+ },
3047
+ "vxlan_ttl_inherit": {
3048
+ "type": "boolean",
3049
+ "description": "control whether TTL is propagated",
3050
+ "default": false
2932
3051
  }
2933
- }
3052
+ },
3053
+ "anyOf": [
3054
+ {
3055
+ "oneOf": [
3056
+ {
3057
+ "required": [
3058
+ "vxlan_group"
3059
+ ]
3060
+ },
3061
+ {
3062
+ "required": [
3063
+ "vxlan_group6"
3064
+ ]
3065
+ }
3066
+ ]
3067
+ },
3068
+ {
3069
+ "not": {
3070
+ "required": [
3071
+ "vxlan_group",
3072
+ "vxlan_group6"
3073
+ ]
3074
+ }
3075
+ }
3076
+ ]
2934
3077
  },
2935
3078
  {
2936
3079
  "description": "IPIP interface",