106 Commits

Author SHA1 Message Date
Timmy Welch
fdc36b64ef Merge remote-tracking branch 'github/master' 2025-01-31 21:55:15 -08: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
Timmy Welch
bf58d46748 Merge remote-tracking branch 'github/master' 2024-01-20 11:49:11 -08:00
Timmy Welch
ab5bce1356 updates 2024-01-20 11:41:04 -08:00
Timmy Welch
996061b126 Merge remote-tracking branch 'github/master' 2023-09-23 17:56:39 -07: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
lordwelch
9c800af52e dhcp4d: Add vendor Identifier to mqtt
Add username and password for mqtt server
2022-05-01 18:56:51 -07: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
lordwelch
c5a72342f2 Add time and vendor information to leases 2022-03-04 13:49:50 -08:00
lordwelch
67711ee2c7 Merge branch 'master' of https://github.com/rtr7/router7 2022-03-04 13:30:38 -08: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
lordwelch
ef50f7c2e4 Merge remote-tracking branch 'origin/master' 2021-03-15 22:44:39 -07: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
lordwelch
55ac682d36 Fix flag.parse 2020-08-17 23:13:26 -07:00
lordwelch
5f01503df6 Use the correct NTP dhcp4 option 2020-08-16 18:19:34 -07:00
lordwelch
ce29a6f436 fix ip length 2020-08-10 22:05:40 -07:00
lordwelch
7923e58428 dhcp4d: add an options argument for the dhcp server 2020-08-10 18:12:35 -07:00
lordwelch
169bc5c3e7 DNS changes
go mod tidy
2020-08-10 18:12:34 -07:00
lordwelch
3c451f06ca Add the ability to run router7 on a normal Linux distribution 2020-08-10 18:12:34 -07: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