mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 13:23:01 +02:00
- dnsmasq:
- allow listening to all interfaces again to serve DHCP leases
- disable most of the default DHCP options, keep broadcast and
netmask because when dnsmasq can infer these they are better
than breaking networking for clients -- note, they can still
be overridden from global/subnet/host scope -- and for relay
setups they need to be supplied anyway
- confd:
- drop per-interface dnsmasq, although practical for many use-cases,
having a per-subnet focused server means improved integration with
future stand-alone dhcp relay setup
- implement suggested, simplified, yang model
Fixes #703
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
39 lines
1.0 KiB
Python
Executable File
39 lines
1.0 KiB
Python
Executable File
#!/usr/bin/python3
|
|
"""
|
|
This script is used to query a single dnsmasq daemon via dbus
|
|
and fills/clears the infix-dhcp-server packet statistics.
|
|
"""
|
|
|
|
import argparse
|
|
import json
|
|
import dbus
|
|
|
|
DNSMASQ_NAME = "uk.org.thekelleys.dnsmasq"
|
|
DNSMASQ_IFACE = "uk.org.thekelleys.dnsmasq"
|
|
DNSMASQ_OBJECT = "/uk/org/thekelleys/dnsmasq"
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(prog='dhcp-server-status')
|
|
parser.add_argument("-c", "--clear", action="store_true",
|
|
help="Clear DHCP server metrics")
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
bus = dbus.SystemBus()
|
|
dnsmasq = dbus.Interface(bus.get_object(DNSMASQ_NAME, DNSMASQ_OBJECT),
|
|
DNSMASQ_IFACE)
|
|
|
|
if args.clear:
|
|
print("Clearing metrics for DHCP server")
|
|
dnsmasq.ClearMetrics()
|
|
else:
|
|
print(json.dumps({"metrics": dnsmasq.GetMetrics()}))
|
|
|
|
except dbus.DBusException as e:
|
|
print(f"Error: Unable to connect to dnsmasq via D-Bus: {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|