summaryrefslogtreecommitdiff
path: root/sbin/slaacd/slaacd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/slaacd/slaacd.c')
-rw-r--r--sbin/slaacd/slaacd.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index cd80bfffa60..3a1044596c8 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.32 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: slaacd.c,v 1.33 2019/03/02 05:34:59 pamela Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -421,20 +421,19 @@ main_dispatch_frontend(int fd, short event, void *bula)
log_setverbose(verbose);
break;
case IMSG_UPDATE_ADDRESS:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(imsg_addrinfo))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(imsg_addrinfo))
fatal("%s: IMSG_UPDATE_ADDRESS wrong length: "
- "%d", __func__, imsg.hdr.len);
+ "%lu", __func__, IMSG_DATA_SIZE(imsg));
memcpy(&imsg_addrinfo, imsg.data,
sizeof(imsg_addrinfo));
main_imsg_compose_engine(IMSG_UPDATE_ADDRESS, 0,
&imsg_addrinfo, sizeof(imsg_addrinfo));
break;
case IMSG_UPDATE_LINK_STATE:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(imsg_link_state))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(imsg_link_state))
fatal("%s: IMSG_UPDATE_LINK_STATE wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&imsg_link_state, imsg.data,
sizeof(imsg_link_state));
main_imsg_compose_engine(IMSG_UPDATE_LINK_STATE, 0,
@@ -442,10 +441,9 @@ main_dispatch_frontend(int fd, short event, void *bula)
break;
#endif /* SMALL */
case IMSG_UPDATE_IF:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(imsg_ifinfo))
- fatal("%s: IMSG_UPDATE_IF wrong length: %d",
- __func__, imsg.hdr.len);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(imsg_ifinfo))
+ fatal("%s: IMSG_UPDATE_IF wrong length: %lu",
+ __func__, IMSG_DATA_SIZE(imsg));
memcpy(&imsg_ifinfo, imsg.data, sizeof(imsg_ifinfo));
if (get_soiikey(imsg_ifinfo.soiikey) == -1)
log_warn("get_soiikey");
@@ -504,30 +502,34 @@ main_dispatch_engine(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_PROPOSAL:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(proposal))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(proposal))
fatal("%s: IMSG_PROPOSAL wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&proposal, imsg.data, sizeof(proposal));
handle_proposal(&proposal);
break;
case IMSG_CONFIGURE_ADDRESS:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(address))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(address))
fatal("%s: IMSG_CONFIGURE_ADDRESS wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&address, imsg.data, sizeof(address));
configure_interface(&address);
break;
case IMSG_CONFIGURE_DFR:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(dfr))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(dfr))
fatal("%s: IMSG_CONFIGURE_DFR wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&dfr, imsg.data, sizeof(dfr));
add_gateway(&dfr);
break;
case IMSG_WITHDRAW_DFR:
- if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(dfr))
+ if (IMSG_DATA_SIZE(imsg) != sizeof(dfr))
fatal("%s: IMSG_WITHDRAW_DFR wrong "
- "length: %d", __func__, imsg.hdr.len);
+ "length: %lu", __func__,
+ IMSG_DATA_SIZE(imsg));
memcpy(&dfr, imsg.data, sizeof(dfr));
delete_gateway(&dfr);
break;