summaryrefslogtreecommitdiff
path: root/shared/n-dhcp4/src
diff options
context:
space:
mode:
Diffstat (limited to 'shared/n-dhcp4/src')
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-c-connection.c2
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-c-lease.c8
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-c-probe.c18
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-client.c8
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-private.h2
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-s-connection.c2
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-socket.c8
-rw-r--r--shared/n-dhcp4/src/test-run-client.c2
-rw-r--r--shared/n-dhcp4/src/test.h2
-rw-r--r--shared/n-dhcp4/src/util/packet.c2
10 files changed, 23 insertions, 31 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-connection.c b/shared/n-dhcp4/src/n-dhcp4-c-connection.c
index 8c32a984dd..6becfb5087 100644
--- a/shared/n-dhcp4/src/n-dhcp4-c-connection.c
+++ b/shared/n-dhcp4/src/n-dhcp4-c-connection.c
@@ -1236,7 +1236,7 @@ int n_dhcp4_c_connection_dispatch_io(NDhcp4CConnection *connection,
/*
* Remember the start time of the transaction, and the base
* time of any relative timestamps from the pending request.
- * Thes same times applies to the response, and sholud be
+ * The same time applies to the response, and should be
* copied over.
*/
message->userdata.start_time = connection->request->userdata.start_time;
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-lease.c b/shared/n-dhcp4/src/n-dhcp4-c-lease.c
index 695a112ab7..6d9b4f3340 100644
--- a/shared/n-dhcp4/src/n-dhcp4-c-lease.c
+++ b/shared/n-dhcp4/src/n-dhcp4-c-lease.c
@@ -2,7 +2,7 @@
* DHCP4 Client Leases
*
* This implements the public API wrapping DHCP4 client leases. A lease object
- * conists of the information given to us from the server, together with the
+ * consists of the information given to us from the server, together with the
* timestamp recording the start of the validity of the lease.
*
* A probe may yield many OFFERS, each of which contains a lease object. One of
@@ -98,7 +98,7 @@ static int n_dhcp4_incoming_get_timeouts(NDhcp4Incoming *message, uint64_t *t1p,
/**
* n_dhcp4_client_lease_new() - allocate new client lease object
- * @leasep: output argumnet for new client lease object
+ * @leasep: output argument for new client lease object
* @message: incoming message representing the lease
*
* This creates a new client lease object. Client lease objects are simple
@@ -194,7 +194,7 @@ void n_dhcp4_client_lease_unlink(NDhcp4ClientLease *lease) {
* @lease: the lease to operate on
* @yiaddr: return argument for the IP address
*
- * Gets the IP address cotained in the lease. Or INADDR_ANY if the lease
+ * Gets the IP address contained in the lease. Or INADDR_ANY if the lease
* does not contain an IP address.
*/
_c_public_ void n_dhcp4_client_lease_get_yiaddr(NDhcp4ClientLease *lease, struct in_addr *yiaddr) {
@@ -208,7 +208,7 @@ _c_public_ void n_dhcp4_client_lease_get_yiaddr(NDhcp4ClientLease *lease, struct
* @lease: the lease to operate on
* @siaddr: return argument for the IP address
*
- * Gets the server IP address cotained in the lease. Or INADDR_ANY if the
+ * Gets the server IP address contained in the lease. Or INADDR_ANY if the
* lease does not contain an IP address.
*/
_c_public_ void n_dhcp4_client_lease_get_siaddr(NDhcp4ClientLease *lease, struct in_addr *siaddr) {
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-probe.c b/shared/n-dhcp4/src/n-dhcp4-c-probe.c
index f3d4f265c6..7f20ac0527 100644
--- a/shared/n-dhcp4/src/n-dhcp4-c-probe.c
+++ b/shared/n-dhcp4/src/n-dhcp4-c-probe.c
@@ -221,7 +221,7 @@ _c_public_ void n_dhcp4_client_probe_config_set_requested_ip(NDhcp4ClientProbeCo
* delay is specified to be a random value in the range 1000 to 10.000 ms.
* However, there does not appear to be any particular reason to
* unconditionally wait at least one second, so we move the range down to
- * start at 0 ms. The reaon for the random delay is to avoid network-wide
+ * start at 0 ms. The reason for the random delay is to avoid network-wide
* events causing too much simultaneous network traffic. However, on modern
* networks, a more reasonable value may be in the 10 ms range.
*/
@@ -236,7 +236,7 @@ _c_public_ void n_dhcp4_client_probe_config_set_start_delay(NDhcp4ClientProbeCon
*
* This adds an option to the list of options to request from the server.
*
- * A server may send options that we do not requst, and it may omit options
+ * A server may send options that we do not request, and it may omit options
* that we do request. However, to increase the likelyhood of uniform behavior
* between server implementations, we do not expose options that were not
* explicitly requested.
@@ -316,10 +316,9 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe
unsigned short int seed16v[3];
const uint8_t *p;
uint64_t u64;
- int r;
/*
- * Initialize seed48_r(3)
+ * Initialize config's entropy buffer for successive jrand48(3) calls.
*
* We need random jitter for all timeouts and delays, used to reduce
* network traffic during bursts. This is not meant as security measure
@@ -360,8 +359,7 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe
seed16v[1] = (u64 >> 16) ^ (u64 >> 0);
seed16v[2] = (u64 >> 32) ^ (u64 >> 16);
- r = seed48_r(seed16v, &config->entropy);
- c_assert(!r);
+ memcpy(config->entropy, seed16v, sizeof(seed16v));
}
/**
@@ -374,13 +372,7 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe
* Return: the random data.
*/
uint32_t n_dhcp4_client_probe_config_get_random(NDhcp4ClientProbeConfig *config) {
- long int result;
- int r;
-
- r = mrand48_r(&config->entropy, &result);
- c_assert(!r);
-
- return result;
+ return jrand48(config->entropy);
};
/**
diff --git a/shared/n-dhcp4/src/n-dhcp4-client.c b/shared/n-dhcp4/src/n-dhcp4-client.c
index 403a693247..1dedbf30c8 100644
--- a/shared/n-dhcp4/src/n-dhcp4-client.c
+++ b/shared/n-dhcp4/src/n-dhcp4-client.c
@@ -146,14 +146,14 @@ _c_public_ void n_dhcp4_client_config_set_transport(NDhcp4ClientConfig *config,
*
* Background: OFFER and ACK messages from DHCP servers to clients are unicast
* to the IP address handed out, even before the IP address has
- * been configured on the taregt interface. This usually works
+ * been configured on the target interface. This usually works
* because the correct destination hardware address is explicitly
* set on the outgoing packets, rather than being resolved (which
* would not work). However, some hardware does not accept incoming
* IP packets destined for addresses they do not own, even if the
* hardware address is correct. In this case, the server must
* broadcast the replies in order for the client to receive them.
- * In general, unneccesary broadcasting is something one wants to
+ * In general, unnecessary broadcasting is something one wants to
* avoid, and some networks will not deliver broadcasts to the
* client at all, in which case this flag must not be set.
*/
@@ -549,7 +549,7 @@ void n_dhcp4_log_queue_fmt(NDhcp4LogQueue *log_queue,
if (level > log_queue->log_level)
return;
- /* Currently the logging queue is only implemented for
+ /* Currently, the logging queue is only implemented for
* the client. Nobody would enable logging except a
* client instance. */
c_assert(log_queue->is_client);
@@ -953,7 +953,7 @@ _c_public_ int n_dhcp4_client_update_mtu(NDhcp4Client *client, uint16_t mtu) {
* This creates a new probe on @client. Probes represent DHCP requests and
* track the state over the entire lifetime of a lease. Once a probe is created
* it will start looking for DHCP servers, request a lease from them, and renew
- * the lease continously whenever it expires. Furthermore, if a lease cannot be
+ * the lease continuously whenever it expires. Furthermore, if a lease cannot be
* renewed, a new lease will be requested.
*
* The API allows for many probes to be run at the same time. However, the DHCP
diff --git a/shared/n-dhcp4/src/n-dhcp4-private.h b/shared/n-dhcp4/src/n-dhcp4-private.h
index 90f8f0c355..db7b24ff7d 100644
--- a/shared/n-dhcp4/src/n-dhcp4-private.h
+++ b/shared/n-dhcp4/src/n-dhcp4-private.h
@@ -263,7 +263,7 @@ struct NDhcp4ClientProbeConfig {
bool inform_only;
bool init_reboot;
struct in_addr requested_ip;
- struct drand48_data entropy; /* entropy pool */
+ unsigned short int entropy[3];
uint64_t ms_start_delay; /* max ms to wait before starting probe */
NDhcp4ClientProbeOption *options[UINT8_MAX + 1];
int8_t request_parameters[UINT8_MAX + 1];
diff --git a/shared/n-dhcp4/src/n-dhcp4-s-connection.c b/shared/n-dhcp4/src/n-dhcp4-s-connection.c
index 71ae0be826..474a7b63c8 100644
--- a/shared/n-dhcp4/src/n-dhcp4-s-connection.c
+++ b/shared/n-dhcp4/src/n-dhcp4-s-connection.c
@@ -375,7 +375,7 @@ int n_dhcp4_s_connection_nak_new(NDhcp4SConnection *connection,
/*
* The RFC is a bit unclear on how NAK should be sent, on the
- * one hand it says that they should be unconditinoally broadcast
+ * one hand it says that they should be unconditionally broadcast
* (unless going through a relay agent), on the other, when they
* do go through a relay agent, they will not be. We treat them
* as any other reply and only broadcast when the broadcast bit
diff --git a/shared/n-dhcp4/src/n-dhcp4-socket.c b/shared/n-dhcp4/src/n-dhcp4-socket.c
index c7e897726e..4a83dd1528 100644
--- a/shared/n-dhcp4/src/n-dhcp4-socket.c
+++ b/shared/n-dhcp4/src/n-dhcp4-socket.c
@@ -22,7 +22,7 @@
/**
* n_dhcp4_c_socket_packet_new() - create a new DHCP4 client packet socket
- * @sockfdp: return argumnet for the new socket
+ * @sockfdp: return argument for the new socket
* @ifindex: interface index to bind to
*
* Create a new AF_PACKET/SOCK_DGRAM socket usable to listen to and send DHCP client
@@ -129,7 +129,7 @@ int n_dhcp4_c_socket_packet_new(int *sockfdp, int ifindex) {
/**
* n_dhcp4_c_socket_udp_new() - create a new DHCP4 client UDP socket
- * @sockfdp: return argumnet for the new socket
+ * @sockfdp: return argument for the new socket
* @ifindex: interface index to bind to
* @client_addr: client address to bind to
* @server_addr: server address to connect to
@@ -230,7 +230,7 @@ int n_dhcp4_c_socket_udp_new(int *sockfdp,
/**
* n_dhcp4_s_socket_packet_new() - create a new DHCP4 server packet socket
- * @sockfdp: return argumnet for the new socket
+ * @sockfdp: return argument for the new socket
*
* Create a new AF_PACKET/SOCK_DGRAM socket usable to send DHCP packets to clients
* before they have an IP address configured, on the given interface.
@@ -251,7 +251,7 @@ int n_dhcp4_s_socket_packet_new(int *sockfdp) {
/**
* n_dhcp4_s_socket_udp_new() - create a new DHCP4 server UDP socket
- * @sockfdp: return argumnet for the new socket
+ * @sockfdp: return argument for the new socket
* @ifindex: intercafe index to bind to
*
* Create a new AF_INET/SOCK_DGRAM socket usable to listen to DHCP server packets,
diff --git a/shared/n-dhcp4/src/test-run-client.c b/shared/n-dhcp4/src/test-run-client.c
index d29dbf1f2a..e558801470 100644
--- a/shared/n-dhcp4/src/test-run-client.c
+++ b/shared/n-dhcp4/src/test-run-client.c
@@ -440,7 +440,7 @@ static void print_help(void) {
" --ifindex IDX Index of interface to run on\n"
" --mac HEX Hardware address to use\n"
" --broadcast-mac HEX Broadcast hardware address to use\n"
- " --requested-ip IP Requested IP adress\n"
+ " --requested-ip IP Requested IP address\n"
" --requested-lifetime SECS Requested lease lifetime in seconds\n"
" --requested-parameters P1,P2,... Requested parameters\n"
" --client-id HEX Client Identifier to use\n"
diff --git a/shared/n-dhcp4/src/test.h b/shared/n-dhcp4/src/test.h
index 6933982e8c..b5acd14b37 100644
--- a/shared/n-dhcp4/src/test.h
+++ b/shared/n-dhcp4/src/test.h
@@ -85,7 +85,7 @@ static inline void test_setup(void) {
/*
* Move into a new network and mount namespace both associated
* with a new user namespace where the current eUID is mapped to
- * 0. Then create a a private instance of /run/netns. This ensures
+ * 0. Then create a private instance of /run/netns. This ensures
* that any network devices or network namespaces are private to
* the test process.
*/
diff --git a/shared/n-dhcp4/src/util/packet.c b/shared/n-dhcp4/src/util/packet.c
index 38cb399d5c..fb0313abe7 100644
--- a/shared/n-dhcp4/src/util/packet.c
+++ b/shared/n-dhcp4/src/util/packet.c
@@ -244,7 +244,7 @@ int packet_sendto_udp(int sockfd,
* @buf: buffor for payload
* @n_buf: max length of payload in bytes
* @n_transmittedp: output argument for number transmitted bytes
- * @src: return argumnet for source address, or NULL, see ip(7)
+ * @src: return argument for source address, or NULL, see ip(7)
*
* Receives an UDP packet on a AF_PACKET socket. The difference between
* this and recvfrom() on an AF_INET socket is that the packet will be