-/* $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>
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);
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];
}
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,
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;
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];
-/* $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>
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;
== 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);