summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2017-02-13 22:33:39 +0000
committerkrw <krw@openbsd.org>2017-02-13 22:33:39 +0000
commit35318e8fe7d95f005335d5d2b39414681f271ddb (patch)
treebf38341b7f6fe13dde0c55d3ed491b7fb32c71bf
parentAdjust some long lines. (diff)
downloadwireguard-openbsd-35318e8fe7d95f005335d5d2b39414681f271ddb.tar.xz
wireguard-openbsd-35318e8fe7d95f005335d5d2b39414681f271ddb.zip
Adjust some long lines.
-rw-r--r--usr.sbin/dhcpd/bootp.c33
-rw-r--r--usr.sbin/dhcpd/conflex.c91
-rw-r--r--usr.sbin/dhcpd/confpars.c22
-rw-r--r--usr.sbin/dhcpd/dhcp.c71
-rw-r--r--usr.sbin/dhcpd/dhcpd.c13
-rw-r--r--usr.sbin/dhcpd/dhcpd.h24
-rw-r--r--usr.sbin/dhcpd/dispatch.c14
-rw-r--r--usr.sbin/dhcpd/icmp.c5
-rw-r--r--usr.sbin/dhcpd/memory.c14
-rw-r--r--usr.sbin/dhcpd/options.c11
-rw-r--r--usr.sbin/dhcpd/parse.c5
-rw-r--r--usr.sbin/dhcpd/sync.c10
-rw-r--r--usr.sbin/dhcpd/udpsock.c8
13 files changed, 175 insertions, 146 deletions
diff --git a/usr.sbin/dhcpd/bootp.c b/usr.sbin/dhcpd/bootp.c
index 6ac7486fb95..d85abe655b3 100644
--- a/usr.sbin/dhcpd/bootp.c
+++ b/usr.sbin/dhcpd/bootp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootp.c,v 1.17 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: bootp.c,v 1.18 2017/02/13 22:33:39 krw Exp $ */
/*
* BOOTP Protocol support.
@@ -77,10 +77,10 @@ bootp(struct packet *packet)
if (packet->raw->op != BOOTREQUEST)
return;
- log_info("BOOTREQUEST from %s via %s%s", print_hw_addr(packet->raw->htype,
- packet->raw->hlen, packet->raw->chaddr),
- packet->raw->giaddr.s_addr ? inet_ntoa(packet->raw->giaddr) :
- packet->interface->name,
+ log_info("BOOTREQUEST from %s via %s%s",
+ print_hw_addr(packet->raw->htype, packet->raw->hlen,
+ packet->raw->chaddr), packet->raw->giaddr.s_addr ?
+ inet_ntoa(packet->raw->giaddr) : packet->interface->name,
packet->options_valid ? "" : " (non-rfc1048)");
if (!locate_network(packet))
@@ -114,8 +114,9 @@ bootp(struct packet *packet)
}
if (host && (!host->group->allow_booting)) {
- log_info("Ignoring excluded BOOTP client %s", host->name ?
- host->name : print_hw_addr (packet->raw->htype,
+ log_info("Ignoring excluded BOOTP client %s",
+ host->name ? host->name :
+ print_hw_addr (packet->raw->htype,
packet->raw->hlen, packet->raw->chaddr));
return;
}
@@ -129,8 +130,8 @@ bootp(struct packet *packet)
}
/*
- * If we've been told not to boot unknown clients, and we didn't
- * find any host record for this client, ignore it.
+ * If we've been told not to boot unknown clients, and we
+ * didn't find any host record for this client, ignore it.
*/
if (!host && !(s->group->boot_unknown_clients)) {
log_info("Ignoring unknown BOOTP client %s via %s",
@@ -147,8 +148,8 @@ bootp(struct packet *packet)
* ignore it.
*/
if (!host && !(s->group->allow_bootp)) {
- log_info("Ignoring BOOTP request from client %s via %s",
- print_hw_addr(packet->raw->htype,
+ log_info("Ignoring BOOTP request from client %s via "
+ "%s", print_hw_addr(packet->raw->htype,
packet->raw->hlen, packet->raw->chaddr),
packet->raw->giaddr.s_addr ?
inet_ntoa(packet->raw->giaddr) :
@@ -163,8 +164,8 @@ bootp(struct packet *packet)
*/
if (!(s->group->dynamic_bootp)) {
lose:
- log_info("No applicable record for BOOTP host %s via %s",
- print_hw_addr(packet->raw->htype,
+ log_info("No applicable record for BOOTP host %s via "
+ "%s", print_hw_addr(packet->raw->htype,
packet->raw->hlen, packet->raw->chaddr),
packet->raw->giaddr.s_addr ?
inet_ntoa(packet->raw->giaddr) :
@@ -182,9 +183,9 @@ lose:
*/
if ((lease->flags & DYNAMIC_BOOTP_OK)) {
/*
- * If it's not a DYNAMIC_BOOTP lease, release it
- * before reassigning it so that we don't get a
- * lease conflict.
+ * If it's not a DYNAMIC_BOOTP lease, release
+ * it before reassigning it so that we don't
+ * get a lease conflict.
*/
if (!(lease->flags & BOOTP_LEASE))
release_lease(lease);
diff --git a/usr.sbin/dhcpd/conflex.c b/usr.sbin/dhcpd/conflex.c
index 246dcb77bbe..5197917e352 100644
--- a/usr.sbin/dhcpd/conflex.c
+++ b/usr.sbin/dhcpd/conflex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conflex.c,v 1.16 2016/02/06 23:50:10 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.17 2017/02/13 22:33:39 krw Exp $ */
/* Lexical scanner for dhcpd config file... */
@@ -296,50 +296,51 @@ static const struct keywords {
const char *k_name;
int k_val;
} keywords[] = {
- { "abandoned", TOK_ABANDONED },
- { "allow", TOK_ALLOW },
- { "always-reply-rfc1048", TOK_ALWAYS_REPLY_RFC1048 },
- { "authoritative", TOK_AUTHORITATIVE },
- { "booting", TOK_BOOTING },
- { "bootp", TOK_BOOTP },
- { "class", TOK_CLASS },
- { "client-hostname", TOK_CLIENT_HOSTNAME },
- { "default-lease-time", TOK_DEFAULT_LEASE_TIME },
- { "deny", TOK_DENY },
- { "domain", TOK_DOMAIN },
- { "dynamic-bootp", TOK_DYNAMIC_BOOTP },
- { "dynamic-bootp-lease-cutoff", TOK_DYNAMIC_BOOTP_LEASE_CUTOFF },
- { "dynamic-bootp-lease-length", TOK_DYNAMIC_BOOTP_LEASE_LENGTH },
- { "ends", TOK_ENDS },
- { "ethernet", TOK_ETHERNET },
- { "filename", TOK_FILENAME },
- { "fixed-address", TOK_FIXED_ADDR },
- { "get-lease-hostnames", TOK_GET_LEASE_HOSTNAMES },
- { "group", TOK_GROUP },
- { "hardware", TOK_HARDWARE },
- { "host", TOK_HOST },
- { "hostname", TOK_HOSTNAME },
- { "ipsec-tunnel", TOK_IPSEC_TUNNEL },
- { "lease", TOK_LEASE },
- { "max-lease-time", TOK_MAX_LEASE_TIME },
- { "netmask", TOK_NETMASK },
- { "next-server", TOK_NEXT_SERVER },
- { "not", TOK_TOKEN_NOT },
- { "option", TOK_OPTION },
- { "range", TOK_RANGE },
- { "server-identifier", TOK_SERVER_IDENTIFIER },
- { "server-name", TOK_SERVER_NAME },
- { "shared-network", TOK_SHARED_NETWORK },
- { "starts", TOK_STARTS },
- { "subnet", TOK_SUBNET },
- { "timeout", TOK_TIMEOUT },
- { "timestamp", TOK_TIMESTAMP },
- { "uid", TOK_UID },
- { "unknown-clients", TOK_UNKNOWN_CLIENTS },
- { "use-host-decl-names", TOK_USE_HOST_DECL_NAMES },
- { "use-lease-addr-for-default-route", TOK_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE },
- { "user-class", TOK_USER_CLASS },
- { "vendor-class", TOK_VENDOR_CLASS }
+ { "abandoned", TOK_ABANDONED },
+ { "allow", TOK_ALLOW },
+ { "always-reply-rfc1048", TOK_ALWAYS_REPLY_RFC1048 },
+ { "authoritative", TOK_AUTHORITATIVE },
+ { "booting", TOK_BOOTING },
+ { "bootp", TOK_BOOTP },
+ { "class", TOK_CLASS },
+ { "client-hostname", TOK_CLIENT_HOSTNAME },
+ { "default-lease-time", TOK_DEFAULT_LEASE_TIME },
+ { "deny", TOK_DENY },
+ { "domain", TOK_DOMAIN },
+ { "dynamic-bootp", TOK_DYNAMIC_BOOTP },
+ { "dynamic-bootp-lease-cutoff", TOK_DYNAMIC_BOOTP_LEASE_CUTOFF },
+ { "dynamic-bootp-lease-length", TOK_DYNAMIC_BOOTP_LEASE_LENGTH },
+ { "ends", TOK_ENDS },
+ { "ethernet", TOK_ETHERNET },
+ { "filename", TOK_FILENAME },
+ { "fixed-address", TOK_FIXED_ADDR },
+ { "get-lease-hostnames", TOK_GET_LEASE_HOSTNAMES },
+ { "group", TOK_GROUP },
+ { "hardware", TOK_HARDWARE },
+ { "host", TOK_HOST },
+ { "hostname", TOK_HOSTNAME },
+ { "ipsec-tunnel", TOK_IPSEC_TUNNEL },
+ { "lease", TOK_LEASE },
+ { "max-lease-time", TOK_MAX_LEASE_TIME },
+ { "netmask", TOK_NETMASK },
+ { "next-server", TOK_NEXT_SERVER },
+ { "not", TOK_TOKEN_NOT },
+ { "option", TOK_OPTION },
+ { "range", TOK_RANGE },
+ { "server-identifier", TOK_SERVER_IDENTIFIER },
+ { "server-name", TOK_SERVER_NAME },
+ { "shared-network", TOK_SHARED_NETWORK },
+ { "starts", TOK_STARTS },
+ { "subnet", TOK_SUBNET },
+ { "timeout", TOK_TIMEOUT },
+ { "timestamp", TOK_TIMESTAMP },
+ { "uid", TOK_UID },
+ { "unknown-clients", TOK_UNKNOWN_CLIENTS },
+ { "use-host-decl-names", TOK_USE_HOST_DECL_NAMES },
+ { "use-lease-addr-for-default-route",
+ TOK_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE },
+ { "user-class", TOK_USER_CLASS },
+ { "vendor-class", TOK_VENDOR_CLASS }
};
int
diff --git a/usr.sbin/dhcpd/confpars.c b/usr.sbin/dhcpd/confpars.c
index 28da5fd6a69..d23ea620bd5 100644
--- a/usr.sbin/dhcpd/confpars.c
+++ b/usr.sbin/dhcpd/confpars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: confpars.c,v 1.29 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: confpars.c,v 1.30 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
@@ -1078,7 +1078,8 @@ parse_option_param(FILE *cfile, struct group *group)
do {
token = next_token
(&val, cfile);
- if (token != TOK_NUMBER_OR_NAME) {
+ if (token !=
+ TOK_NUMBER_OR_NAME) {
parse_warn("expecting "
"hex number.");
if (token != ';')
@@ -1089,9 +1090,11 @@ parse_option_param(FILE *cfile, struct group *group)
convert_num(buf, val, 16, 8);
tree = tree_concat(tree,
tree_const(buf, 1));
- token = peek_token(&val, cfile);
+ token = peek_token(&val,
+ cfile);
if (token == ':')
- token = next_token(&val,
+ token =
+ next_token(&val,
cfile);
} while (token == ':');
} else if (token == TOK_STRING) {
@@ -1195,12 +1198,12 @@ parse_option_param(FILE *cfile, struct group *group)
tree = tree_concat(tree, tree_const(&cprefix,
sizeof(cprefix)));
if (cprefix > 0)
- tree = tree_concat(tree, tree_const(buf,
- (cprefix + 7) / 8));
+ tree = tree_concat(tree, tree_const(
+ buf, (cprefix + 7) / 8));
break;
default:
- log_warnx("Bad format %c in parse_option_param.",
- *fmt);
+ log_warnx("Bad format %c in "
+ "parse_option_param.", *fmt);
skip_to_semi(cfile);
return;
}
@@ -1276,7 +1279,8 @@ parse_lease_declaration(FILE *cfile)
strlcpy(tbuf, val, sizeof tbuf);
/* Parse any of the times associated with the lease. */
- if (token == TOK_STARTS || token == TOK_ENDS || token == TOK_TIMESTAMP) {
+ if (token == TOK_STARTS || token == TOK_ENDS || token ==
+ TOK_TIMESTAMP) {
time_t t;
t = parse_date(cfile);
switch (token) {
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c
index f67c6439e93..48e9f92f1e1 100644
--- a/usr.sbin/dhcpd/dhcp.c
+++ b/usr.sbin/dhcpd/dhcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp.c,v 1.53 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: dhcp.c,v 1.54 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -172,7 +172,8 @@ dhcpdiscover(struct packet *packet)
if (((packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len != 0) &&
((hp = find_hosts_by_uid(
packet->options[DHO_DHCP_CLIENT_IDENTIFIER].data,
- packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len)) != NULL)) ||
+ packet->options[DHO_DHCP_CLIENT_IDENTIFIER].len)) !=
+ NULL)) ||
((hp = find_hosts_by_haddr(packet->raw->htype,
packet->raw->chaddr, packet->raw->hlen)) != NULL)) {
for (; hp; hp = hp->n_ipaddr) {
@@ -336,7 +337,8 @@ dhcprequest(struct packet *packet)
print_hw_addr(packet->raw->htype, packet->raw->hlen,
packet->raw->chaddr));
return;
- } else if (lease && lease->host && !lease->host->group->allow_booting) {
+ } else if (lease && lease->host && !lease->host->group->allow_booting)
+ {
log_info("Declining to renew client %s",
lease->host->name ? lease->host->name :
print_hw_addr(packet->raw->htype, packet->raw->hlen,
@@ -472,13 +474,11 @@ dhcprelease(struct packet *packet)
packet->interface->name);
}
} else {
- log_info("DHCPRELEASE of %s from %s via %s for nonexistent lease",
- ciaddrbuf,
- print_hw_addr(packet->raw->htype, packet->raw->hlen,
- packet->raw->chaddr),
+ log_info("DHCPRELEASE of %s from %s via %s for nonexistent "
+ "lease", ciaddrbuf, print_hw_addr(packet->raw->htype,
+ packet->raw->hlen, packet->raw->chaddr),
packet->raw->giaddr.s_addr ?
- inet_ntoa(packet->raw->giaddr) :
- packet->interface->name);
+ inet_ntoa(packet->raw->giaddr) : packet->interface->name);
}
}
@@ -714,7 +714,8 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
if (lease->state) {
if ((lease->flags & STATIC_LEASE) ||
cur_time - lease->timestamp < 60) {
- log_info("already acking lease %s", piaddr(lease->ip_addr));
+ log_info("already acking lease %s",
+ piaddr(lease->ip_addr));
return;
}
free_lease_state(lease->state, "ACK timed out");
@@ -952,8 +953,8 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
and we can't write the lease, don't ACK it (or BOOTREPLY
it) either. */
- if (!(supersede_lease(lease, &lt, !offer || offer == DHCPACK) ||
- (offer && offer != DHCPACK))) {
+ if (!(supersede_lease(lease, &lt, !offer ||
+ offer == DHCPACK) || (offer && offer != DHCPACK))) {
free_lease_state(state, "ack_lease: !supersede_lease");
return;
}
@@ -1087,7 +1088,8 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
if (!tree_evaluate(state->options[i]))
goto use_primary;
if (!state->options[i]->value ||
- (state->options[i]->len > sizeof state->from.iabuf))
+ (state->options[i]->len >
+ sizeof state->from.iabuf))
goto use_primary;
state->from.len = state->options[i]->len;
@@ -1347,7 +1349,8 @@ dhcp_reply(struct lease *lease)
if (lease->host && lease->host->group->next_server.len)
memcpy(&raw.siaddr, lease->host->group->next_server.iabuf, 4);
else if (lease->subnet->group->next_server.len)
- memcpy(&raw.siaddr, lease->subnet->group->next_server.iabuf, 4);
+ memcpy(&raw.siaddr, lease->subnet->group->next_server.iabuf,
+ 4);
else if (lease->subnet->interface_address.len)
memcpy(&raw.siaddr, lease->subnet->interface_address.iabuf, 4);
else
@@ -1590,19 +1593,22 @@ find_lease(struct packet *packet, struct shared_network *share,
ip_lease->hardware_addr.hlen))) {
if (uid_lease) {
if (uid_lease->ends > cur_time) {
- log_warnx("client %s has duplicate leases on %s",
+ log_warnx("client %s has duplicate "
+ "leases on %s",
print_hw_addr(packet->raw->htype,
- packet->raw->hlen, packet->raw->chaddr),
+ packet->raw->hlen,
+ packet->raw->chaddr),
ip_lease->shared_network->name);
- if (uid_lease && !packet->raw->ciaddr.s_addr)
+ if (uid_lease &&
+ !packet->raw->ciaddr.s_addr)
release_lease(uid_lease);
}
uid_lease = ip_lease;
}
} else {
- strlcpy(dhcp_message, "requested address is not available",
- sizeof(dhcp_message));
+ strlcpy(dhcp_message, "requested address is not "
+ "available", sizeof(dhcp_message));
ip_lease = NULL;
}
@@ -1612,18 +1618,19 @@ find_lease(struct packet *packet, struct shared_network *share,
if (packet->packet_type == DHCPREQUEST && fixed_lease) {
fixed_lease = NULL;
db_conflict:
- log_warnx("Both dynamic and static leases present for %s.",
- piaddr(cip));
- log_warnx("Either remove host declaration %s or remove %s",
- (fixed_lease && fixed_lease->host ?
- (fixed_lease->host->name ? fixed_lease->host->name :
- piaddr(cip)) : piaddr(cip)), piaddr(cip));
+ log_warnx("Both dynamic and static leases present for "
+ "%s.", piaddr(cip));
+ log_warnx("Either remove host declaration %s or "
+ "remove %s", (fixed_lease && fixed_lease->host ?
+ (fixed_lease->host->name ?
+ fixed_lease->host->name : piaddr(cip)) :
+ piaddr(cip)), piaddr(cip));
log_warnx("from the dynamic address pool for %s",
share->name);
if (fixed_lease)
ip_lease = NULL;
- strlcpy(dhcp_message, "database conflict - call for help!",
- sizeof(dhcp_message));
+ strlcpy(dhcp_message, "database conflict - call for "
+ "help!", sizeof(dhcp_message));
}
}
@@ -1739,8 +1746,8 @@ db_conflict:
the administrator will eventually investigate. */
if (lease && (lease->flags & ABANDONED_LEASE)) {
if (packet->packet_type == DHCPREQUEST) {
- log_warnx("Reclaiming REQUESTed abandoned IP address %s.",
- piaddr(lease->ip_addr));
+ log_warnx("Reclaiming REQUESTed abandoned IP address "
+ "%s.", piaddr(lease->ip_addr));
lease->flags &= ~ABANDONED_LEASE;
} else
lease = NULL;
@@ -1767,8 +1774,10 @@ mockup_lease(struct packet *packet, struct shared_network *share,
mock.host = hp;
if (hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]) {
- mock.uid = hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->value;
- mock.uid_len = hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->len;
+ mock.uid =
+ hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->value;
+ mock.uid_len =
+ hp->group->options[DHO_DHCP_CLIENT_IDENTIFIER]->len;
} else {
mock.uid = NULL;
mock.uid_len = 0;
diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c
index de133992dd3..e7c1698dcc5 100644
--- a/usr.sbin/dhcpd/dhcpd.c
+++ b/usr.sbin/dhcpd/dhcpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.c,v 1.53 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: dhcpd.c,v 1.54 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
@@ -277,7 +277,8 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-dfn] [-A abandoned_ip_table]", __progname);
+ fprintf(stderr, "usage: %s [-dfn] [-A abandoned_ip_table]",
+ __progname);
fprintf(stderr, " [-C changed_ip_table]\n");
fprintf(stderr, "\t[-c config-file] [-L leased_ip_table]");
fprintf(stderr, " [-l lease-file] [-u[bind_address]]\n");
@@ -307,8 +308,8 @@ lease_pinged(struct iaddr from, u_int8_t *packet, int length)
}
if (!lp->state && !lp->releasing) {
- log_warnx("ICMP Echo Reply for %s arrived late or is spurious.",
- piaddr(from));
+ log_warnx("ICMP Echo Reply for %s arrived late or is "
+ "spurious.", piaddr(from));
return;
}
@@ -321,8 +322,8 @@ lease_pinged(struct iaddr from, u_int8_t *packet, int length)
* and something answered, so we don't release it.
*/
if (lp->releasing) {
- log_warnx("IP address %s answers a ping after sending a release",
- piaddr(lp->ip_addr));
+ log_warnx("IP address %s answers a ping after sending a "
+ "release", piaddr(lp->ip_addr));
log_warnx("Possible release spoof - Not releasing address %s",
piaddr(lp->ip_addr));
lp->releasing = 0;
diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h
index fb99f797eb2..2096c2c81a5 100644
--- a/usr.sbin/dhcpd/dhcpd.h
+++ b/usr.sbin/dhcpd/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.57 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.58 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -268,17 +268,17 @@ struct class {
/* DHCP client lease structure... */
struct client_lease {
- struct client_lease *next; /* Next lease in list. */
- time_t expiry, renewal, rebind; /* Lease timeouts. */
- struct iaddr address; /* Address being leased. */
- char *server_name; /* Name of boot server. */
- char *filename; /* File to boot. */
- struct string_list *medium; /* Network medium. */
+ struct client_lease *next; /* Next lease in list. */
+ time_t expiry, renewal, rebind; /* Lease timeouts. */
+ struct iaddr address; /* Address being leased. */
+ char *server_name; /* Name of boot server. */
+ char *filename; /* File to boot. */
+ struct string_list *medium; /* Network medium. */
- unsigned int is_static : 1; /* If set, lease is from config file. */
- unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */
+ unsigned int is_static : 1; /* Lease is from config file. */
+ unsigned int is_bootp: 1; /* Lease was aquired with BOOTP. */
- struct option_data options[256]; /* Options supplied with lease. */
+ struct option_data options[256];/* Options supplied with lease. */
};
/* privsep message. fixed length for easy parsing */
@@ -515,8 +515,8 @@ time_t parse_timestamp(FILE *);
struct lease *parse_lease_declaration(FILE *);
void parse_address_range(FILE *, struct subnet *);
time_t parse_date(FILE *);
-unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *,
- int, int, int);
+unsigned char *parse_numeric_aggregate(FILE *, unsigned char *,
+ int *, int, int, int);
void convert_num(unsigned char *, char *, int, int);
/* tree.c */
diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c
index 84281895576..dfe51513881 100644
--- a/usr.sbin/dhcpd/dispatch.c
+++ b/usr.sbin/dhcpd/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.40 2017/02/13 21:53:53 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.41 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -181,7 +181,8 @@ discover_interfaces(int *rdomain)
tif = malloc(len);
if (!tif)
fatalx("no space to remember ifp.");
- strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
+ strlcpy(tif->ifr_name, ifa->ifa_name,
+ IFNAMSIZ);
memcpy(&tif->ifr_addr, ifa->ifa_addr,
ifa->ifa_addr->sa_len);
tmp->ifp = tif;
@@ -250,8 +251,8 @@ discover_interfaces(int *rdomain)
memcpy(&foo, &tmp->ifp->ifr_addr, sizeof tmp->ifp->ifr_addr);
if (!tmp->shared_network) {
- log_warnx("Can't listen on %s - dhcpd.conf has no subnet "
- "declaration for %s.", tmp->name,
+ log_warnx("Can't listen on %s - dhcpd.conf has no "
+ "subnet declaration for %s.", tmp->name,
inet_ntoa(foo.sin_addr));
/* Remove tmp from the list of interfaces. */
if (!last)
@@ -264,8 +265,9 @@ discover_interfaces(int *rdomain)
last = tmp;
/* Find subnets that don't have valid interface addresses. */
- for (subnet = (tmp->shared_network ? tmp->shared_network->subnets :
- NULL); subnet; subnet = subnet->next_sibling) {
+ for (subnet = (tmp->shared_network ?
+ tmp->shared_network->subnets : NULL); subnet;
+ subnet = subnet->next_sibling) {
if (!subnet->interface_address.len) {
/*
* Set the interface address for this subnet
diff --git a/usr.sbin/dhcpd/icmp.c b/usr.sbin/dhcpd/icmp.c
index e01bed054a2..e63f64390cd 100644
--- a/usr.sbin/dhcpd/icmp.c
+++ b/usr.sbin/dhcpd/icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp.c,v 1.16 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: icmp.c,v 1.17 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1997, 1998 The Internet Software Consortium.
@@ -88,7 +88,8 @@ icmp_startup(int routep, void (*handler)(struct iaddr, u_int8_t *, int))
&state, sizeof(state)) == -1)
fatalx("Unable to disable SO_DONTROUTE on ICMP socket: %m");
- add_protocol("icmp", icmp_protocol_fd, icmp_echoreply, (void *)handler);
+ add_protocol("icmp", icmp_protocol_fd, icmp_echoreply,
+ (void *)handler);
}
int
diff --git a/usr.sbin/dhcpd/memory.c b/usr.sbin/dhcpd/memory.c
index 6d479bafbad..c5f17c38e01 100644
--- a/usr.sbin/dhcpd/memory.c
+++ b/usr.sbin/dhcpd/memory.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memory.c,v 1.26 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: memory.c,v 1.27 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
@@ -103,7 +103,8 @@ enter_host(struct host_decl *hd)
}
if (hd->group->options[DHO_DHCP_CLIENT_IDENTIFIER]) {
- if (!tree_evaluate(hd->group->options[DHO_DHCP_CLIENT_IDENTIFIER]))
+ if (!tree_evaluate(
+ hd->group->options[DHO_DHCP_CLIENT_IDENTIFIER]))
return;
/* If there's no uid hash, make one; otherwise, see if
@@ -259,7 +260,8 @@ new_address_range(struct iaddr low, struct iaddr high, struct subnet *subnet,
for (i = 0; i < max - min + 1; i++) {
address_range[i].ip_addr = ip_addr(subnet->net,
subnet->netmask, i + min);
- address_range[i].starts = address_range[i].timestamp = MIN_TIME;
+ address_range[i].starts = address_range[i].timestamp =
+ MIN_TIME;
address_range[i].ends = MIN_TIME;
address_range[i].subnet = subnet;
address_range[i].shared_network = share;
@@ -449,7 +451,8 @@ hwaddrcmp(struct hardware *a, struct hardware *b)
static inline int
uidcmp(struct lease *a, struct lease *b)
{
- return (a->uid_len != b->uid_len || memcmp(a->uid, b->uid, b->uid_len));
+ return (a->uid_len != b->uid_len || memcmp(a->uid, b->uid,
+ b->uid_len));
}
static inline int
@@ -521,7 +524,8 @@ supersede_lease(struct lease *comp, struct lease *lease, int commit)
comp->starts = lease->starts;
if (lease->uid) {
if (lease->uid_len <= sizeof (lease->uid_buf)) {
- memcpy(comp->uid_buf, lease->uid, lease->uid_len);
+ memcpy(comp->uid_buf, lease->uid,
+ lease->uid_len);
comp->uid = &comp->uid_buf[0];
comp->uid_max = sizeof comp->uid_buf;
} else if (lease->uid != &lease->uid_buf[0]) {
diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c
index 8c3557520dc..80c501683f2 100644
--- a/usr.sbin/dhcpd/options.c
+++ b/usr.sbin/dhcpd/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.34 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: options.c,v 1.35 2017/02/13 22:33:39 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -157,8 +157,10 @@ parse_option_buffer(struct packet *packet,
if (bad_options == bad_options_max) {
packet->options_valid = 1;
bad_options = 0;
- log_warnx("Many bogus options seen in offers.");
- log_warnx("Taking this offer in spite of bogus");
+ log_warnx("Many bogus options seen in "
+ "offers.");
+ log_warnx("Taking this offer in spite of "
+ "bogus");
log_warnx("options - hope for the best!");
} else {
log_warnx("rejecting bogus offer.");
@@ -324,7 +326,8 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
* prl. If that is not available just use the default list.
*/
memset(&priority_list, 0, sizeof(priority_list));
- if (inpacket && inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data)
+ if (inpacket &&
+ inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data)
create_priority_list(priority_list,
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data,
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len);
diff --git a/usr.sbin/dhcpd/parse.c b/usr.sbin/dhcpd/parse.c
index 018983f1dc0..9639914529b 100644
--- a/usr.sbin/dhcpd/parse.c
+++ b/usr.sbin/dhcpd/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.23 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.24 2017/02/13 22:33:39 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -253,7 +253,8 @@ parse_hardware_param(FILE *cfile, struct hardware *hardware)
parse_warn("hardware address too long");
} else {
hardware->hlen = hlen;
- memcpy((unsigned char *)&hardware->haddr[0], t, hardware->hlen);
+ memcpy((unsigned char *)&hardware->haddr[0], t,
+ hardware->hlen);
if (hlen < sizeof(hardware->haddr))
memset(&hardware->haddr[hlen], 0,
sizeof(hardware->haddr) - hlen);
diff --git a/usr.sbin/dhcpd/sync.c b/usr.sbin/dhcpd/sync.c
index f231cd3519a..4cb2d45ea21 100644
--- a/usr.sbin/dhcpd/sync.c
+++ b/usr.sbin/dhcpd/sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sync.c,v 1.21 2017/02/13 21:53:53 krw Exp $ */
+/* $OpenBSD: sync.c,v 1.22 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 2008 Bob Beck <beck@openbsd.org>
@@ -428,10 +428,10 @@ sync_lease(struct lease *lease)
memcpy(&lv.lv_ip_addr, &lease->ip_addr, sizeof(lv.lv_ip_addr));
memcpy(&lv.lv_hardware_addr, &lease->hardware_addr,
sizeof(lv.lv_hardware_addr));
- log_info("sending DHCP_SYNC_LEASE for hw %s -> ip %s, start %d, end %d",
- print_hw_addr(lv.lv_hardware_addr.htype, lv.lv_hardware_addr.hlen,
- lv.lv_hardware_addr.haddr), piaddr(lease->ip_addr),
- ntohl(lv.lv_starts), ntohl(lv.lv_ends));
+ log_info("sending DHCP_SYNC_LEASE for hw %s -> ip %s, start %d, "
+ "end %d", print_hw_addr(lv.lv_hardware_addr.htype,
+ lv.lv_hardware_addr.hlen, lv.lv_hardware_addr.haddr),
+ piaddr(lease->ip_addr), ntohl(lv.lv_starts), ntohl(lv.lv_ends));
iov[i].iov_base = &lv;
iov[i].iov_len = sizeof(lv);
HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
diff --git a/usr.sbin/dhcpd/udpsock.c b/usr.sbin/dhcpd/udpsock.c
index fedd9a4399b..6f50d4712b2 100644
--- a/usr.sbin/dhcpd/udpsock.c
+++ b/usr.sbin/dhcpd/udpsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udpsock.c,v 1.9 2017/02/13 21:53:53 krw Exp $ */
+/* $OpenBSD: udpsock.c,v 1.10 2017/02/13 22:33:39 krw Exp $ */
/*
* Copyright (c) 2014 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -62,7 +62,8 @@ udpsock_startup(struct in_addr bindaddr)
fatal("creating a socket failed for udp");
onoff = 1;
- if (setsockopt(sock, IPPROTO_IP, IP_RECVIF, &onoff, sizeof(onoff)) != 0)
+ if (setsockopt(sock, IPPROTO_IP, IP_RECVIF, &onoff, sizeof(onoff)) !=
+ 0)
fatal("setsocketopt IP_RECVIF failed for udp");
sin4.sin_family = AF_INET;
@@ -156,7 +157,8 @@ udpsock_handler(struct protocol *protocol)
iface.wfdesc = udpsock->sock;
iface.ifp = &ifr;
iface.index = sdl->sdl_index;
- iface.primary_address = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
+ iface.primary_address =
+ ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
strlcpy(iface.name, ifname, sizeof(iface.name));
addr.len = 4;