From b2af3086472f01cd84ed05436207060b932b95c0 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Mon, 19 Oct 2020 03:11:51 -0400 Subject: [PATCH] Trivial refactoring. --- src/state.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/state.c b/src/state.c index 66d7811..0014e74 100644 --- a/src/state.c +++ b/src/state.c @@ -277,17 +277,17 @@ static int selecting_packet(struct client_state_t cs[static 1], struct dhcpmsg packet[static 1], uint8_t msgtype, uint32_t srcaddr, bool is_requesting) { + char clibuf[INET_ADDRSTRLEN]; + char svrbuf[INET_ADDRSTRLEN]; + char srcbuf[INET_ADDRSTRLEN]; + int found; if (!is_requesting && msgtype == DHCPOFFER) { - int found; uint32_t sid = get_option_serverid(packet, &found); if (!found) { log_line("%s: Invalid offer received: it didn't have a server id.", client_config.interface); return ANP_IGNORE; } - char clibuf[INET_ADDRSTRLEN]; - char svrbuf[INET_ADDRSTRLEN]; - char srcbuf[INET_ADDRSTRLEN]; cs->clientAddr = packet->yiaddr; cs->serverAddr = sid; cs->srcAddr = srcaddr; @@ -308,10 +308,6 @@ static int selecting_packet(struct client_state_t cs[static 1], // that don't respect the serverid that was specified in // our DHCPREQUEST. if (!memcmp(&packet->yiaddr, &cs->clientAddr, 4)) { - char clibuf[INET_ADDRSTRLEN]; - char svrbuf[INET_ADDRSTRLEN]; - char srcbuf[INET_ADDRSTRLEN]; - int found; uint32_t sid = get_option_serverid(packet, &found); if (!found) { log_line("%s: Invalid offer received: it didn't have a server id.",