105 Commits

Author SHA1 Message Date
timmy 45708f545c Handle multiple domains 2026-02-15 15:14:45 -08:00
timmy b6a1ef0eb1 Load dns upstreams from disk 2026-02-15 15:14:45 -08:00
timmy 087845eb8a Add static overrides and more dynamic dns 2026-02-15 15:14:45 -08:00
timmy 605a0e7692 IPv6 DNS Support 2026-02-15 15:14:45 -08:00
timmy ef5ff27ed0 Add DoH client 2026-02-15 15:14:45 -08:00
timmy 6540f1cab0 Convert ioutil calls to io
go fix ./...
2026-02-15 15:14:45 -08:00
timmy 62a07066b6 Add time and vendor information to leases 2026-02-15 15:06:08 -08:00
timmy 268c3841a6 Add custom exclusions to backup 2026-02-08 23:29:22 -08:00
timmy 5004f54f88 Add custom domain 2026-02-08 22:42:39 -08:00
Michael Stapelberg 2189376204 dhcp: clone hardware addresses throughout
I still noticed DHCP requests with incorrect MAC source addresses.
Turns out there were still a number of incorrect HardwareAddr usages.
2025-10-16 11:23:58 +02:00
Michael Stapelberg e2d4de4768 diagd: log error message when reporting unhealthy
I noticed that there seem to be transient periods of unhealthiness,
so let’s figure out which particular check is failing.
2025-09-14 11:48:36 +02:00
Michael Stapelberg 128a7e98ef diagd: export healthiness as prometheus metric (for monitoring) 2025-09-11 08:21:10 +02:00
Michael Stapelberg 07b85b9624 backupd: serve /perm via rsync, too
This allows for more efficient incremental backup.
2025-02-23 22:28:01 +01:00
Michael Stapelberg af27264a03 dhcp4: drop expired lease on server error (faster time to recovery)
netconfigd still keeps the address configured for as long as possible,
but dhcp4 now more quickly returns to a from-scratch DHCP exchange.
2024-12-21 16:07:56 +01:00
Michael Stapelberg fe0c57fc09 dhcp4: fix drop-lease-and-restart logic
The code should immediately attempt obtaining a lease from scratch instead of
remaining stuck in the wait-until-renew loop.
2024-09-27 17:11:50 +02:00
Michael Stapelberg 05a7b11ba6 diagd: allow disabling ipv6 connectivity check in health.json
This makes rtr7-safe-update work in environments without IPv6.
2023-08-12 16:14:13 +02:00
Michael Stapelberg a8a12cafc9 diagd: remove ping4/ping6 to external targets in favor of tcp4/tcp6
External ICMP does not necessarily work.
It typically does, but not always.
Last week, for a day or two, ICMP traffic was dropped by Google.

So now we use ICMP only for network equipment targets (default gateway),
and instead use TCP for external connectivity checks.

fixes #77
2022-09-28 22:39:20 +02:00
Michael Stapelberg 2014da4ca3 dhcp4d: display active devices based on LastACK
This has the advantage that it also works for static DHCP leases,
provided the device obtains a DHCP lease at all (and isn’t configured with a
static IP address, like the shelly motion sensors for example).
2022-03-12 17:38:16 +01:00
Michael Stapelberg 593cd8c12d export input/output nftables counters as well as forwarded
Thus far, we have only had forwarded bytes metrics.

Notably, forwarded bytes does not include bytes that were sent by the router
itself, e.g. by the webserver or rsync server running on the machine.

fixes https://github.com/rtr7/router7/issues/71
2022-03-08 22:47:18 +01:00
Michael Stapelberg 3ad9d03460 gofmt for go:build 2021-09-19 11:46:57 +02:00
Michael Stapelberg a5a012dd96 dhcp4: increase number of unhealthy cycles 2021-09-19 11:45:04 +02:00
Michael Stapelberg cbadfe5128 dhcp4: ensure MQTT topic names are printable (for mosquitto_sub) 2021-06-03 21:06:03 +02:00
Michael Stapelberg 3834acfa2b dhcp4d: ensure MQTT topic names are valid UTF-8
https://twitter.com/zekjur/status/1347295676909158400
2021-01-07 22:52:58 +01:00
Michael Stapelberg 5f25043b94 dhcp4d: only publish to MQTT when channel is ready to prevent deadlocks 2020-12-31 16:42:12 +01:00
Michael Stapelberg c3c531931c retry MQTT connections, even if initial connection attempt fails 2020-12-31 16:42:01 +01:00
Michael Stapelberg 04f2be01d9 dhcp4d: optionally publish DHCP leases to MQTT
Enable using:

  mkdir -p /perm/dhcp4d
  echo 'tcp://10.0.0.54:1883' > /perm/dhcp4d/mqtt-broker.txt
2020-12-19 13:34:46 +01:00
Robert Obryk 0507d93b3d dhcp4d: ensure that SetHostname operates on the correct lease (#64)
Previously SetHostname could operate on an expired lease, or even on a
lease for a different hwaddr, if the lease for the correct hwaddr
expired and the same lease ID was given away to someone else.

That's though mostly a theoretical concern, given the actual usage of
SetHostname and the time scales involved.
2020-11-23 09:32:42 +01:00
Michael Stapelberg 99c4046ebf diagd: import net/http/pprof 2020-09-14 22:10:07 +02:00
Michael Stapelberg efbe826a4e diagd: -interface flag for easier testing 2020-09-14 22:10:07 +02:00
Michael Stapelberg f8d79d0ecc dhcp4: close healthiness checking connection 2020-09-14 12:54:14 +02:00
Michael Stapelberg fddfe80222 dhcp4: start from scratch after 5 minutes of continued unhealthiness
fixes #58
2020-09-14 09:06:05 +02:00
Michael Stapelberg 93fe6457b3 dnsd: serve DNS on tcp/53 as well (DNS must work over TCP)
fixes #59
2020-09-12 19:21:58 +02:00
Michael Stapelberg f86e20be53 dhcp6: port dhcp4 backoff logic 2020-07-02 22:07:26 +02:00
Michael Stapelberg f1e4ee0662 dyndns: don’t crashloop when config does not exist
related to #46
2020-05-28 09:46:37 +02:00
Matt Layher ead58ad72c cmd/dyndns: prototype for dynamic DNS daemon (#50)
Updates #46.

Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-23 23:06:21 +02:00
Matt Layher 988aa405be cmd/dhcp4d: make use of unused assignment
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-09 16:58:57 -04:00
Michael Stapelberg 2b6ab5b2bd dhcp4d: make hostname override settable from status page 2020-04-12 10:33:11 +02:00
Michael Stapelberg e67fb4dd71 diagd: make output look good in a terminal, too
curl diagd.router7/
2020-03-11 22:12:00 +01:00
Michael Stapelberg e34148d4e7 dhcp4d: add some leeway for lease activity 2020-02-06 18:48:19 +01:00
Michael Stapelberg a543cb9a34 dhcp4d: add header describing whether lease is active
Should be interpreted by the DHCP server so that other programs don’t need to
hard-code the lease time.
2020-01-31 19:11:08 +01:00
Michael Stapelberg a2ea8c2f95 cmd/dhcp4d: refactor for testing, add /lease/ test 2020-01-31 19:00:51 +01:00
Michael Stapelberg 4558cb61b4 dhcp4d: serve lease json data at /lease/<hostname> 2020-01-31 18:30:18 +01:00
Michael Stapelberg 3707ba290c dhcp4d: move http.HandleFunc into logic 2020-01-31 18:25:02 +01:00
Michael Stapelberg e76886dab4 dhcp4d: protect leases with a mutex
The HTTP handler runs in a separate goroutine.
2020-01-31 18:23:19 +01:00
Michael Stapelberg fa82132962 dhcp4d: add HostnameOverride field
This can be used to permanently override a hostname, regardless of whether the
lease is static or not. We use a separate field because we want devices to be
able to change their hostname themselves, until we override it.
2019-08-30 09:06:21 +02:00
Michael Stapelberg 323cc42b8e dhcp4d: polish status page, actually update it upon changes 2019-07-20 11:07:11 +02:00
Michael Stapelberg c602f1d6b6 dhcp4d: introduce -interface flag 2019-07-20 10:50:30 +02:00
Michael Stapelberg c211763b5d dhcp4d: indent leases.json for easier human editing 2019-07-20 10:49:53 +02:00
Michael Stapelberg 373c83196d dhcp4: make interface and state directory configurable
This is useful for manual testing on separate interfaces.
2019-06-06 07:52:08 +02:00
Michael Stapelberg 3dad1e9a23 dhcp4: use the configured (not the current) MAC address
This fixes a race where dhcp4 started before netconfigd had a chance to change
the hardware address on the uplink0 interface.

fiber7’s port security feature may result in an about hour-long internet outage
without this commit.
2019-02-19 09:39:16 +01:00