summaryrefslogtreecommitdiff
path: root/sbin/dhcpleased
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/dhcpleased')
-rw-r--r--sbin/dhcpleased/engine.c23
-rw-r--r--sbin/dhcpleased/frontend.c23
2 files changed, 32 insertions, 14 deletions
diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c
index cdb06545b20..82c7793c473 100644
--- a/sbin/dhcpleased/engine.c
+++ b/sbin/dhcpleased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.46 2024/08/25 09:53:53 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.47 2024/08/26 06:04:24 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -493,8 +493,11 @@ engine_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_VC_ID:
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_VC_ID without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->vc_id != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((iface_conf->vc_id_len = imsg_get_len(&imsg))
> 255 + 2 || iface_conf->vc_id_len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
@@ -507,8 +510,11 @@ engine_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_C_ID:
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_C_ID without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->c_id != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((iface_conf->c_id_len = imsg_get_len(&imsg))
> 255 + 2 || iface_conf->c_id_len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
@@ -523,8 +529,11 @@ engine_dispatch_main(int fd, short event, void *bula)
size_t len;
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_H_NAME without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->h_name != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((len = imsg_get_len(&imsg)) > 256 || len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
if ((iface_conf->h_name = malloc(len)) == NULL)
diff --git a/sbin/dhcpleased/frontend.c b/sbin/dhcpleased/frontend.c
index ddb72eb4b4f..d0dae2d7a74 100644
--- a/sbin/dhcpleased/frontend.c
+++ b/sbin/dhcpleased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.36 2024/08/25 09:53:53 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.37 2024/08/26 06:04:24 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -369,8 +369,11 @@ frontend_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_VC_ID:
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_VC_ID without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->vc_id != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((iface_conf->vc_id_len = imsg_get_len(&imsg))
> 255 + 2 || iface_conf->vc_id_len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
@@ -383,8 +386,11 @@ frontend_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_C_ID:
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_C_ID without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->c_id != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((iface_conf->c_id_len = imsg_get_len(&imsg))
> 255 + 2 || iface_conf->c_id_len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
@@ -399,8 +405,11 @@ frontend_dispatch_main(int fd, short event, void *bula)
size_t len;
if (iface_conf == NULL)
- fatalx("IMSG_RECONF_H_NAME without "
- "IMSG_RECONF_IFACE");
+ fatalx("%s: %s without IMSG_RECONF_IFACE",
+ __func__, i2s(type));
+ if (iface_conf->h_name != NULL)
+ fatalx("%s: multiple %s for the same interface",
+ __func__, i2s(type));
if ((len = imsg_get_len(&imsg)) > 256 || len == 0)
fatalx("%s: invalid %s", __func__, i2s(type));
if ((iface_conf->h_name = malloc(len)) == NULL)