summaryrefslogtreecommitdiff
path: root/src/conf_mode/dhcp_server.py
AgeCommit message (Collapse)Author
2021-09-19dhcp-server: T1968: allow multiple static-routes to be configuredChristian Poessinger
vyos@vyos# show service dhcp-server shared-network-name LAN { subnet 10.0.0.0/24 { default-router 10.0.0.1 dns-server 194.145.150.1 lease 88 range 0 { start 10.0.0.100 stop 10.0.0.200 } static-route 192.168.10.0/24 { next-hop 10.0.0.2 } static-route 192.168.20.0/24 { router 10.0.0.2 } } } (cherry picked from commit a4440bd589db645eb99f343a8163e188a700774c)
2021-05-27dhcp-server: T2669: do not allow overlapping ranges to be createdChristian Poessinger
set service dhcp-server shared-network-name NET01 authoritative set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 default-router '10.0.0.1' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 lease '86400' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG01 start '10.0.0.60' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG01 stop '10.0.0.70' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG02 start '10.0.0.55' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG02 stop '10.0.0.65' Will result in a dhcpd.conf: shared-network NET01 { authoritative; subnet 10.0.0.0 netmask 255.255.255.0 { option routers 10.0.0.1; default-lease-time 86400; max-lease-time 86400; range 10.0.0.60 10.0.0.70; range 10.0.0.55 10.0.0.65; } on commit { set shared-networkname = "NET01"; } } This is not allowed by ISC DHCPd: dhcpd[3307]: /run/dhcp-server/dhcpd.conf line 25: lease 10.0.0.63 is declared twice! dhcpd[3307]: range 10.0.0.55 10.0.0.65; (cherry picked from commit b0e1c8a9c9ef470297bf3c9f5059ad7c720c46ff)
2021-05-15dhcp-server: T3544: fix FileNotFoundError on first invokationChristian Poessinger
The problem of using the move() operation over render() is that render will silently create the directory tree in the background and move() does not. This means that on first boot when /run/dhcp-server does not exist, move will fail with a FileNotFoundError. Instead of using move() we render() the configuration two times, one for validating it via dhcpd -t and the other time to really apply it to the service. The performance impact should be little as the config should still be cached in the system RAM. (cherry picked from commit 1f68b69328c961e450ac70b12f7bf073d70355d7)
2021-05-15dhcp-server: T3544: test config in IPv4 mode onlyChristian Poessinger
(cherry picked from commit 37f3ead353625b53cfa8953196a9c32b42a10e7f)
2021-05-13dhcp-server: T3544: test newly rendered configuration before restarting daemonChristian Poessinger
The current DHCP server implementation comes with options (see below) which allow the user to pass in any arbitrary option(s) in a verbatim way which will manifest in dhcpd.conf. The options are: * set service dhcp-server global-parameters * set service dhcp-server shared-network-name foo shared-network-parameters * set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 subnet-parameters * set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 static-mapping ff static-mapping-parameters Having an invalid configuration will yield: vyos@vyos# commit [ service dhcp-server ] Configuration file errors encountered - check your options! [[service dhcp-server]] failed (cherry picked from commit 3c754695590b9d9e582c10e6d05c2b628e79262c)
2021-01-03dhcp: T2562: harden implementation for non existing shared-subnetsChristian Poessinger
2021-01-03dhcp: T3180: bugfix assignment of sliced ranges to config dictChristian Poessinger
A reference to a dictionary key obtained by a for loop can not be used to update values inside that dictionaries key. You must use the original path to the nested dictionaries key.
2021-01-03dhcp: T3180: bugfix NameError when slicing server rangesChristian Poessinger
Introduced in commit e46def834483e ("dhcp: T3100: re-add range slicing support when exclude addresses are used") by not obeying the move from list to dict and still relying on the old list names variables.
2020-12-06dhcp: T2562: add "listen-address" CLI node for better DHCP relay supportChristian Poessinger
Running ISC DHCP server as backend server for multiple pools served to relay agents requires DHCPd to explicitly listen on give interfaces or a "transit" subnet declaration facing the network where we receive the DHCPREQ messages on. This implements a new "listen-address" CLI node, the given address is validated if it is assigned to the system and upon success, a proper "subnet { }" statement is added into dhcpd.conf
2020-12-04dhcp: T3100: re-add range slicing support when exclude addresses are usedChristian Poessinger
Support was not yet present after the rewrite from commit 84b7ade2 ("dhcp: T3100: migrate server configuration to get_config_dict()")
2020-12-04dhcp: T3100: migrate server configuration to get_config_dict()Christian Poessinger
2020-08-31configd: T2582: add scripts to include list for daemonJohn Estabrook
2020-05-29airbag: T2088: explicit enabling of the featureThomas Mangin
airbag must now be explicitly installed. the patch also allow to fully disables the installation of the logging code at setup (and not just installing and doing nothing)
2020-04-27template: T2388: move mkdir/chmod/chown within render()Thomas Mangin
2020-04-12dhcp-server: T2185: add comment on config dir generationChristian Poessinger
2020-04-12dhcp-server: T2185: create directories in /run on-demandChristian Poessinger
Commit bc68244 ("dhcp-server: T2185: migrate from SysVinit to systemd") migrated the DHCP subsystem to systemd, necessary directories in the volatile /run directory have not been created.
2020-04-12dhcp-server: T2185: fixup ConditionPathExists variableChristian Poessinger
Commit bc68244 ("dhcp-server: T2185: migrate from SysVinit to systemd") migrated the DHCP subsystem to systemd, but on the test-system there was still the old configuration file present not triggering this condition.
2020-04-12dhcp-server: T2185: migrate from SysVinit to systemdChristian Poessinger
2020-04-12template: T2230: use render to generate templatesThomas Mangin
convert all call to jinja to use template.render
2020-04-09util: T2226: os.system was wrongly converted to runThomas Mangin
os.system does print the ouput of the command, run() does not. A new function called call() does the printing and return the error code.
2020-04-06util: T2226: covert most calls from os.system to utilThomas Mangin
As little change a possible but the function call The behaviour should be totally unchanged.
2020-04-05dhcp-server: T2230: rename template dir from dhcp -> dhcp-serverChristian Poessinger
2020-04-05dhcp: T2230: move inlined templates to dedicated filesChristian Poessinger
2020-03-03dhcp-server: T2092: add default route to rfc3442-static-route optionAndras Elso
2020-03-03dhcp-server: T2062: Fix static route bytesAndras Elso
2019-12-13T1873: DHCP: ship our own server init scriptsJernej Jakob
2019-11-28dhcp-serverr: T1825: replaced DHCP configuration error messagezdc
Previous one DHCP configuration error message does not point that DHCP server work only with primary IP address on interface.
2019-10-19dhcp-server: T1745: bugfix corner case on static-assignmentsChristian Poessinger
There was a bug when refactoring this with commits 5848a4d ("dhcp-server: T1707: remove DHCP static-mappings from address pool") and 1182b44 ("dhcp-server: T1707: bugfix on subsequent DHCP exclude addresses") that when a static address assignemnt was using the last IP address from the specified range. This triggered the following error: "DHCP range stop address x must be greater or equal to the range start address y!"
2019-10-03dhcp-server: T1707: remove DHCP static-mappings from address poolChristian Poessinger
Previously when static-mappings have been created the address was still within the DHCP pool resulting in log entries as follows: dhcpd: Dynamic and static leases present for 192.0.2.51 dhcpd: Remove host declaration DMZ_PC2 or remove 192.0.2.51 dhcpd: from the dynamic address pool for DMZ (cherry picked from commit 6f954ab56768af9a07d8a1dc086f54ddefa58da7)
2019-10-03dhcp-server: only import ip_address and ip_network from ipaddress classChristian Poessinger
(cherry picked from commit bdf890cca40157b3f2a2386685e043e0fa220fac)
2019-10-03dhcp-server: T1707: bugfix on subsequent DHCP exclude addressesChristian Poessinger
Moved the code for splicing a DHCP range into its dedicated function as this will later be required again. Having subsequent DHCP exclude addresses e.g. 192.0.2.70 and 192.0.2.71 did not work as the previous algorithm created a range whose start address was after the end address. (cherry picked from commit 0f0f9f2835cf85c1fd3652ec83368528754764cd)
2019-07-18T1440: in IPv4 DHCP, print the subnet rather than a dict dumpDaniil Baturin
when a non-unique subnet is found.
2019-07-04T1435 plus other dhcp/dhcpv6-server enhancementsJernej Jakob
- T1435: dhcp-server: make ip-address optional in static-mapping - remove [REQUIRED] from dhcpv6-server static-mapping identifier and ipv6-address - verify if static-mapping ipv6-address is in subnet - make help and error messages in conf-mode more descriptive - remove regex ^$ anchors (implied in re.fullmatch)
2019-05-05[dhcp-server] T103: wrong hostnames in hosts fileChristian Poessinger
2019-04-18T1343: do not remove zeros DHCP static routetmarlok88
2019-04-10[dhcp] T1330: bugfix for non working wpad urlChristian Poessinger
WPAD url could be configured by CLI but the generated config was not understood by ISC dhcp - caused by infalid if {} statement resulting in a missing "option wpad-url code 252 = text;" block.
2019-03-08T103: [dhcp-server] add support to configure host declarative namesChristian Poessinger
2019-03-08T103: [dhcp-server] beautify generated configuration fileChristian Poessinger
2019-01-06T1129: replace quotes when dealing with 'subnet/global-parameters'Christian Poessinger
2019-01-06T1129: fix handling of raw DHCP 'subnet-parameters'Christian Poessinger
subnet-parameters were not added to the resulting configuration.
2018-11-08dhcp - move commit hook into shared-networkBob
Move the on commit in a generated dhcpd.conf into the shared-network to fix hostfile-update not working.
2018-09-04dhcp_server.py: bugfix pool assignmentChristian Poessinger
Commit 91c3b8bdd9 ("dhcp_server.py: cleanup") did not only cleanup parts of the code but in addition added support for DHCP failover. That support could lead to an empty pool {} statement if the subnet declaration only had static address assignments but no range at all. ---<snip>--- dhcpd: /etc/dhcp/dhcpd.conf line 70: Pool declaration with no address range. dhcpd: } dhcpd: ^ dhcpd: Pool declarations must always contain at least dhcpd: one range statement. ---</snip>---
2018-08-31dhcp_server.py: cleanupChristian Poessinger
2018-08-30dhcp_server.py: rework verify() error messages/error checkingChristian Poessinger
Commit 067a6b1524 ("vyos: package: extend validator by is_subnet_connected()") added a mechanism to probe if a given IPv4/IPv6 address is connected to any interface on the subnet - or is part of this subnet. We now use this call instead of producing more and more biler-plate code!
2018-08-29dhcp_server.py: beautify error messages generated in verify()Christian Poessinger
2018-08-29dhcp_server.py: check if AF_INET address is configure before using it in ↵Christian Poessinger
verify()
2018-08-29dhcp_server.py: fix KeyError in verify()Christian Poessinger
2018-08-29dhcp_server.py: improve handling of 'dhcpd.leases' fileChristian Poessinger
If there was yet no lease file present, dhcpd refused to start. Lease file is created if required. Ususally this is handeled by the isc-dhcp-server init script but we use our own path (for persistance) of that file.
2018-08-28T778: harden dhcp_server.py for non existing filesChristian Poessinger
2018-08-28dhcp_server.py: issue warning and don't generate config if service is disabledChristian Poessinger