40 Commits

Author SHA1 Message Date
Timmy Welch
996061b126 Merge remote-tracking branch 'github/master' 2023-09-23 17:56:39 -07: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
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
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
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
3c451f06ca Add the ability to run router7 on a normal Linux distribution 2020-08-10 18:12:34 -07: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
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
abeddabbb7 dhcp4d: restrict lease details page to internal IPs 2019-02-19 07:50:39 +01:00
Michael Stapelberg
6320b6c3a7 dhcp4d: display MAC vendor of each lease’s HardwareAddr 2019-01-06 18:02:01 +01:00
Michael Stapelberg
8df6329209 use renameio to write files atomically 2019-01-06 15:25:33 +01:00
Michael Stapelberg
d9f5d95812 dhcp4d: export number of non-expired DHCP leases 2018-10-23 08:49:29 +02:00
Michael Stapelberg
b347ed74c5 update import paths 2018-07-09 08:54:04 +02:00
Michael Stapelberg
ff7aa8f2cb add copyright notices 2018-06-28 20:08:23 +02:00
Michael Stapelberg
ae15230da3 dhcp4d: log in leases callback 2018-06-24 11:56:39 +02:00
Michael Stapelberg
3ba84074c7 dhcp4d: send replies as unicast using raw sockets
Preferring unicast over multicast (which hogs a lot of airtime on WiFi networks)
is a best practice.

Some device/access point vendor combinations even seem to entirely eat (some?)
broadcast traffic (sometimes), e.g. my Apple iPhone SE/Ubiquiti UAP-AC-HD, so
that using unicast is required for reliable WiFi.
2018-06-23 17:46:53 +02:00
Michael Stapelberg
4c69109db5 dhcp4d: implement permanent leases (no expiration) 2018-06-12 08:21:07 +02:00
Michael Stapelberg
d21822f531 dhcp4d: implement loading leases files from persistent storage 2018-06-09 15:18:01 +02:00
Michael Stapelberg
2ef8bf6ea0 dnsd/dhcp4d: listen on configured address (not hard-coded) 2018-06-04 08:22:45 +02:00
Michael Stapelberg
6b9ce5728a Initial commit 2018-05-27 17:30:42 +02:00