From 2dfa054d4628ef05ecce3f3e2ac0dca7f47defbe Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Mon, 27 May 2024 23:33:05 +0200 Subject: [PATCH 01/10] 2022->2024, added option_82.py --- debian/copyright | 4 ++-- dhcpy6d/__init__.py | 2 +- dhcpy6d/client/__init__.py | 2 +- dhcpy6d/client/default.py | 2 +- dhcpy6d/client/from_config.py | 2 +- dhcpy6d/client/parse_pattern.py | 2 +- dhcpy6d/client/reuse_lease.py | 2 +- dhcpy6d/config.py | 2 +- dhcpy6d/constants.py | 2 +- dhcpy6d/domain.py | 2 +- dhcpy6d/globals.py | 2 +- dhcpy6d/handler.py | 2 +- dhcpy6d/helpers.py | 2 +- dhcpy6d/log.py | 2 +- dhcpy6d/macs.py | 2 +- dhcpy6d/options/__init__.py | 2 +- dhcpy6d/options/option_1.py | 2 +- dhcpy6d/options/option_12.py | 2 +- dhcpy6d/options/option_13.py | 2 +- dhcpy6d/options/option_14.py | 2 +- dhcpy6d/options/option_15.py | 2 +- dhcpy6d/options/option_16.py | 2 +- dhcpy6d/options/option_23.py | 2 +- dhcpy6d/options/option_24.py | 2 +- dhcpy6d/options/option_25.py | 2 +- dhcpy6d/options/option_3.py | 2 +- dhcpy6d/options/option_31.py | 2 +- dhcpy6d/options/option_32.py | 2 +- dhcpy6d/options/option_39.py | 2 +- dhcpy6d/options/option_4.py | 2 +- dhcpy6d/options/option_56.py | 2 +- dhcpy6d/options/option_59.py | 2 +- dhcpy6d/options/option_6.py | 2 +- dhcpy6d/options/option_61.py | 2 +- dhcpy6d/options/option_7.py | 2 +- dhcpy6d/options/option_8.py | 2 +- dhcpy6d/options/option_82.py | 30 ++++++++++++++++++++++++++++++ dhcpy6d/route.py | 2 +- dhcpy6d/storage/__init__.py | 2 +- dhcpy6d/storage/mysql.py | 2 +- dhcpy6d/storage/postgresql.py | 2 +- dhcpy6d/storage/schemas.py | 2 +- dhcpy6d/storage/sqlite.py | 2 +- dhcpy6d/storage/store.py | 2 +- dhcpy6d/storage/textfile.py | 2 +- dhcpy6d/threads.py | 2 +- dhcpy6d/transaction.py | 2 +- doc/dhcpy6d-clients.conf.rst | 2 +- doc/dhcpy6d.conf.rst | 2 +- doc/dhcpy6d.rst | 2 +- main.py | 2 +- man/man5/dhcpy6d-clients.conf.5 | 2 +- man/man5/dhcpy6d.conf.5 | 2 +- man/man8/dhcpy6d.8 | 2 +- setup.py | 4 ++-- 55 files changed, 86 insertions(+), 56 deletions(-) create mode 100644 dhcpy6d/options/option_82.py diff --git a/debian/copyright b/debian/copyright index 49ef800..dd0851a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,11 +3,11 @@ Upstream-Name: dhcpy6d Source: https://dhcpy6d.de/ Files: * -Copyright: 2012-2022 Henri Wahl +Copyright: 2012-2024 Henri Wahl License: GPL-2+ Files: debian/* -Copyright: 2012-2022 Henri Wahl +Copyright: 2012-2024 Henri Wahl 2014 Axel Beckert License: GPL-2+ diff --git a/dhcpy6d/__init__.py b/dhcpy6d/__init__.py index d2c4729..9119cda 100644 --- a/dhcpy6d/__init__.py +++ b/dhcpy6d/__init__.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/client/__init__.py b/dhcpy6d/client/__init__.py index 94e57bf..bbfdeb7 100644 --- a/dhcpy6d/client/__init__.py +++ b/dhcpy6d/client/__init__.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/client/default.py b/dhcpy6d/client/default.py index 15d7eeb..eb76ec7 100644 --- a/dhcpy6d/client/default.py +++ b/dhcpy6d/client/default.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/client/from_config.py b/dhcpy6d/client/from_config.py index c516393..cb6736a 100644 --- a/dhcpy6d/client/from_config.py +++ b/dhcpy6d/client/from_config.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/client/parse_pattern.py b/dhcpy6d/client/parse_pattern.py index 36b95ea..1641f7b 100644 --- a/dhcpy6d/client/parse_pattern.py +++ b/dhcpy6d/client/parse_pattern.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/client/reuse_lease.py b/dhcpy6d/client/reuse_lease.py index fb233a1..3c24d3a 100644 --- a/dhcpy6d/client/reuse_lease.py +++ b/dhcpy6d/client/reuse_lease.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/config.py b/dhcpy6d/config.py index d07fb35..9881e65 100644 --- a/dhcpy6d/config.py +++ b/dhcpy6d/config.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/constants.py b/dhcpy6d/constants.py index 7cf3e70..be1503f 100644 --- a/dhcpy6d/constants.py +++ b/dhcpy6d/constants.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/domain.py b/dhcpy6d/domain.py index ed6146e..43d335c 100644 --- a/dhcpy6d/domain.py +++ b/dhcpy6d/domain.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/globals.py b/dhcpy6d/globals.py index 43cdc02..070744a 100644 --- a/dhcpy6d/globals.py +++ b/dhcpy6d/globals.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/handler.py b/dhcpy6d/handler.py index 666b5c0..0661131 100644 --- a/dhcpy6d/handler.py +++ b/dhcpy6d/handler.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/helpers.py b/dhcpy6d/helpers.py index 391a5af..4ce0cd6 100644 --- a/dhcpy6d/helpers.py +++ b/dhcpy6d/helpers.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/log.py b/dhcpy6d/log.py index 653e4bc..d3e4ff4 100644 --- a/dhcpy6d/log.py +++ b/dhcpy6d/log.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/macs.py b/dhcpy6d/macs.py index 1a3d3a0..00d579b 100644 --- a/dhcpy6d/macs.py +++ b/dhcpy6d/macs.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/__init__.py b/dhcpy6d/options/__init__.py index b1d1032..c12d8d7 100644 --- a/dhcpy6d/options/__init__.py +++ b/dhcpy6d/options/__init__.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_1.py b/dhcpy6d/options/option_1.py index 62aa13c..1b85fbd 100644 --- a/dhcpy6d/options/option_1.py +++ b/dhcpy6d/options/option_1.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_12.py b/dhcpy6d/options/option_12.py index 544cdaa..2d04b84 100644 --- a/dhcpy6d/options/option_12.py +++ b/dhcpy6d/options/option_12.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_13.py b/dhcpy6d/options/option_13.py index 4f05869..b8b7262 100644 --- a/dhcpy6d/options/option_13.py +++ b/dhcpy6d/options/option_13.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_14.py b/dhcpy6d/options/option_14.py index 30d17a8..458d23f 100644 --- a/dhcpy6d/options/option_14.py +++ b/dhcpy6d/options/option_14.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_15.py b/dhcpy6d/options/option_15.py index 6c94a62..89ac853 100644 --- a/dhcpy6d/options/option_15.py +++ b/dhcpy6d/options/option_15.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_16.py b/dhcpy6d/options/option_16.py index 1a6a6a6..788e34f 100644 --- a/dhcpy6d/options/option_16.py +++ b/dhcpy6d/options/option_16.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_23.py b/dhcpy6d/options/option_23.py index 310d82c..7eb45c8 100644 --- a/dhcpy6d/options/option_23.py +++ b/dhcpy6d/options/option_23.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_24.py b/dhcpy6d/options/option_24.py index 8e23af8..666169e 100644 --- a/dhcpy6d/options/option_24.py +++ b/dhcpy6d/options/option_24.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_25.py b/dhcpy6d/options/option_25.py index 5dfcecb..71575ad 100644 --- a/dhcpy6d/options/option_25.py +++ b/dhcpy6d/options/option_25.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_3.py b/dhcpy6d/options/option_3.py index 4f5c2be..7a07687 100644 --- a/dhcpy6d/options/option_3.py +++ b/dhcpy6d/options/option_3.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_31.py b/dhcpy6d/options/option_31.py index c1870dd..b9ec758 100644 --- a/dhcpy6d/options/option_31.py +++ b/dhcpy6d/options/option_31.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_32.py b/dhcpy6d/options/option_32.py index 796bdae..5b02635 100644 --- a/dhcpy6d/options/option_32.py +++ b/dhcpy6d/options/option_32.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_39.py b/dhcpy6d/options/option_39.py index ca12457..64eaf1b 100644 --- a/dhcpy6d/options/option_39.py +++ b/dhcpy6d/options/option_39.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_4.py b/dhcpy6d/options/option_4.py index b9fca1a..065dd7c 100644 --- a/dhcpy6d/options/option_4.py +++ b/dhcpy6d/options/option_4.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_56.py b/dhcpy6d/options/option_56.py index 0a4026c..dd4666c 100644 --- a/dhcpy6d/options/option_56.py +++ b/dhcpy6d/options/option_56.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_59.py b/dhcpy6d/options/option_59.py index ff71ebf..4a2c0af 100644 --- a/dhcpy6d/options/option_59.py +++ b/dhcpy6d/options/option_59.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_6.py b/dhcpy6d/options/option_6.py index b89453d..8fbcaa4 100644 --- a/dhcpy6d/options/option_6.py +++ b/dhcpy6d/options/option_6.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_61.py b/dhcpy6d/options/option_61.py index 652d592..c5f3ca1 100644 --- a/dhcpy6d/options/option_61.py +++ b/dhcpy6d/options/option_61.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_7.py b/dhcpy6d/options/option_7.py index 5727fc6..486e194 100644 --- a/dhcpy6d/options/option_7.py +++ b/dhcpy6d/options/option_7.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_8.py b/dhcpy6d/options/option_8.py index 3358624..7dda67c 100644 --- a/dhcpy6d/options/option_8.py +++ b/dhcpy6d/options/option_8.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/options/option_82.py b/dhcpy6d/options/option_82.py new file mode 100644 index 0000000..5b02635 --- /dev/null +++ b/dhcpy6d/options/option_82.py @@ -0,0 +1,30 @@ +# DHCPy6d DHCPv6 Daemon +# +# Copyright (C) 2009-2024 Henri Wahl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +from dhcpy6d.config import cfg +from dhcpy6d.options import OptionTemplate + + +class Option(OptionTemplate): + """ + Option 32 Information Refresh Time + """ + def build(self, **kwargs): + response_string_part = self.convert_to_string(self.number, f'{int(cfg.INFORMATION_REFRESH_TIME):08x}') + # options in answer to be logged + return response_string_part, self.number diff --git a/dhcpy6d/route.py b/dhcpy6d/route.py index bb2a531..bbbf271 100644 --- a/dhcpy6d/route.py +++ b/dhcpy6d/route.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/__init__.py b/dhcpy6d/storage/__init__.py index 5ce5fe3..d8de439 100644 --- a/dhcpy6d/storage/__init__.py +++ b/dhcpy6d/storage/__init__.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/mysql.py b/dhcpy6d/storage/mysql.py index 628a074..c716200 100644 --- a/dhcpy6d/storage/mysql.py +++ b/dhcpy6d/storage/mysql.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/postgresql.py b/dhcpy6d/storage/postgresql.py index 2097532..93e57fb 100644 --- a/dhcpy6d/storage/postgresql.py +++ b/dhcpy6d/storage/postgresql.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/schemas.py b/dhcpy6d/storage/schemas.py index 2601782..4cb15ca 100644 --- a/dhcpy6d/storage/schemas.py +++ b/dhcpy6d/storage/schemas.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/sqlite.py b/dhcpy6d/storage/sqlite.py index ea0693e..8da0bff 100644 --- a/dhcpy6d/storage/sqlite.py +++ b/dhcpy6d/storage/sqlite.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/store.py b/dhcpy6d/storage/store.py index c6529b3..4e09fb4 100644 --- a/dhcpy6d/storage/store.py +++ b/dhcpy6d/storage/store.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/storage/textfile.py b/dhcpy6d/storage/textfile.py index e136fa2..9473d01 100644 --- a/dhcpy6d/storage/textfile.py +++ b/dhcpy6d/storage/textfile.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/threads.py b/dhcpy6d/threads.py index 55d7cc7..d49507e 100644 --- a/dhcpy6d/threads.py +++ b/dhcpy6d/threads.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dhcpy6d/transaction.py b/dhcpy6d/transaction.py index e8d190b..edf71e7 100644 --- a/dhcpy6d/transaction.py +++ b/dhcpy6d/transaction.py @@ -1,6 +1,6 @@ # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/doc/dhcpy6d-clients.conf.rst b/doc/dhcpy6d-clients.conf.rst index 10e22f0..9f3a7d5 100644 --- a/doc/dhcpy6d-clients.conf.rst +++ b/doc/dhcpy6d-clients.conf.rst @@ -6,7 +6,7 @@ dhcpy6d-clients.conf Clients configuration file for DHCPv6 server dhcpy6d ---------------------------------------------------- -:Author: Copyright (C) 2012-2022 Henri Wahl +:Author: Copyright (C) 2012-2024 Henri Wahl :Date: 2022-06-14 :Version: 1.2.2 :Manual section: 5 diff --git a/doc/dhcpy6d.conf.rst b/doc/dhcpy6d.conf.rst index c756686..e3fedd2 100644 --- a/doc/dhcpy6d.conf.rst +++ b/doc/dhcpy6d.conf.rst @@ -6,7 +6,7 @@ dhcpy6d.conf Configuration file for DHCPv6 server dhcpy6d -------------------------------------------- -:Author: Copyright (C) 2012-2022 Henri Wahl +:Author: Copyright (C) 2012-2024 Henri Wahl :Date: 2022-06-14 :Version: 1.2.2 :Manual section: 5 diff --git a/doc/dhcpy6d.rst b/doc/dhcpy6d.rst index ab0fe4e..06b10df 100644 --- a/doc/dhcpy6d.rst +++ b/doc/dhcpy6d.rst @@ -6,7 +6,7 @@ dhcpy6d MAC address aware DHCPv6 server ---------------------------------------------------------------- -:Author: Copyright (C) 2012-2022 Henri Wahl +:Author: Copyright (C) 2012-2024 Henri Wahl :Date: 2022-06-14 :Version: 1.2.2 :Manual section: 8 diff --git a/main.py b/main.py index 6cd93f1..f2918b6 100755 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ # # DHCPy6d DHCPv6 Daemon # -# Copyright (C) 2009-2022 Henri Wahl +# Copyright (C) 2009-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/man/man5/dhcpy6d-clients.conf.5 b/man/man5/dhcpy6d-clients.conf.5 index a077c6c..fa09f3a 100644 --- a/man/man5/dhcpy6d-clients.conf.5 +++ b/man/man5/dhcpy6d-clients.conf.5 @@ -177,7 +177,7 @@ dhcpy6d.conf(5) \fI\%https://github.com/HenriWahl/dhcpy6d\fP .UNINDENT .SH AUTHOR -Copyright (C) 2012-2022 Henri Wahl +Copyright (C) 2012-2024 Henri Wahl .SH COPYRIGHT This manual page is licensed under the GPL-2 license. .\" Generated by docutils manpage writer. diff --git a/man/man5/dhcpy6d.conf.5 b/man/man5/dhcpy6d.conf.5 index ff8d9c4..b4e68e3 100644 --- a/man/man5/dhcpy6d.conf.5 +++ b/man/man5/dhcpy6d.conf.5 @@ -1215,7 +1215,7 @@ dhcpy6d\-clients.conf(5) \fI\%https://github.com/HenriWahl/dhcpy6d\fP .UNINDENT .SH AUTHOR -Copyright (C) 2012-2022 Henri Wahl +Copyright (C) 2012-2024 Henri Wahl .SH COPYRIGHT This manual page is licensed under the GPL-2 license. .\" Generated by docutils manpage writer. diff --git a/man/man8/dhcpy6d.8 b/man/man8/dhcpy6d.8 index f6d7337..26a5bd5 100644 --- a/man/man8/dhcpy6d.8 +++ b/man/man8/dhcpy6d.8 @@ -143,7 +143,7 @@ dhcpy6d\-clients.conf(5) \fI\%https://github.com/HenriWahl/dhcpy6d\fP .UNINDENT .SH AUTHOR -Copyright (C) 2012-2022 Henri Wahl +Copyright (C) 2012-2024 Henri Wahl .SH COPYRIGHT This manual page is licensed under the GPL-2 license. .\" Generated by docutils manpage writer. diff --git a/setup.py b/setup.py index d52f9c8..fd1ccf5 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # dhcpy6d - DHCPv6 server -# Copyright (C) 2012-2022 Henri Wahl +# Copyright (C) 2012-2024 Henri Wahl # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ ] setup(name='dhcpy6d', - version='1.4.0', + version='1.5.0', license='GNU GPL v2', description='DHCPv6 server daemon', long_description='Dhcpy6d delivers IPv6 addresses for DHCPv6 clients, which can be identified by DUID, hostname or MAC address as in the good old IPv4 days. It allows easy dualstack transition, addresses may be generated randomly, by range, by DNS, by arbitrary ID or MAC address. Clients can get more than one address, leases and client configuration can be stored in databases and DNS can be updated dynamically.', From 4a2613b58d9d5a88e1842bf0049f32c68fb4478f Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Mon, 27 May 2024 23:37:55 +0200 Subject: [PATCH 02/10] fix and add some constants.py --- dhcpy6d/constants.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dhcpy6d/constants.py b/dhcpy6d/constants.py index be1503f..405ecbb 100644 --- a/dhcpy6d/constants.py +++ b/dhcpy6d/constants.py @@ -92,8 +92,10 @@ 57: 'V6_ACCESS_DOMAIN', 58: 'SIP_UA_CS_LIST', 59: 'BOOTFILE_URL', - 60: 'OPT_BOOTFILE_PARAM', - 61: 'OPTION_CLIENT_ARCH_TYPE' + 60: 'BOOTFILE_PARAM', + 61: 'CLIENT_ARCH_TYPE', + 82: 'SOL_MAX_RT', + 83: 'INF_MAX_RT' } STATUS = {0: 'Success', From ac345cb03165b4d4f84b1f2dbc7a04fb8b727eae Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Mon, 27 May 2024 23:55:12 +0200 Subject: [PATCH 03/10] added MAX_SOLICITATION_REFRESH_TIME --- dhcpy6d/config.py | 13 ++++++++++++- dhcpy6d/options/option_82.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dhcpy6d/config.py b/dhcpy6d/config.py index 9881e65..b5ce0ef 100644 --- a/dhcpy6d/config.py +++ b/dhcpy6d/config.py @@ -121,7 +121,11 @@ def __init__(self): # INFORMATION REFRESH TIME option 32 for option 11 (INFORMATION REQUEST) # see RFC http://tools.ietf.org/html/rfc4242 - self.INFORMATION_REFRESH_TIME = '6000' + self.INFORMATION_REFRESH_TIME = '600' + + # SOL_MAX_RT Option 82 + # see https://www.rfc-editor.org/rfc/rfc8415.html#page-127 + self.MAX_SOLICITATION_REFRESH_TIME = '1200' # config type # one of file, mysql, sqlite or none @@ -727,6 +731,13 @@ def read_config(self, configfile): error_exit(f"{msg_prefix} Information refresh time preference " f"'{self.INFORMATION_REFRESH_TIME}' is pretty short.") + # check max solicitation refresh time + if not self.MAX_SOLICITATION_REFRESH_TIME.isdigit(): + error_exit(f"{msg_prefix} Max solicitation refresh time '{self.MAX_SOLICITATION_REFRESH_TIME}' is invalid.") + elif not 60 <= int(self.MAX_SOLICITATION_REFRESH_TIME) <= 86400: + error_exit(f"{msg_prefix} Max solicitation refresh time preference " + f"'{self.MAX_SOLICITATION_REFRESH_TIME}' is not greater or equal to 60 and neither smaller or equal to 86400.") + # check validity of configuration source if self.STORE_CONFIG not in ['mysql', 'postgresql', 'sqlite', 'file', False]: error_exit(f"{msg_prefix} Unknown config storage type '{self.STORAGE}' is invalid.") diff --git a/dhcpy6d/options/option_82.py b/dhcpy6d/options/option_82.py index 5b02635..c5ce0c1 100644 --- a/dhcpy6d/options/option_82.py +++ b/dhcpy6d/options/option_82.py @@ -25,6 +25,6 @@ class Option(OptionTemplate): Option 32 Information Refresh Time """ def build(self, **kwargs): - response_string_part = self.convert_to_string(self.number, f'{int(cfg.INFORMATION_REFRESH_TIME):08x}') + response_string_part = self.convert_to_string(self.number, f'{int(cfg.MAX_SOLICITATION_REFRESH_TIME):08x}') # options in answer to be logged return response_string_part, self.number From f50da5e2feca9e4018ba9a361e2eca229e16bb81 Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Tue, 28 May 2024 00:00:50 +0200 Subject: [PATCH 04/10] debian 1.5.0 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8d84a21..5dd2687 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dhcpy6d (1.5.0-1) unstable; urgency=medium + + * New upstream release + + -- Henri Wahl Tue, 28 May 2024 00:00:00 +0200 + dhcpy6d (1.4.0-1) stable; urgency=medium * New upstream release From 7300c231745702516a6c87435648d232d6ade57d Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Tue, 28 May 2024 08:00:02 +0200 Subject: [PATCH 05/10] no repo releases --- .github/workflows/build-release-latest.yml | 136 ++++++++++----------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build-release-latest.yml b/.github/workflows/build-release-latest.yml index 0d16225..d08f8f8 100644 --- a/.github/workflows/build-release-latest.yml +++ b/.github/workflows/build-release-latest.yml @@ -55,74 +55,74 @@ jobs: path: ./*.rpm retention-days: 1 - repo-debian: - runs-on: ubuntu-latest - needs: [build-debian] - env: - dist: debian - steps: - - uses: actions/checkout@v2 - # get binaries created by other jobs - - uses: actions/download-artifact@v2 - # build container image for repo packaging, using the same as for building - - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . - # make entrypoints executable - - run: chmod +x build/entrypoint-*.sh - # get secret signing key - - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc - # organize SSH deploy key for dhcp6d-jekyll repo - - run: mkdir ~/.ssh - - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 - - run: chmod -R go-rwx ~/.ssh - # get and prepare dhcpy6d-jekyll - - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git - - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} - - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} - # execute container with matching entrypoint - - run: | - /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ - --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ - --entrypoint /entrypoint.sh \ - --env RELEASE=${{ env.release }} \ - ${{ github.job }} - # commit and push new binaries to dhcpyd-jekyll - - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" - - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push - - repo-centos: - runs-on: ubuntu-latest - # has to wait for repo-debian to avoid parallel processing of git repo dhcpy6d-jekyll - needs: [build-centos, repo-debian] - env: - dist: centos - steps: - - uses: actions/checkout@v2 - # get binaries created by other jobs - - uses: actions/download-artifact@v2 - # build container image for repo packaging, using the same as for building - - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . - # make entrypoints executable - - run: chmod +x build/entrypoint-*.sh - # get secret signing key - - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc - # organize SSH deploy key for dhcp6d-jekyll repo - - run: mkdir ~/.ssh - - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 - - run: chmod -R go-rwx ~/.ssh - # get and prepare dhcpy6d-jekyll - - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git - - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} - - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} - # execute container with matching entrypoint - - run: | - /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ - --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ - --entrypoint /entrypoint.sh \ - --env RELEASE=${{ env.release }} \ - ${{ github.job }} - # commit and push new binaries to dhcpyd-jekyll - - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" - - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push +# repo-debian: +# runs-on: ubuntu-latest +# needs: [build-debian] +# env: +# dist: debian +# steps: +# - uses: actions/checkout@v2 +# # get binaries created by other jobs +# - uses: actions/download-artifact@v2 +# # build container image for repo packaging, using the same as for building +# - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . +# # make entrypoints executable +# - run: chmod +x build/entrypoint-*.sh +# # get secret signing key +# - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc +# # organize SSH deploy key for dhcp6d-jekyll repo +# - run: mkdir ~/.ssh +# - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 +# - run: chmod -R go-rwx ~/.ssh +# # get and prepare dhcpy6d-jekyll +# - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git +# - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} +# - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} +# # execute container with matching entrypoint +# - run: | +# /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ +# --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ +# --entrypoint /entrypoint.sh \ +# --env RELEASE=${{ env.release }} \ +# ${{ github.job }} +# # commit and push new binaries to dhcpyd-jekyll +# - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" +# - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push +# +# repo-centos: +# runs-on: ubuntu-latest +# # has to wait for repo-debian to avoid parallel processing of git repo dhcpy6d-jekyll +# needs: [build-centos, repo-debian] +# env: +# dist: centos +# steps: +# - uses: actions/checkout@v2 +# # get binaries created by other jobs +# - uses: actions/download-artifact@v2 +# # build container image for repo packaging, using the same as for building +# - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . +# # make entrypoints executable +# - run: chmod +x build/entrypoint-*.sh +# # get secret signing key +# - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc +# # organize SSH deploy key for dhcp6d-jekyll repo +# - run: mkdir ~/.ssh +# - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 +# - run: chmod -R go-rwx ~/.ssh +# # get and prepare dhcpy6d-jekyll +# - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git +# - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} +# - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} +# # execute container with matching entrypoint +# - run: | +# /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ +# --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ +# --entrypoint /entrypoint.sh \ +# --env RELEASE=${{ env.release }} \ +# ${{ github.job }} +# # commit and push new binaries to dhcpyd-jekyll +# - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" +# - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push github-release: runs-on: ubuntu-latest From c705bffc4407ef89ff7c694cebcf3ea76ee623d1 Mon Sep 17 00:00:00 2001 From: Henri Wahl Date: Wed, 29 May 2024 19:17:22 +0200 Subject: [PATCH 06/10] added option 20 --- dhcpy6d/handler.py | 4 ++++ dhcpy6d/options/option_20.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 dhcpy6d/options/option_20.py diff --git a/dhcpy6d/handler.py b/dhcpy6d/handler.py index 0661131..707b245 100644 --- a/dhcpy6d/handler.py +++ b/dhcpy6d/handler.py @@ -497,6 +497,10 @@ def build_response(self, message_type_response, transaction, options_request, st # Option 13 Status Code Option - statuscode is 2: 'No Addresses available' response_string += build_option(CONST.OPTION.STATUS_CODE, f'{CONST.STATUS.NO_ADDRESSES_AVAILABLE:04x}') + + # just a test for https://github.com/HenriWahl/dhcpy6d/issues/64 + response_string += build_option(CONST.OPTION.RECONF_ACCEPT) + # options in answer to be logged options_answer.append(CONST.OPTION.STATUS_CODE) diff --git a/dhcpy6d/options/option_20.py b/dhcpy6d/options/option_20.py new file mode 100644 index 0000000..160142c --- /dev/null +++ b/dhcpy6d/options/option_20.py @@ -0,0 +1,30 @@ +# DHCPy6d DHCPv6 Daemon +# +# Copyright (C) 2009-2024 Henri Wahl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +from dhcpy6d.config import cfg +from dhcpy6d.options import OptionTemplate + + +class Option(OptionTemplate): + """ + Option 20 Reconfigure Accept + """ + def build(self, **kwargs): + response_string_part = self.convert_to_string(self.number, '') + # options in answer to be logged + return response_string_part, self.number From 2082f839ef1a1ad8ec06942313674c21ca8b54ff Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:09:46 +0200 Subject: [PATCH 07/10] setDaemon -> daemon --- dhcpy6d/storage/__init__.py | 2 +- dhcpy6d/threads.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dhcpy6d/storage/__init__.py b/dhcpy6d/storage/__init__.py index d8de439..782d61e 100644 --- a/dhcpy6d/storage/__init__.py +++ b/dhcpy6d/storage/__init__.py @@ -47,7 +47,7 @@ def __init__(self, name='', store_type=None, query_queue=None, answer_queue=None self.query_queue = query_queue self.answer_queue = answer_queue self.store = store_type - self.setDaemon(True) + self.daemon = True def run(self): """ diff --git a/dhcpy6d/threads.py b/dhcpy6d/threads.py index d49507e..8a7bf92 100644 --- a/dhcpy6d/threads.py +++ b/dhcpy6d/threads.py @@ -49,7 +49,7 @@ class DNSQueryThread(Thread): def __init__(self): Thread.__init__(self, name='DNSQuery') - self.setDaemon(True) + self.daemon = True def run(self): # wait for new queries in queue until the end of the world @@ -99,7 +99,7 @@ class TidyUpThread(Thread): def __init__(self): Thread.__init__(self, name='TidyUp') - self.setDaemon(True) + self.daemon = True def run(self): try: @@ -196,7 +196,7 @@ class RouteThread(Thread): def __init__(self, route_queue): Thread.__init__(self, name='Route') - self.setDaemon(True) + self.daemon = True self.route_queue = route_queue def run(self): @@ -230,7 +230,7 @@ class TimerThread(Thread): def __init__(self): Thread.__init__(self, name='Timer') - self.setDaemon(True) + self.daemon = True def run(self): while True: From ad7c72df4591c79e73be2e7d1917572335f341de Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:34:59 +0200 Subject: [PATCH 08/10] added option 20 for testing again --- dhcpy6d/config.py | 10 +++++----- dhcpy6d/handler.py | 7 ++++--- dhcpy6d/options/option_20.py | 2 +- dhcpy6d/options/option_82.py | 4 ++-- dhcpy6d/options/option_83.py | 30 ++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 dhcpy6d/options/option_83.py diff --git a/dhcpy6d/config.py b/dhcpy6d/config.py index b5ce0ef..d8d0ec8 100644 --- a/dhcpy6d/config.py +++ b/dhcpy6d/config.py @@ -125,7 +125,7 @@ def __init__(self): # SOL_MAX_RT Option 82 # see https://www.rfc-editor.org/rfc/rfc8415.html#page-127 - self.MAX_SOLICITATION_REFRESH_TIME = '1200' + self.SOLICITATION_REFRESH_TIME = '1200' # config type # one of file, mysql, sqlite or none @@ -732,11 +732,11 @@ def read_config(self, configfile): f"'{self.INFORMATION_REFRESH_TIME}' is pretty short.") # check max solicitation refresh time - if not self.MAX_SOLICITATION_REFRESH_TIME.isdigit(): - error_exit(f"{msg_prefix} Max solicitation refresh time '{self.MAX_SOLICITATION_REFRESH_TIME}' is invalid.") - elif not 60 <= int(self.MAX_SOLICITATION_REFRESH_TIME) <= 86400: + if not self.SOLICITATION_REFRESH_TIME.isdigit(): + error_exit(f"{msg_prefix} Max solicitation refresh time '{self.SOLICITATION_REFRESH_TIME}' is invalid.") + elif not 60 <= int(self.SOLICITATION_REFRESH_TIME) <= 86400: error_exit(f"{msg_prefix} Max solicitation refresh time preference " - f"'{self.MAX_SOLICITATION_REFRESH_TIME}' is not greater or equal to 60 and neither smaller or equal to 86400.") + f"'{self.SOLICITATION_REFRESH_TIME}' is not greater or equal to 60 and neither smaller or equal to 86400.") # check validity of configuration source if self.STORE_CONFIG not in ['mysql', 'postgresql', 'sqlite', 'file', False]: diff --git a/dhcpy6d/handler.py b/dhcpy6d/handler.py index 707b245..bfc2468 100644 --- a/dhcpy6d/handler.py +++ b/dhcpy6d/handler.py @@ -498,9 +498,6 @@ def build_response(self, message_type_response, transaction, options_request, st response_string += build_option(CONST.OPTION.STATUS_CODE, f'{CONST.STATUS.NO_ADDRESSES_AVAILABLE:04x}') - # just a test for https://github.com/HenriWahl/dhcpy6d/issues/64 - response_string += build_option(CONST.OPTION.RECONF_ACCEPT) - # options in answer to be logged options_answer.append(CONST.OPTION.STATUS_CODE) @@ -525,6 +522,10 @@ def build_response(self, message_type_response, transaction, options_request, st log.info(f'{CONST.MESSAGE_DICT[message_type_response]} | ' f'transaction: {transaction.id} | ' f'options: {options_answer}') + + # just a test for https://github.com/HenriWahl/dhcpy6d/issues/64 + response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '') + # handler self.response = binascii.unhexlify(response_string) diff --git a/dhcpy6d/options/option_20.py b/dhcpy6d/options/option_20.py index 160142c..7b93b62 100644 --- a/dhcpy6d/options/option_20.py +++ b/dhcpy6d/options/option_20.py @@ -27,4 +27,4 @@ class Option(OptionTemplate): def build(self, **kwargs): response_string_part = self.convert_to_string(self.number, '') # options in answer to be logged - return response_string_part, self.number + return response_string_part, self.number \ No newline at end of file diff --git a/dhcpy6d/options/option_82.py b/dhcpy6d/options/option_82.py index c5ce0c1..de1884a 100644 --- a/dhcpy6d/options/option_82.py +++ b/dhcpy6d/options/option_82.py @@ -22,9 +22,9 @@ class Option(OptionTemplate): """ - Option 32 Information Refresh Time + Option 82 SOL_MAX_RT (sic!) """ def build(self, **kwargs): - response_string_part = self.convert_to_string(self.number, f'{int(cfg.MAX_SOLICITATION_REFRESH_TIME):08x}') + response_string_part = self.convert_to_string(self.number, f'{int(cfg.SOLICITATION_REFRESH_TIME):08x}') # options in answer to be logged return response_string_part, self.number diff --git a/dhcpy6d/options/option_83.py b/dhcpy6d/options/option_83.py new file mode 100644 index 0000000..5500da8 --- /dev/null +++ b/dhcpy6d/options/option_83.py @@ -0,0 +1,30 @@ +# DHCPy6d DHCPv6 Daemon +# +# Copyright (C) 2009-2024 Henri Wahl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +from dhcpy6d.config import cfg +from dhcpy6d.options import OptionTemplate + + +class Option(OptionTemplate): + """ + Option 83 INF_MAX_RT (sic!) + """ + def build(self, **kwargs): + response_string_part = self.convert_to_string(self.number, f'{int(cfg.INFORMATION_REFRESH_TIME):08x}') + # options in answer to be logged + return response_string_part, self.number From 6085fc361645b2a7a7b88197040058fbf7641f45 Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:52:52 +0200 Subject: [PATCH 09/10] some refactoring, some docs --- dhcpy6d/globals.py | 2 +- dhcpy6d/handler.py | 10 +++++++--- dhcpy6d/options/option_39.py | 2 +- dhcpy6d/transaction.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dhcpy6d/globals.py b/dhcpy6d/globals.py index 070744a..8a1fe22 100644 --- a/dhcpy6d/globals.py +++ b/dhcpy6d/globals.py @@ -126,7 +126,7 @@ def time(self, new_time): CONST.OPTION.IA_PD) # options to be ignored when logging -IGNORED_LOG_OPTIONS = ['options_raw', 'client', 'client_config_dicts', 'timestamp', 'iat1', 'iat2', 'id'] +IGNORED_LOG_OPTIONS = ['options', 'client', 'client_config_dicts', 'timestamp', 'iat1', 'iat2', 'id'] # empty options string test EMPTY_OPTIONS = [None, False, '', []] diff --git a/dhcpy6d/handler.py b/dhcpy6d/handler.py index bfc2468..22432f3 100644 --- a/dhcpy6d/handler.py +++ b/dhcpy6d/handler.py @@ -421,6 +421,13 @@ def build_response(self, message_type_response, transaction, options_request, st # list of options in answer to be logged options_answer = [] + # Option 20 reconfigure accept - for client compatibility, actually + # not really supported + # https://github.com/HenriWahl/dhcpy6d/issues/64 + if CONST.OPTION.RECONF_ACCEPT in transaction.options.keys(): + response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '') + options_answer.append(CONST.OPTION.RECONF_ACCEPT) + # build all requested options if they are handled for number in options_request: if number in OPTIONS: @@ -523,9 +530,6 @@ def build_response(self, message_type_response, transaction, options_request, st f'transaction: {transaction.id} | ' f'options: {options_answer}') - # just a test for https://github.com/HenriWahl/dhcpy6d/issues/64 - response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '') - # handler self.response = binascii.unhexlify(response_string) diff --git a/dhcpy6d/options/option_39.py b/dhcpy6d/options/option_39.py index 64eaf1b..c318216 100644 --- a/dhcpy6d/options/option_39.py +++ b/dhcpy6d/options/option_39.py @@ -32,7 +32,7 @@ class Option(OptionTemplate): regarding RFC 4704 5. there are 3 kinds of client behaviour for N O S: - client wants to update DNS itself -> sends 0 0 0 - client wants server to update DNS -> sends 0 0 1 - - client wants no server DNS update -> sends 1 0 0 + - client wants no server DNS update -> sends 1 0 0 """ def build(self, transaction=None, **kwargs): diff --git a/dhcpy6d/transaction.py b/dhcpy6d/transaction.py index edf71e7..7561072 100644 --- a/dhcpy6d/transaction.py +++ b/dhcpy6d/transaction.py @@ -45,7 +45,7 @@ def __init__(self, transaction_id, client_llip, interface, message_type, options # last message for following the protocol self.last_message_received_type = message_type # dictionary for options - self.options_raw = options + self.options = options # default dummy OptionsRequest self.options_request = list() # timestamp to manage/clean transactions From 016a6ac85853fd842b8153b02a69a6dbbb46afb4 Mon Sep 17 00:00:00 2001 From: hw-iu <171809906+hw-iu@users.noreply.github.com> Date: Sat, 27 Jul 2024 11:22:05 +0200 Subject: [PATCH 10/10] prepare 1.6.0 --- .github/workflows/build-release-latest.yml | 69 ---------------------- Changelog | 6 ++ debian/changelog | 7 ++- dhcpy6d/handler.py | 10 ++-- setup.py | 2 +- 5 files changed, 17 insertions(+), 77 deletions(-) diff --git a/.github/workflows/build-release-latest.yml b/.github/workflows/build-release-latest.yml index d08f8f8..9f26b5d 100644 --- a/.github/workflows/build-release-latest.yml +++ b/.github/workflows/build-release-latest.yml @@ -55,75 +55,6 @@ jobs: path: ./*.rpm retention-days: 1 -# repo-debian: -# runs-on: ubuntu-latest -# needs: [build-debian] -# env: -# dist: debian -# steps: -# - uses: actions/checkout@v2 -# # get binaries created by other jobs -# - uses: actions/download-artifact@v2 -# # build container image for repo packaging, using the same as for building -# - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . -# # make entrypoints executable -# - run: chmod +x build/entrypoint-*.sh -# # get secret signing key -# - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc -# # organize SSH deploy key for dhcp6d-jekyll repo -# - run: mkdir ~/.ssh -# - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 -# - run: chmod -R go-rwx ~/.ssh -# # get and prepare dhcpy6d-jekyll -# - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git -# - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} -# - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} -# # execute container with matching entrypoint -# - run: | -# /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ -# --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ -# --entrypoint /entrypoint.sh \ -# --env RELEASE=${{ env.release }} \ -# ${{ github.job }} -# # commit and push new binaries to dhcpyd-jekyll -# - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" -# - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push -# -# repo-centos: -# runs-on: ubuntu-latest -# # has to wait for repo-debian to avoid parallel processing of git repo dhcpy6d-jekyll -# needs: [build-centos, repo-debian] -# env: -# dist: centos -# steps: -# - uses: actions/checkout@v2 -# # get binaries created by other jobs -# - uses: actions/download-artifact@v2 -# # build container image for repo packaging, using the same as for building -# - run: /usr/bin/docker build -t ${{ github.job }} -f build/Dockerfile-${{ env.dist }} . -# # make entrypoints executable -# - run: chmod +x build/entrypoint-*.sh -# # get secret signing key -# - run: echo "${{ secrets.DHCPY6D_SIGNING_KEY }}" > signing_key.asc -# # organize SSH deploy key for dhcp6d-jekyll repo -# - run: mkdir ~/.ssh -# - run: echo "${{ secrets.DHCPY6D_REPO_SSH_KEY }}" > ~/.ssh/id_ed25519 -# - run: chmod -R go-rwx ~/.ssh -# # get and prepare dhcpy6d-jekyll -# - run: git clone git@github.com:HenriWahl/dhcpy6d-jekyll.git -# - run: rm -rf ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} -# - run: mkdir -p ${{ env.repo_dir }}/${{ env.release }}/${{ env.dist }} -# # execute container with matching entrypoint -# - run: | -# /usr/bin/docker run --volume ${{ github.workspace }}:/dhcpy6d \ -# --volume ${{ github.workspace }}/build/entrypoint-${{ github.job }}.sh:/entrypoint.sh \ -# --entrypoint /entrypoint.sh \ -# --env RELEASE=${{ env.release }} \ -# ${{ github.job }} -# # commit and push new binaries to dhcpyd-jekyll -# - run: git config --global user.email "repo@dhcpy6d.de" && git config --global user.name "Dhcpy6d Repository" -# - run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.dist }}" && git push - github-release: runs-on: ubuntu-latest needs: [build-debian, build-centos] diff --git a/Changelog b/Changelog index b3083cd..153438a 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,11 @@ Changelog for dhcpy6d +2023-07-02 1.6.0 + + added option 82 support + added option 83 support + added partly option 20 support + 2023-07-02 1.4.0 added prefix_route_link_local for client config diff --git a/debian/changelog b/debian/changelog index 5dd2687..d5b9061 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ -dhcpy6d (1.5.0-1) unstable; urgency=medium +dhcpy6d (1.6.0-1) stable; urgency=medium * New upstream release + + added option 82 support + + added option 83 support + + added partly option 20 support - -- Henri Wahl Tue, 28 May 2024 00:00:00 +0200 + -- Henri Wahl Sat, 27 Jul 2024 00:00:00 +0200 dhcpy6d (1.4.0-1) stable; urgency=medium diff --git a/dhcpy6d/handler.py b/dhcpy6d/handler.py index 22432f3..9aeb124 100644 --- a/dhcpy6d/handler.py +++ b/dhcpy6d/handler.py @@ -422,11 +422,11 @@ def build_response(self, message_type_response, transaction, options_request, st options_answer = [] # Option 20 reconfigure accept - for client compatibility, actually - # not really supported + # not really supported, added here to add to options # https://github.com/HenriWahl/dhcpy6d/issues/64 - if CONST.OPTION.RECONF_ACCEPT in transaction.options.keys(): - response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '') - options_answer.append(CONST.OPTION.RECONF_ACCEPT) + if CONST.OPTION.RECONF_ACCEPT in transaction.options.keys() and \ + not CONST.OPTION.RECONF_ACCEPT in options_request: + options_request.append(CONST.OPTION.RECONF_ACCEPT) # build all requested options if they are handled for number in options_request: @@ -454,7 +454,7 @@ def build_response(self, message_type_response, transaction, options_request, st volatile_store.db_connect() # create error handler - headers have to be recreated because - # problems may have arisen while processing and these information + # problems may have arisen while processing and this information # is not valid anymore # handler type + transaction id response_string = f'{CONST.MESSAGE.REPLY:02x}' diff --git a/setup.py b/setup.py index fd1ccf5..48cd916 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ ] setup(name='dhcpy6d', - version='1.5.0', + version='1.6.0', license='GNU GPL v2', description='DHCPv6 server daemon', long_description='Dhcpy6d delivers IPv6 addresses for DHCPv6 clients, which can be identified by DUID, hostname or MAC address as in the good old IPv4 days. It allows easy dualstack transition, addresses may be generated randomly, by range, by DNS, by arbitrary ID or MAC address. Clients can get more than one address, leases and client configuration can be stored in databases and DNS can be updated dynamically.',