summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-05-02 16:35:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-05-02 16:35:28 +0000
commit8d9f399f7f91f12b17648750f292c377bfbbb3bf (patch)
tree50c9df89147f3f84e406832b86eb45963f3bf474 /sbin/dhclient
parent3a4fe79c2140b22104c6748e938e2cf520e5ee36 (diff)
Bunch of comment/whitespace cleanup. Eliminate some misleading or
pointless ones, make multiline comments readable, nuke '...' in favour of '.', etc.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/bpf.c50
-rw-r--r--sbin/dhclient/clparse.c14
-rw-r--r--sbin/dhclient/conflex.c6
-rw-r--r--sbin/dhclient/dhclient.c167
-rw-r--r--sbin/dhclient/dhcp.h12
-rw-r--r--sbin/dhclient/dhcpd.h4
-rw-r--r--sbin/dhclient/dispatch.c18
-rw-r--r--sbin/dhclient/errwarn.c10
-rw-r--r--sbin/dhclient/options.c8
-rw-r--r--sbin/dhclient/packet.c4
-rw-r--r--sbin/dhclient/parse.c4
-rw-r--r--sbin/dhclient/tables.c4
12 files changed, 140 insertions, 161 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index 83b0914b8c4..9e54dc3668d 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.27 2013/04/05 19:31:36 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.28 2013/05/02 16:35:27 krw Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -111,28 +111,28 @@ if_register_send(void)
}
/*
- * Packet filter program...
+ * Packet filter program.
*
* XXX: Changes to the filter program may require changes to the
* constant offsets used in if_register_send to patch the BPF program!
*/
struct bpf_insn dhcp_bpf_filter[] = {
- /* Make sure this is an IP packet... */
+ /* Make sure this is an IP packet. */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 8),
- /* Make sure it's a UDP packet... */
+ /* Make sure it's a UDP packet. */
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 23),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6),
- /* Make sure this isn't a fragment... */
+ /* Make sure this isn't a fragment. */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
- /* Get the IP header length... */
+ /* Get the IP header length. */
BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14),
- /* Make sure it's to the right port... */
+ /* Make sure it's to the right port. */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), /* patch */
@@ -153,26 +153,26 @@ struct bpf_insn dhcp_bpf_wfilter[] = {
BPF_STMT(BPF_LD + BPF_B + BPF_IND, 14),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (IPVERSION << 4) + 5, 0, 12),
- /* Make sure this is an IP packet... */
+ /* Make sure this is an IP packet. */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 10),
- /* Make sure it's a UDP packet... */
+ /* Make sure it's a UDP packet. */
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 23),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 8),
- /* Make sure this isn't a fragment... */
+ /* Make sure this isn't a fragment. */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 6, 0), /* patched */
- /* Get the IP header length... */
+ /* Get the IP header length. */
BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14),
- /* Make sure it's from the right port... */
+ /* Make sure it's from the right port. */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 14),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 68, 0, 3),
- /* Make sure it is to the right ports ... */
+ /* Make sure it is to the right ports. */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1),
@@ -192,11 +192,11 @@ if_register_receive(void)
struct bpf_program p;
int flag = 1, sz;
- /* Open a BPF device and hang it on this interface... */
+ /* Open a BPF device and hang it on this interface. */
ifi->rfdesc = if_register_bpf();
fcntl(ifi->rfdesc, F_SETFD, FD_CLOEXEC);
- /* Make sure the BPF version is in range... */
+ /* Make sure the BPF version is in range. */
if (ioctl(ifi->rfdesc, BIOCVERSION, &v) < 0)
error("Can't get BPF version: %s", strerror(errno));
@@ -232,7 +232,7 @@ if_register_receive(void)
p.bf_len = dhcp_bpf_filter_len;
p.bf_insns = dhcp_bpf_filter;
- /* Patch the server port into the BPF program...
+ /* Patch the server port into the BPF program.
*
* XXX: changes to filter program may require changes to the
* insn number(s) used below!
@@ -313,7 +313,7 @@ receive_packet(struct sockaddr_in *from, struct hardware *hfrom)
*/
/* Process packets until we get one we can return or until we've
- * done a read and gotten nothing we can return...
+ * done a read and gotten nothing we can return.
*/
do {
/* If the buffer is empty, fill it. */
@@ -328,19 +328,19 @@ receive_packet(struct sockaddr_in *from, struct hardware *hfrom)
/*
* If there isn't room for a whole bpf header, something
* went wrong, but we'll ignore it and hope it goes
- * away... XXX
+ * away. XXX
*/
if (ifi->rbuf_len - ifi->rbuf_offset < sizeof(hdr)) {
ifi->rbuf_offset = ifi->rbuf_len;
continue;
}
- /* Copy out a bpf header... */
+ /* Copy out a bpf header. */
memcpy(&hdr, &ifi->rbuf[ifi->rbuf_offset], sizeof(hdr));
/*
* If the bpf header plus data doesn't fit in what's
- * left of the buffer, stick head in sand yet again...
+ * left of the buffer, stick head in sand yet again.
*/
if (ifi->rbuf_offset + hdr.bh_hdrlen + hdr.bh_caplen >
ifi->rbuf_len) {
@@ -360,10 +360,10 @@ receive_packet(struct sockaddr_in *from, struct hardware *hfrom)
continue;
}
- /* Skip over the BPF header... */
+ /* Skip over the BPF header. */
ifi->rbuf_offset += hdr.bh_hdrlen;
- /* Decode the physical header... */
+ /* Decode the physical header. */
offset = decode_hw_header(ifi->rbuf, ifi->rbuf_offset, hfrom);
/*
@@ -379,11 +379,11 @@ receive_packet(struct sockaddr_in *from, struct hardware *hfrom)
ifi->rbuf_offset += offset;
hdr.bh_caplen -= offset;
- /* Decode the IP and UDP headers... */
+ /* Decode the IP and UDP headers. */
offset = decode_udp_ip_header(ifi->rbuf,
ifi->rbuf_offset, from, hdr.bh_caplen);
- /* If the IP or UDP checksum was bad, skip the packet... */
+ /* If the IP or UDP checksum was bad, skip the packet. */
if (offset < 0) {
ifi->rbuf_offset = BPF_WORDALIGN(
ifi->rbuf_offset + hdr.bh_caplen);
@@ -403,7 +403,7 @@ receive_packet(struct sockaddr_in *from, struct hardware *hfrom)
continue;
}
- /* Copy out the data in the packet... */
+ /* Copy out the data in the packet. */
memset(&client->packet, DHO_END, sizeof(client->packet));
memcpy(&client->packet, ifi->rbuf + ifi->rbuf_offset,
hdr.bh_caplen);
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index ccde4ecf29a..d261e8c05f1 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: clparse.c,v 1.56 2013/05/02 14:48:35 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.57 2013/05/02 16:35:27 krw Exp $ */
-/* Parser for dhclient config and lease files... */
+/* Parser for dhclient config and lease files. */
/*
* Copyright (c) 1997 The Internet Software Consortium.
@@ -57,7 +57,7 @@ read_client_conf(void)
new_parse(path_dhclient_conf);
- /* Set some defaults... */
+ /* Set some defaults. */
config->link_timeout = 10;
config->timeout = 60;
config->select_interval = 0;
@@ -613,7 +613,7 @@ parse_option_decl(FILE *cfile, struct option_data *options)
return (-1);
}
- /* Parse the option data... */
+ /* Parse the option data. */
do {
for (fmt = dhcp_options[code].format; *fmt; fmt++) {
if (*fmt == 'A')
@@ -624,7 +624,7 @@ parse_option_decl(FILE *cfile, struct option_data *options)
sizeof(hunkbuf) - hunkix);
hunkix += len;
break;
- case 't': /* Text string... */
+ case 't': /* Text string. */
token = next_token(&val, cfile);
if (token != TOK_STRING) {
parse_warn("expecting string.");
@@ -657,8 +657,8 @@ alloc:
memcpy(&hunkbuf[hunkix], dp, len);
hunkix += len;
break;
- case 'L': /* Unsigned 32-bit integer... */
- case 'l': /* Signed 32-bit integer... */
+ case 'L': /* Unsigned 32-bit integer. */
+ case 'l': /* Signed 32-bit integer. */
token = next_token(&val, cfile);
if (token != TOK_NUMBER) {
need_number:
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c
index ebaaebc657c..89afb701a6b 100644
--- a/sbin/dhclient/conflex.c
+++ b/sbin/dhclient/conflex.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: conflex.c,v 1.18 2012/11/15 14:54:18 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.19 2013/05/02 16:35:27 krw Exp $ */
-/* Lexical scanner for dhclient config file... */
+/* Lexical scanner for dhclient config file. */
/*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
@@ -253,7 +253,7 @@ read_string(FILE *cfile)
}
/*
* Normally, I'd feel guilty about this, but we're talking about
- * strings that'll fit in a DHCP packet here...
+ * strings that'll fit in a DHCP packet here.
*/
if (i == sizeof(tokbuf)) {
parse_warn("string constant larger than internal buffer");
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 7b392f9a0d8..d0c45f8bda6 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.245 2013/05/02 14:48:35 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.246 2013/05/02 16:35:27 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -63,7 +63,7 @@
#include <resolv.h>
#define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"
-#define DEFAULT_LEASE_TIME 43200 /* 12 hours... */
+#define DEFAULT_LEASE_TIME 43200 /* 12 hours. */
#define TIME_MAX 2147483647
char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
@@ -487,7 +487,7 @@ main(int argc, char *argv[])
/* set up the interface */
discover_interface();
- /* Register the interface... */
+ /* Register the interface. */
if_register_receive();
if_register_send();
@@ -567,39 +567,11 @@ usage(void)
}
/*
- * Individual States:
- *
- * Each routine is called from the dhclient_state_machine() in one of
- * these conditions:
- * -> entering INIT state
- * -> recvpacket_flag == 0: timeout in this state
- * -> otherwise: received a packet in this state
- *
- * Return conditions as handled by dhclient_state_machine():
- * Returns 1, sendpacket_flag = 1: send packet, reset timer.
- * Returns 1, sendpacket_flag = 0: just reset the timer (wait for a milestone).
- * Returns 0: finish the nap which was interrupted for no good reason.
- *
- * Several per-interface variables are used to keep track of the process:
- * active_lease: the lease that is being used on the interface
- * (null pointer if not configured yet).
- * offered_leases: leases corresponding to DHCPOFFER messages that have
- * been sent to us by DHCP servers.
- * acked_leases: leases corresponding to DHCPACK messages that have been
- * sent to us by DHCP servers.
- * sendpacket: DHCP packet we're trying to send.
- * destination: IP address to send sendpacket to
- * In addition, there are several relevant per-lease variables.
- * T1_expiry, T2_expiry, lease_expiry: lease milestones
- * In the active lease, these control the process of renewing the lease;
- * In leases on the acked_leases list, this simply determines when we
- * can no longer legitimately use the lease.
+ * Called when the interface link becomes active.
*/
void
state_reboot(void)
{
- /* Cancel all timeouts, since a link state change gets us here
- and can happen anytime. */
cancel_timeout();
deleting.s_addr = INADDR_ANY;
adding.s_addr = INADDR_ANY;
@@ -622,8 +594,7 @@ state_reboot(void)
}
/*
- * Called when a lease has completely expired and we've
- * been unable to renew it.
+ * Called when a lease has completely expired and we've been unable to renew it.
*/
void
state_init(void)
@@ -640,8 +611,8 @@ state_init(void)
}
/*
- * state_selecting is called when one or more DHCPOFFER packets
- * have been received and a configurable period of time has passed.
+ * Called when one or more DHCPOFFER packets have been received and a
+ * configurable period of time has passed.
*/
void
state_selecting(void)
@@ -649,8 +620,6 @@ state_selecting(void)
struct client_lease *lp, *picked;
time_t cur_time;
- /* Cancel state_selecting and send_discover timeouts, since either
- one could have got us here. */
cancel_timeout();
/* Take the first DHCPOFFER, discard the rest. */
@@ -694,7 +663,6 @@ state_selecting(void)
return;
}
- /* Go to the REQUESTING state. */
client->destination.s_addr = INADDR_BROADCAST;
client->state = S_REQUESTING;
client->first_sending = cur_time;
@@ -746,16 +714,20 @@ dhcpack(struct in_addr client_addr, struct option_data *options, char *info)
getULong(client->new->options[DHO_DHCP_LEASE_TIME].data);
else
client->new->expiry = DEFAULT_LEASE_TIME;
- /* A number that looks negative here is really just very large,
- because the lease expiry offset is unsigned. */
+ /*
+ * A number that looks negative here is really just very large,
+ * because the lease expiry offset is unsigned.
+ */
if (client->new->expiry < 0)
client->new->expiry = TIME_MAX;
/* XXX should be fixed by resetting the client state */
if (client->new->expiry < 60)
client->new->expiry = 60;
- /* Take the server-provided renewal time if there is one;
- otherwise figure it out according to the spec. */
+ /*
+ * Take the server-provided renewal time if there is one;
+ * otherwise figure it out according to the spec.
+ */
if (client->new->options[DHO_DHCP_RENEWAL_TIME].len)
client->new->renewal =
getULong(client->new->options[DHO_DHCP_RENEWAL_TIME].data);
@@ -844,15 +816,13 @@ bind_lease(void)
}
/*
- * state_bound is called when we've successfully bound to a particular
- * lease, but the renewal time on that lease has expired. We are
- * expected to unicast a DHCPREQUEST to the server that gave us our
- * original lease.
+ * Called when we've successfully bound to a particular lease, but the renewal
+ * time on that lease has expired. We are expected to unicast a DHCPREQUEST to
+ * the server that gave us our original lease.
*/
void
state_bound(void)
{
- /* T1 has expired. */
client->xid = arc4random();
make_request(client->active);
@@ -905,8 +875,10 @@ dhcpoffer(struct in_addr client_addr, struct option_data *options, char *info)
if (subnet_exists(lease))
return;
- /* If this lease was acquired through a BOOTREPLY, record that
- fact. */
+ /*
+ * If this lease was acquired through a BOOTREPLY, record that
+ * fact.
+ */
if (!options[DHO_DHCP_MESSAGE_TYPE].len)
lease->is_bootp = 1;
@@ -925,9 +897,6 @@ dhcpoffer(struct in_addr client_addr, struct option_data *options, char *info)
note("%s", info);
- /* If the selecting interval has expired, go immediately to
- state_selecting(). Otherwise, time out into
- state_selecting at the select interval. */
if (stop_selecting <= time(NULL))
state_selecting();
else {
@@ -1056,7 +1025,7 @@ dhcpnak(struct in_addr client_addr, struct option_data *options, char *info)
free_client_lease(client->active);
client->active = NULL;
- /* Stop sending DHCPREQUEST packets... */
+ /* Stop sending DHCPREQUEST packets. */
cancel_timeout();
client->state = S_INIT;
@@ -1132,9 +1101,8 @@ send_discover(void)
}
/*
- * state_panic gets called if we haven't received any offers in a preset
- * amount of time. When this happens, we try to use existing leases
- * that haven't yet expired.
+ * Called if we haven't received any offers in a preset amount of time. When
+ * this happens, we try to use existing leases that haven't yet expired.
*/
void
state_panic(void)
@@ -1145,8 +1113,10 @@ state_panic(void)
time(&cur_time);
note("No acceptable DHCPOFFERS received.");
- /* We may not have an active lease, but we may have some
- predefined leases that we can try. */
+ /*
+ * We may not have an active lease, but we may have some predefined
+ * leases that we can try.
+ */
if (!client->active && !TAILQ_EMPTY(&client->leases))
goto activate_next;
@@ -1186,17 +1156,20 @@ state_panic(void)
}
activate_next:
- /* Otherwise, put the active lease at the end of the
- lease list, and try another lease.. */
+ /*
+ * Otherwise, put the active lease at the end of the lease
+ * list, and try another lease.
+ */
if (client->active)
TAILQ_INSERT_TAIL(&client->leases, client->active,
next);
client->active = TAILQ_FIRST(&client->leases);
TAILQ_REMOVE(&client->leases, client->active, next);
- /* If we already tried this lease, we've exhausted the
- set of leases, so we might as well give up for
- now. */
+ /*
+ * If we already tried this lease, we've exhausted the set of
+ * leases, so we might as well give up for now.
+ */
if (client->active == loop)
break;
else if (!loop)
@@ -1225,16 +1198,19 @@ send_request(void)
/* Figure out how long it's been since we started transmitting. */
interval = (int)(cur_time - client->first_sending);
- /* If we're in the INIT-REBOOT or REQUESTING state and we're
- past the reboot timeout, go to INIT and see if we can
- DISCOVER an address... */
- /* XXX In the INIT-REBOOT state, if we don't get an ACK, it
- means either that we're on a network with no DHCP server,
- or that our server is down. In the latter case, assuming
- that there is a backup DHCP server, DHCPDISCOVER will get
- us a new address, but we could also have successfully
- reused our old address. In the former case, we're hosed
- anyway. This is not a win-prone situation. */
+ /*
+ * If we're in the INIT-REBOOT or REQUESTING state and we're
+ * past the reboot timeout, go to INIT and see if we can
+ * DISCOVER an address.
+ *
+ * XXX In the INIT-REBOOT state, if we don't get an ACK, it
+ * means either that we're on a network with no DHCP server,
+ * or that our server is down. In the latter case, assuming
+ * that there is a backup DHCP server, DHCPDISCOVER will get
+ * us a new address, but we could also have successfully
+ * reused our old address. In the former case, we're hosed
+ * anyway. This is not a win-prone situation.
+ */
if ((client->state == S_REBOOTING ||
client->state == S_REQUESTING) &&
interval > config->reboot_timeout) {
@@ -1244,8 +1220,10 @@ send_request(void)
return;
}
- /* If the lease has expired, relinquish the address and go back
- to the INIT state. */
+ /*
+ * If the lease has expired, relinquish the address and go back to the
+ * INIT state.
+ */
if (client->state != S_REQUESTING &&
cur_time > client->active->expiry) {
if (client->active) {
@@ -1257,7 +1235,7 @@ send_request(void)
return;
}
- /* Do the exponential backoff... */
+ /* Do the exponential backoff. */
if (!client->interval)
client->interval = config->initial_interval;
else
@@ -1269,14 +1247,18 @@ send_request(void)
client->interval = ((config->backoff_cutoff / 2) +
((arc4random() >> 2) % client->interval));
- /* If the backoff would take us to the expiry time, just set the
- timeout to the expiry time. */
+ /*
+ * If the backoff would take us to the expiry time, just set the
+ * timeout to the expiry time.
+ */
if (client->state != S_REQUESTING && cur_time + client->interval >
client->active->expiry)
client->interval = client->active->expiry - cur_time + 1;
- /* If the lease T2 time has elapsed, or if we're not yet bound,
- broadcast the DHCPREQUEST rather than unicasting. */
+ /*
+ * If the lease rebind time has elapsed, or if we're not yet bound,
+ * broadcast the DHCPREQUEST rather than unicasting.
+ */
memset(&destination, 0, sizeof(destination));
if (client->state == S_REQUESTING ||
client->state == S_REBOOTING ||
@@ -1403,10 +1385,12 @@ make_request(struct client_lease * lease)
options[i].data = config->requested_options;
options[i].len = config->requested_option_count;
- /* If we are requesting an address that hasn't yet been assigned
- to us, use the DHCP Requested Address option. */
+ /*
+ * If we are requesting an address that hasn't yet been assigned
+ * to us, use the DHCP Requested Address option.
+ */
if (client->state == S_REQUESTING) {
- /* Send back the server identifier... */
+ /* Send back the server identifier. */
i = DHO_DHCP_SERVER_IDENTIFIER;
options[i].data = lease->options[i].data;
options[i].len = lease->options[i].len;
@@ -1442,8 +1426,10 @@ make_request(struct client_lease * lease)
packet->secs = 0; /* Filled in by send_request. */
packet->flags = 0;
- /* If we own the address we're requesting, put it in ciaddr;
- otherwise set ciaddr to zero. */
+ /*
+ * If we own the address we're requesting, put it in ciaddr. Otherwise
+ * set ciaddr to zero.
+ */
if (client->state == S_BOUND ||
client->state == S_RENEWING ||
client->state == S_REBINDING) {
@@ -1475,7 +1461,7 @@ make_decline(struct client_lease *lease)
options[i].data = &decline;
options[i].len = sizeof(decline);
- /* Send back the server identifier... */
+ /* Send back the server identifier. */
i = DHO_DHCP_SERVER_IDENTIFIER;
options[i].data = lease->options[i].data;
options[i].len = lease->options[i].len;
@@ -1697,7 +1683,7 @@ go_daemon(void)
state = 1;
- /* Stop logging to stderr... */
+ /* Stop logging to stderr. */
log_perror = 0;
if (daemon(1, 0) == -1)
@@ -1712,9 +1698,7 @@ go_daemon(void)
nullfd = -1;
}
- /*
- * Catch stuff that might be trying to terminate the program.
- */
+ /* Catch stuff that might be trying to terminate the program. */
signal(SIGHUP, sighdlr);
signal(SIGINT, sighdlr);
signal(SIGTERM, sighdlr);
@@ -1935,7 +1919,6 @@ get_ifname(char *arg)
/*
* Update resolv.conf.
*/
-
char *
resolv_conf_contents(struct option_data *domainname,
struct option_data *nameservers)
diff --git a/sbin/dhclient/dhcp.h b/sbin/dhclient/dhcp.h
index 16e0dbb987b..13d098c7237 100644
--- a/sbin/dhclient/dhcp.h
+++ b/sbin/dhclient/dhcp.h
@@ -1,6 +1,6 @@
-/* $OpenBSD: dhcp.h,v 1.11 2013/01/13 18:38:02 krw Exp $ */
+/* $OpenBSD: dhcp.h,v 1.12 2013/05/02 16:35:27 krw Exp $ */
-/* Protocol structures... */
+/* Protocol structures. */
/*
* Copyright (c) 1995, 1996 The Internet Software Consortium.
@@ -76,13 +76,13 @@ struct dhcp_packet {
#define BOOTREQUEST 1
#define BOOTREPLY 2
-/* Possible values for flags field... */
+/* Possible values for flags field. */
#define BOOTP_BROADCAST 32768L
-/* Possible values for hardware type (htype) field... */
+/* Possible values for hardware type (htype) field. */
#define HTYPE_ETHER 1 /* Ethernet */
-#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */
-#define HTYPE_FDDI 8 /* FDDI... */
+#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring */
+#define HTYPE_FDDI 8 /* FDDI */
#define HTYPE_IPSEC_TUNNEL 31 /* IPsec Tunnel (RFC3456) */
/* Magic cookie validating dhcp options field (and bootp vendor
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index 1f4e6e0be4c..0b64c2f4bf7 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.115 2013/05/02 14:48:35 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.116 2013/05/02 16:35:27 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -198,7 +198,7 @@ struct dhcp_timeout {
#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases"
#define DHCPD_LOG_FACILITY LOG_DAEMON
-/* External definitions... */
+/* External definitions. */
extern struct interface_info *ifi;
extern struct client_state *client;
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index bb6920edbce..33a1c40ca0a 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.77 2013/04/05 19:19:05 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.78 2013/05/02 16:35:27 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -183,10 +183,10 @@ another:
if (unpriv_ibuf->w.queued)
fds[2].events |= POLLOUT;
- /* Wait for a packet or a timeout or unpriv_ibuf->fd ... XXX */
+ /* Wait for a packet or a timeout or unpriv_ibuf->fd. XXX */
count = poll(fds, 3, to_msec);
- /* Not likely to be transitory... */
+ /* Not likely to be transitory. */
if (count == -1) {
if (errno == EAGAIN || errno == EINTR) {
continue;
@@ -306,7 +306,7 @@ interface_status(char *ifname)
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
error("Can't create socket");
- /* get interface flags */
+ /* Get interface flags. */
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) {
@@ -314,22 +314,18 @@ interface_status(char *ifname)
strerror(errno));
}
- /*
- * if one of UP and RUNNING flags is dropped,
- * the interface is not active.
- */
if ((ifr.ifr_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
goto inactive;
- /* Next, check carrier on the interface, if possible */
+ /* Next, check carrier on the interface if possible. */
if (ifi->noifmedia)
goto active;
memset(&ifmr, 0, sizeof(ifmr));
strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
/*
- * EINVAL or ENOTTY simply means that the interface
- * does not support the SIOCGIFMEDIA ioctl. We regard it alive.
+ * EINVAL or ENOTTY simply means that the interface does not
+ * support the SIOCGIFMEDIA ioctl. We regard it alive.
*/
#ifdef DEBUG
if (errno != EINVAL && errno != ENOTTY)
diff --git a/sbin/dhclient/errwarn.c b/sbin/dhclient/errwarn.c
index 781df5875a6..57b4e7a7f30 100644
--- a/sbin/dhclient/errwarn.c
+++ b/sbin/dhclient/errwarn.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: errwarn.c,v 1.19 2012/12/04 19:24:03 krw Exp $ */
+/* $OpenBSD: errwarn.c,v 1.20 2013/05/02 16:35:27 krw Exp $ */
-/* Errors and warnings... */
+/* Errors and warnings. */
/*
* Copyright (c) 1996 The Internet Software Consortium.
@@ -78,7 +78,7 @@ error(char *fmt, ...)
}
/*
- * Log a warning message...
+ * Log a warning message.
*/
int
warning(char *fmt, ...)
@@ -102,7 +102,7 @@ warning(char *fmt, ...)
}
/*
- * Log a note...
+ * Log a note.
*/
int
note(char *fmt, ...)
@@ -127,7 +127,7 @@ note(char *fmt, ...)
#ifdef DEBUG
/*
- * Log a debug message...
+ * Log a debug message.
*/
int
debug(char *fmt, ...)
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index b2a8e30052e..560a83b8afc 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.52 2013/04/05 19:19:05 krw Exp $ */
+/* $OpenBSD: options.c,v 1.53 2013/05/02 16:35:27 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -119,7 +119,7 @@ parse_option_buffer(struct option_data *options, unsigned char *buffer,
/*
* If it's a repeat, concatenate it to whatever
* we last saw. This is really only required
- * for clients, but what the heck...
+ * for clients, but what the heck.
*/
t = calloc(1, len + options[code].len + 1);
if (!t)
@@ -290,13 +290,13 @@ pretty_print_option(unsigned int code, struct option_data *option,
}
}
- /* Check for too few bytes... */
+ /* Check for too few bytes. */
if (hunksize > len) {
warning("%s: expecting at least %d bytes; got %d",
dhcp_options[code].name, hunksize, len);
goto done;
}
- /* Check for too many bytes... */
+ /* Check for too many bytes. */
if (numhunk == -1 && hunksize < len) {
warning("%s: expecting only %d bytes: got %d",
dhcp_options[code].name, hunksize, len);
diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c
index d1e880dc89b..cae5529f544 100644
--- a/sbin/dhclient/packet.c
+++ b/sbin/dhclient/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.17 2013/04/24 01:26:30 krw Exp $ */
+/* $OpenBSD: packet.c,v 1.18 2013/05/02 16:35:27 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -56,7 +56,7 @@ checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
{
int i;
- /* Checksum all the pairs of bytes first... */
+ /* Checksum all the pairs of bytes first. */
for (i = 0; i < (nbytes & ~1U); i += 2) {
sum += (u_int16_t)ntohs(*((u_int16_t *)(buf + i)));
if (sum > 0xFFFF)
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index f9b4b22f077..215d9cb795e 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.23 2013/04/27 17:54:24 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.24 2013/05/02 16:35:27 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -265,7 +265,7 @@ convert_num(unsigned char *buf, char *str, int base, int size)
do {
tval = *ptr++;
- /* XXX assumes ASCII... */
+ /* XXX assumes ASCII. */
if (tval >= 'a')
tval = tval - 'a' + 10;
else if (tval >= 'A')
diff --git a/sbin/dhclient/tables.c b/sbin/dhclient/tables.c
index ccf634f735f..9d1cd0f07c0 100644
--- a/sbin/dhclient/tables.c
+++ b/sbin/dhclient/tables.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: tables.c,v 1.12 2013/01/02 14:47:40 krw Exp $ */
+/* $OpenBSD: tables.c,v 1.13 2013/05/02 16:35:27 krw Exp $ */
-/* Tables of information... */
+/* Tables of information. */
/*
* Copyright (c) 1995, 1996 The Internet Software Consortium.