summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2019-02-18 07:50:15 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2019-02-18 07:50:15 +0000
commit2b0d747e59a700ca8f2d2e6cd1315eb30211241e (patch)
treeda3d361c4e2b734657d047b08250f5cba46f25d3
parent2e38cc17ae51707a9493c730bb9795cb03eeb0ab (diff)
Introduce IMSG_DATA_SIZE() macro to to replace reoccuring math on
imsg.hdr.len and shorten code. Input & OK pamela
-rw-r--r--sbin/unwind/captiveportal.c34
-rw-r--r--sbin/unwind/control.c21
-rw-r--r--sbin/unwind/frontend.c44
-rw-r--r--sbin/unwind/resolver.c59
-rw-r--r--sbin/unwind/unwind.c17
-rw-r--r--sbin/unwind/unwind.h4
6 files changed, 76 insertions, 103 deletions
diff --git a/sbin/unwind/captiveportal.c b/sbin/unwind/captiveportal.c
index f9967f040b1..e0989699e54 100644
--- a/sbin/unwind/captiveportal.c
+++ b/sbin/unwind/captiveportal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: captiveportal.c,v 1.5 2019/02/17 14:51:03 florian Exp $ */
+/* $OpenBSD: captiveportal.c,v 1.6 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -306,10 +306,9 @@ captiveportal_dispatch_main(int fd, short event, void *bula)
event_add(&iev_frontend->ev, NULL);
break;
case IMSG_RECONF_CONF:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_conf))
- fatalx("%s: IMSG_RECONF_CONF wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf))
+ fatalx("%s: IMSG_RECONF_CONF wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
if ((nconf = malloc(sizeof(struct uw_conf))) == NULL)
fatal(NULL);
memcpy(nconf, imsg.data, sizeof(struct uw_conf));
@@ -321,33 +320,29 @@ captiveportal_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_CAPTIVE_PORTAL_HOST:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_host = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_PATH:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_path = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_EXPECTED_RESPONSE:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_expected_response =
strdup(imsg.data)) == NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_FORWARDER wrong length:"
- " %d", __func__, imsg.hdr.len);
+ " %lu", __func__, IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
@@ -357,10 +352,10 @@ captiveportal_dispatch_main(int fd, short event, void *bula)
uw_forwarder, entry);
break;
case IMSG_RECONF_DOT_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) ! =sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_DOT_FORWARDER wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
@@ -498,10 +493,9 @@ captiveportal_dispatch_frontend(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_CTL_LOG_VERBOSE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(verbose))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(verbose))
fatalx("%s: IMSG_CTL_LOG_VERBOSE wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
diff --git a/sbin/unwind/control.c b/sbin/unwind/control.c
index f90fef463b7..f2a948734d4 100644
--- a/sbin/unwind/control.c
+++ b/sbin/unwind/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.8 2019/02/17 14:51:03 florian Exp $ */
+/* $OpenBSD: control.c,v 1.9 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -262,29 +262,26 @@ control_dispatch_imsg(int fd, short event, void *bula)
imsg.hdr.pid, NULL, 0);
break;
case IMSG_CTL_LOG_VERBOSE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(verbose))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(verbose))
break;
/* Forward to all other processes. */
frontend_imsg_compose_main(imsg.hdr.type, imsg.hdr.pid,
- imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE);
+ imsg.data, IMSG_DATA_SIZE(imsg));
frontend_imsg_compose_resolver(imsg.hdr.type,
- imsg.hdr.pid, imsg.data,
- imsg.hdr.len - IMSG_HEADER_SIZE);
+ imsg.hdr.pid, imsg.data, IMSG_DATA_SIZE(imsg));
frontend_imsg_compose_captiveportal(imsg.hdr.type,
- imsg.hdr.pid, imsg.data,
- imsg.hdr.len - IMSG_HEADER_SIZE);
+ imsg.hdr.pid, imsg.data, IMSG_DATA_SIZE(imsg));
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
case IMSG_CTL_STATUS:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(enum
- uw_resolver_type))
+ if (IMSG_DATA_SIZE(imsg) !=
+ sizeof(enum uw_resolver_type))
break;
frontend_imsg_compose_resolver(imsg.hdr.type, 0,
- imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE);
+ imsg.data, IMSG_DATA_SIZE(imsg));
break;
default:
log_debug("%s: error handling imsg %d", __func__,
@@ -306,5 +303,5 @@ control_imsg_relay(struct imsg *imsg)
return (0);
return (imsg_compose_event(&c->iev, imsg->hdr.type, 0, imsg->hdr.pid,
- -1, imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE));
+ -1, imsg->data, IMSG_DATA_SIZE(*imsg)));
}
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c
index 71b34db1de3..9c6bc62a5ef 100644
--- a/sbin/unwind/frontend.c
+++ b/sbin/unwind/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.14 2019/02/17 16:15:31 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.15 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -352,10 +352,9 @@ frontend_dispatch_main(int fd, short event, void *bula)
event_add(&iev_captiveportal->ev, NULL);
break;
case IMSG_RECONF_CONF:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_conf))
- fatalx("%s: IMSG_RECONF_CONF wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf))
+ fatalx("%s: IMSG_RECONF_CONF wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
if ((nconf = malloc(sizeof(struct uw_conf))) == NULL)
fatal(NULL);
memcpy(nconf, imsg.data, sizeof(struct uw_conf));
@@ -367,33 +366,29 @@ frontend_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_CAPTIVE_PORTAL_HOST:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_host = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_PATH:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_path = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_EXPECTED_RESPONSE:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_expected_response =
strdup(imsg.data)) == NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_FORWARDER wrong length:"
- " %d", __func__, imsg.hdr.len);
+ " %lu", __func__, IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
@@ -403,10 +398,10 @@ frontend_dispatch_main(int fd, short event, void *bula)
uw_forwarder, entry);
break;
case IMSG_RECONF_DOT_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_DOT_FORWARDER wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
@@ -507,7 +502,6 @@ frontend_dispatch_resolver(int fd, short event, void *bula)
struct imsg imsg;
struct query_imsg *query_imsg;
int n, shut = 0, chg;
- char *ta;
if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
@@ -530,10 +524,9 @@ frontend_dispatch_resolver(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_ANSWER_HEADER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(*query_imsg))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(*query_imsg))
fatalx("%s: IMSG_ANSWER_HEADER wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
query_imsg = (struct query_imsg *)imsg.data;
if ((pq = find_pending_query(query_imsg->id)) ==
NULL) {
@@ -551,8 +544,7 @@ frontend_dispatch_resolver(int fd, short event, void *bula)
case IMSG_ANSWER:
if (pq == NULL)
fatalx("IMSG_ANSWER without HEADER");
- send_answer(pq, imsg.data, imsg.hdr.len -
- IMSG_HEADER_SIZE);
+ send_answer(pq, imsg.data, IMSG_DATA_SIZE(imsg));
break;
case IMSG_RESOLVER_DOWN:
log_debug("%s: IMSG_RESOLVER_DOWN", __func__);
@@ -580,10 +572,8 @@ frontend_dispatch_resolver(int fd, short event, void *bula)
break;
case IMSG_NEW_TA:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
- ta = imsg.data;
- add_new_ta(&new_trust_anchors, ta);
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
+ add_new_ta(&new_trust_anchors, imsg.data);
break;
case IMSG_NEW_TAS_ABORT:
log_debug("%s: IMSG_NEW_TAS_ABORT", __func__);
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index 863ecfb8cc3..ae48d6e4207 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.19 2019/02/17 16:15:31 florian Exp $ */
+/* $OpenBSD: resolver.c,v 1.20 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -331,10 +331,10 @@ resolver_dispatch_frontend(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_CTL_LOG_VERBOSE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(verbose))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(verbose))
fatalx("%s: IMSG_CTL_LOG_VERBOSE wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&verbose, imsg.data, sizeof(verbose));
update_resolvers = (log_getverbose() & OPT_VERBOSE2)
!= (verbose & OPT_VERBOSE2);
@@ -343,10 +343,9 @@ resolver_dispatch_frontend(int fd, short event, void *bula)
restart_resolvers();
break;
case IMSG_QUERY:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(*query_imsg))
- fatalx("%s: IMSG_QUERY wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(*query_imsg))
+ fatalx("%s: IMSG_QUERY wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
query_imsg = malloc(sizeof(*query_imsg)); /* XXX */
memcpy(query_imsg, imsg.data, sizeof(*query_imsg));
@@ -380,14 +379,13 @@ resolver_dispatch_frontend(int fd, short event, void *bula)
break;
case IMSG_FORWARDER:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
parse_dhcp_forwarders(imsg.data);
break;
case IMSG_CTL_STATUS:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(type))
- fatalx("%s: IMSG_CTL_STATUS wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(type))
+ fatalx("%s: IMSG_CTL_STATUS wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
memcpy(&type, imsg.data, sizeof(type));
show_status(type, imsg.hdr.pid);
break;
@@ -396,8 +394,7 @@ resolver_dispatch_frontend(int fd, short event, void *bula)
break;
case IMSG_NEW_TA:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
ta = imsg.data;
add_new_ta(&new_trust_anchors, ta);
break;
@@ -463,10 +460,11 @@ resolver_dispatch_captiveportal(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_CAPTIVEPORTAL_STATE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
+ if (IMSG_DATA_SIZE(imsg) !=
sizeof(captive_portal_state))
fatalx("%s: IMSG_CAPTIVEPORTAL_STATE wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&captive_portal_state, imsg.data,
sizeof(captive_portal_state));
log_debug("%s: IMSG_CAPTIVEPORTAL_STATE: %s", __func__,
@@ -586,10 +584,9 @@ resolver_dispatch_main(int fd, short event, void *bula)
fatal("pledge");
break;
case IMSG_RECONF_CONF:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_conf))
- fatalx("%s: IMSG_RECONF_CONF wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf))
+ fatalx("%s: IMSG_RECONF_CONF wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
if ((nconf = malloc(sizeof(struct uw_conf))) == NULL)
fatal(NULL);
memcpy(nconf, imsg.data, sizeof(struct uw_conf));
@@ -601,33 +598,29 @@ resolver_dispatch_main(int fd, short event, void *bula)
break;
case IMSG_RECONF_CAPTIVE_PORTAL_HOST:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_host = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_PATH:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_path = strdup(imsg.data)) ==
NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_CAPTIVE_PORTAL_EXPECTED_RESPONSE:
/* make sure this is a string */
- ((char *)imsg.data)[imsg.hdr.len - IMSG_HEADER_SIZE - 1]
- = '\0';
+ ((char *)imsg.data)[IMSG_DATA_SIZE(imsg) - 1] = '\0';
if ((nconf->captive_portal_expected_response =
strdup(imsg.data)) == NULL)
fatal("%s: strdup", __func__);
break;
case IMSG_RECONF_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_FORWARDER wrong length:"
- " %d", __func__, imsg.hdr.len);
+ " %lu", __func__, IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
@@ -637,10 +630,10 @@ resolver_dispatch_main(int fd, short event, void *bula)
uw_forwarder, entry);
break;
case IMSG_RECONF_DOT_FORWARDER:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct uw_forwarder))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_forwarder))
fatalx("%s: IMSG_RECONF_DOT_FORWARDER wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
if ((uw_forwarder = malloc(sizeof(struct
uw_forwarder))) == NULL)
fatal(NULL);
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index f54fa8958a3..9c005d26e17 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.15 2019/02/17 14:49:15 florian Exp $ */
+/* $OpenBSD: unwind.c,v 1.16 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -442,18 +442,16 @@ main_dispatch_frontend(int fd, short event, void *bula)
log_warnx("configuration reloaded");
break;
case IMSG_CTL_LOG_VERBOSE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(verbose))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(verbose))
fatalx("%s: IMSG_CTL_LOG_VERBOSE wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
case IMSG_OPEN_DHCP_LEASE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(rtm_index))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(rtm_index))
fatalx("%s: IMSG_OPEN_DHCP_LEASE wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
memcpy(&rtm_index, imsg.data, sizeof(rtm_index));
open_dhcp_lease(rtm_index);
break;
@@ -509,10 +507,9 @@ main_dispatch_resolver(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_OPEN_HTTP_PORT:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(sin))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(sin))
fatalx("%s: IMSG_OPEN_HTTP_PORT wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
memcpy(&sin, imsg.data, sizeof(sin));
if ((httpsock = socket(AF_INET, SOCK_STREAM |
diff --git a/sbin/unwind/unwind.h b/sbin/unwind/unwind.h
index 968d83740a1..c1f0621745c 100644
--- a/sbin/unwind/unwind.h
+++ b/sbin/unwind/unwind.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.h,v 1.10 2019/02/17 16:15:31 florian Exp $ */
+/* $OpenBSD: unwind.h,v 1.11 2019/02/18 07:50:14 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -38,6 +38,8 @@
#define ROOT_DNSKEY_TTL 172800 /* TTL from authority */
#define KSK2017 ". 172800 IN DNSKEY 257 3 8 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU="
+#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
+
enum {
PROC_MAIN,
PROC_RESOLVER,