Univention Bugzilla – Bug 53074
Joinscript of univention-dhcp fails: Subnet address: Not a valid IP address
Last modified: 2021-05-25 16:03:05 CEST
During installation of univention-dhcp on a UCS 5.0 Primary Node, the joinscript fails with a python traceback. This is with shell -x output: ======================================= ++ univention-ldapsearch -LLL -b dc=ucs50pt1,dc=dev '(objectClass=univentionDhcpSubnet)' dn ++ grep -c '^dn' + count=1 + log 'Number of existing DHCP (Shared) Sub-Networks: 1' + echo '25univention-dhcp.inst: Number of existing DHCP (Shared) Sub-Networks: 1' 25univention-dhcp.inst: Number of existing DHCP (Shared) Sub-Networks: 1 + '[' 1 -ge 1 ']' + return + /usr/lib/univention-dhcp/create-subnets --service cn=ucs50pt1.dev,cn=dhcp,dc=ucs50pt1,dc=dev Insufficient access Using BINDDN cn=admin,dc=ucs50pt1,dc=dev Traceback (most recent call last): File "/usr/lib/univention-dhcp/create-subnets", line 128, in <module> main() File "/usr/lib/univention-dhcp/create-subnets", line 60, in main create(opt, ucr, iface, lo, mod) File "/usr/lib/univention-dhcp/create-subnets", line 116, in create obj["subnet"] = network File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 446, in __setitem__ raise univention.admin.uexceptions.valueInvalidSyntax("%s: %s" % (self.descriptions[key].short_description, err), property=key) univention.admin.uexceptions.valueInvalidSyntax: Subnet address: Not a valid IP address! + die ======================================= I printed the cariable value: network: 10.200.8.0/24 (<class 'str'>)
In comparison to my UCS 4.4-7 DC I see that the UCS 5.0 DC doesn't have the network and boradcast addresses set. After setting them manually to ucr set interfaces/ens3/network=10.200.8.0 interfaces/ens3/broadcast=10.200.8.255 the joinscript runs successfully and the value on network in the python script changed back to: network: 10.200.8.0 (<class 'str'>)
I guess this would already fail on a UCS 4.4-7 system (or installed with 4.3-0 or later). If I set the interfaces/* variables on my updated 4.4 system like they are in UCS 5.0, then installation of univention-dhcp fails there too.
Reproducer ========== ucr set interfaces/restart/auto=no ucr --keys-only search --non-empty '^interfaces/[^/]+/(network|broadcast)$' | xargs -r ucr unset LB="$(ucr get ldap/base)" udm dhcp/service create --set service=test pdb3 /usr/lib/univention-dhcp/create-subnets \ --service "cn=test,$LB" \ --binddn "cn=admin,$LB" \ --bindpwdfile /etc/ldap.secret (Pdb) break 110 (Pdb) run (Pdb) p addr IPv4Interface('10.200.17.38/24') (Pdb) p iface.network None (Pdb) p iface.broadcast None (Pdb) p addr.broadcast *** AttributeError: 'IPv4Interface' object has no attribute 'broadcast' References ========== git:4359208b7a1eca018b1d2b28e39f5bb9131bc23a patches/netcfg/5.0-0-0-ucs/1.160/0001-Bug-35435-d-i-Write-UCR-net-configuration.patch Analysis ======== Newer D-I netcfg no longer sets "interfaces/$iface/(network|broadcast)" for a long time: Most setups use the convention "network_address=ALL_ZERO" and "broadcast_address=ALL_ONES" anyway, which most tools do automatically. USS explicitly sets those UCRVs based on that convention when configuring the network manually, but not D-I. With the conversion to Python 3 the implementation changed to use Python-3-native "ipaddress" instead of Legacy-Python "ipaddr", which uses different names and returns slightly different data. Fix === [5.0-0] a8ae5444ef fix[dhcp]: Fix DHCP network creation services/univention-dhcp/debian/changelog | 6 ++++++ services/univention-dhcp/usr/lib/univention-dhcp/create-subnets | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) Package: univention-dhcp Version: 14.0.3-5A~5.0.0.202104140843 No explicit changelog entry needed as this is a regression from Bug #52259.
Thanks, works.
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".