summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2024-07-11 10:48:52 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2024-07-11 10:48:52 +0000
commite979079be8e82a3d629710f5ae5e83cc431a97ca (patch)
treec71585546e1c5fcab4f0c801eaa8b9cc8beeae0f /sbin
parent071fa82aeffadb5d752b7f5b7b9081ac5f158d90 (diff)
Be a bit more noisy in syslog on what is going on.
So far dhcp6leased(8) has been completely silent. Prodding by Brian Conway.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhcp6leased/engine.c31
-rw-r--r--sbin/dhcp6leased/frontend.c27
2 files changed, 48 insertions, 10 deletions
diff --git a/sbin/dhcp6leased/engine.c b/sbin/dhcp6leased/engine.c
index f1202dfc622..e410a5a465d 100644
--- a/sbin/dhcp6leased/engine.c
+++ b/sbin/dhcp6leased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.23 2024/07/11 10:38:57 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.24 2024/07/11 10:48:51 florian Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -1279,9 +1279,10 @@ configure_interfaces(struct dhcp6leased_iface *iface)
struct iface_ia_conf *ia_conf;
struct iface_pd_conf *pd_conf;
struct imsg_lease_info imsg_lease_info;
+ uint32_t i;
+ char ntopbuf[INET6_ADDRSTRLEN];
char ifnamebuf[IF_NAMESIZE], *if_name;
-
if ((if_name = if_indextoname(iface->if_index, ifnamebuf)) == NULL) {
log_debug("%s: unknown interface %d", __func__,
iface->if_index);
@@ -1294,6 +1295,14 @@ configure_interfaces(struct dhcp6leased_iface *iface)
return;
}
+ for (i = 0; i < iface_conf->ia_count; i++) {
+ struct prefix *pd = &iface->new_pds[i];
+
+ log_info("prefix delegation #%d %s/%d received on %s from "
+ "server %s", i, inet_ntop(AF_INET6, &pd->prefix, ntopbuf,
+ INET6_ADDRSTRLEN), pd->prefix_len, if_name,
+ dhcp_duid2str(iface->serverid_len, iface->serverid));
+ }
SIMPLEQ_FOREACH(ia_conf, &iface_conf->iface_ia_list, entry) {
struct prefix *pd = &iface->new_pds[ia_conf->id];
@@ -1304,10 +1313,9 @@ configure_interfaces(struct dhcp6leased_iface *iface)
}
if (prefixcmp(iface->pds, iface->new_pds, iface_conf->ia_count) != 0) {
- uint32_t i;
- char ntopbuf[INET6_ADDRSTRLEN];
-
- log_warnx("IA_PDs changed");
+ log_info("Prefix delegations on %s from server %s changed",
+ if_name, dhcp_duid2str(iface->serverid_len,
+ iface->serverid));
for (i = 0; i < iface_conf->ia_count; i++) {
log_debug("%s: iface->pds [%d]: %s/%d", __func__, i,
inet_ntop(AF_INET6, &iface->pds[i].prefix, ntopbuf,
@@ -1336,6 +1344,8 @@ deconfigure_interfaces(struct dhcp6leased_iface *iface)
struct iface_conf *iface_conf;
struct iface_ia_conf *ia_conf;
struct iface_pd_conf *pd_conf;
+ uint32_t i;
+ char ntopbuf[INET6_ADDRSTRLEN];
char ifnamebuf[IF_NAMESIZE], *if_name;
@@ -1351,6 +1361,15 @@ deconfigure_interfaces(struct dhcp6leased_iface *iface)
return;
}
+ for (i = 0; i < iface_conf->ia_count; i++) {
+ struct prefix *pd = &iface->pds[i];
+
+ log_info("Prefix delegation #%d %s/%d expired on %s from "
+ "server %s", i, inet_ntop(AF_INET6, &pd->prefix, ntopbuf,
+ INET6_ADDRSTRLEN), pd->prefix_len, if_name,
+ dhcp_duid2str(iface->serverid_len, iface->serverid));
+ }
+
SIMPLEQ_FOREACH(ia_conf, &iface_conf->iface_ia_list, entry) {
struct prefix *pd = &iface->pds[ia_conf->id];
diff --git a/sbin/dhcp6leased/frontend.c b/sbin/dhcp6leased/frontend.c
index 716ccfdb00f..88552f53a22 100644
--- a/sbin/dhcp6leased/frontend.c
+++ b/sbin/dhcp6leased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.12 2024/06/19 07:42:44 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.13 2024/07/11 10:48:51 florian Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -873,8 +873,8 @@ build_packet(uint8_t message_type, struct iface *iface, char *if_name)
void
send_packet(uint8_t message_type, struct iface *iface)
{
- ssize_t pkt_len;
- char ifnamebuf[IF_NAMESIZE], *if_name;
+ ssize_t pkt_len;
+ char ifnamebuf[IF_NAMESIZE], *if_name, *message_name;
if (!event_initialized(&iface->udpev)) {
iface->send_solicit = 1;
@@ -887,7 +887,26 @@ send_packet(uint8_t message_type, struct iface *iface)
== NULL)
return; /* iface went away, nothing to do */
- log_debug("%s on %s", dhcp_message_type2str(message_type), if_name);
+ switch (message_type) {
+ case DHCPSOLICIT:
+ message_name = "Soliciting";
+ break;
+ case DHCPREQUEST:
+ message_name = "Requesting";
+ break;
+ case DHCPRENEW:
+ message_name = "Renewing";
+ break;
+ case DHCPREBIND:
+ message_name = "Rebinding";
+ break;
+ default:
+ message_name = NULL;
+ break;
+ }
+
+ if (message_name)
+ log_info("%s lease on %s", message_name, if_name);
pkt_len = build_packet(message_type, iface, if_name);