Merged
Conversation
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Move from everything in a single /etc/chrony.conf to a split up with configuration and server snippets. The latter comes in the form of configured (static) and DHCP client (dynamic) server setup. To accomodate this new scheme we need to detect when serves are removed from the configuration, so not only have the whole change_ntp() been refactored, it has been extended with a new pass. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- New log() function replaces stdout logging
- New set_dhcp_routes() and clr_dhcp_routes() functions
- Set all option 121 routes with same metric
- Set all option 3 routers with increasing metric (this is what the
reference udhcpc scripts do, and RFC says the routers should be
listed in order of preference ...)
- Clearing routes must, like IP addresses, be done both by interface
and protocol. This refactor makes sure to delete any DHCP routes
set on the given interface (in case options change)
- Use resolvconf per-interface search+nameserver
- Cache IP lease so we can ask for it back later
- On deconfig|leasefail|nak, make sure to clean up anything that might
be lingering from this interface. E.g., we can get leasefail when a
server denies our request to prolong a lease.
- On renew|bound, refresh routes, and set search+dns + NTP servers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Add support for option 12, provide current hostname to server for registering the lease with -- this allows registering in local DNS for some DHCP servers. - Add support for option 50, request any previously cached IP address - Override option 60, vendor class identifier, with Infix vYY.MM - Adjust timers and retry options to be more persistant - Include initial metric as environment variable to client - Disable all default options, set a hard-coded subset, which will be replaced in a later commit by a generated list. - Ensure udhcpc creates a pid file, in case we may need to start any other service/task in sync with the DHCP client Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This should be longer, there are devices out there (in the industry) that may drop the ball on a single ARP, or may be in deep sleep (IoT), so we should send like 5 ARP with at least 1 sec between them before timing out. However, this requires patching BusyBox a bit, so skipping for now. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit changes the DHCP options from plain flags to customizable options with optional values. This works for most key:value options, but not for the more complex ones, e.g. option 81. For this we have dedicated handling to use `udhcpc -F fqdn` instad. Additionally, the inference a default option list has been removed in favor of a set of generic default options: router, dns, domain, address, broadcast, ntpsrv, search, staticroutes, msstaticroutes. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This includes locally configured DNS and any learned from DHCP. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When an optional service doesn't exist, and the run/task/service stanza clearly list `nowarn`, we should not log missing/skipping messages. This patch-set is backported from the upcoming Finit v4.7 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch ensures that the DHCP client is not started until the interface is up and running (link). If the interface goes down, or loses link, the client is stopped and everything learned from the server (address, routes, DNS/NTP servers, etc.) is remvoed. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
3d76b95 to
51e0c02
Compare
Contributor
Author
|
(Re: force push: just squashed and moved around a few commits to reduce the amount of cruft.) |
mattiaswal
reviewed
Dec 14, 2023
Contributor
mattiaswal
left a comment
There was a problem hiding this comment.
One documentation change and one question.
|
|
||
| static const struct srx_module_requirement infix_dhcp_reqs[] = { | ||
| { .dir = YANG_PATH_, .name = "infix-dhcp-client", .rev = "2023-05-22" }, | ||
| static const struct srx_module_requirement reqs[] = { |
Contributor
There was a problem hiding this comment.
Why check if the module is loaded? will it ever not be?
Contributor
Author
There was a problem hiding this comment.
this is just the auto-loader, the dependency-order handling is done by the bootstrap script. for models we don't have any dependencies (or need factory settings) we can load using the auto-loader (srx_require_modules()) in each .C file's init function.
In review discussions we have decided, for resonsons of consistency over correctness, to rename this column to match the YANG model node name rather than the Linux kernel name. Also, right align the values. Numbers should always be right-aligned. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This should probably be an optional argument to this method instead. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
51e0c02 to
4145a64
Compare
mattiaswal
approved these changes
Dec 14, 2023
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR extends the functionality of the DHCPv4 client by adding support for:
All routes, including default route, is by default set with proto
dhcpand metric 100. This ensure that routes from other routing protocols, as well as statically set routes, have priority over DHCP acquired routes.DNS servers, and search/domain settings, are saved per interface and enabled globally in the system using the dnsmasq resolver functionality. A statically set DNS server will always take precedence.
NTP servers are added as non-preferred sources, and will be selected according to the NTPv4 protocol (strata), unless there is a statically configured NTP server with the
preferflag set.A set of basic DHCP tests have been added to verify that leases are accepted and routes are installed properly (according to option precedence rules defined in RFC). There are currently no regression tests for DNS or NTP yet, these can easily be added later when we have operational support for querying system DNS and NTP servers. (Manual testing has of course been performed.)