From 5a5be392f27ed87ea542c45e447253a22031b778 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 5 Aug 2020 16:32:08 +0200 Subject: [PATCH] Squashed 'shared/n-dhcp4/' changes from 5aeb53d149b4..03d38e83e558 03d38e83e558 n-dhcp4: fix BPF filter endianness issue aa6d7207a76c all: fix minor typos git-subtree-dir: shared/n-dhcp4 git-subtree-split: 03d38e83e558802a82cb0e4847cb1f1ef75ccd16 --- src/n-dhcp4-c-connection.c | 2 +- src/n-dhcp4-c-lease.c | 8 ++++---- src/n-dhcp4-c-probe.c | 4 ++-- src/n-dhcp4-client.c | 6 +++--- src/n-dhcp4-s-connection.c | 2 +- src/n-dhcp4-socket.c | 12 ++++++------ src/test-run-client.c | 2 +- src/test.h | 2 +- src/util/packet.c | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/n-dhcp4-c-connection.c b/src/n-dhcp4-c-connection.c index 8c32a984dd..6becfb5087 100644 --- a/src/n-dhcp4-c-connection.c +++ b/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/src/n-dhcp4-c-lease.c b/src/n-dhcp4-c-lease.c index 695a112ab7..6d9b4f3340 100644 --- a/src/n-dhcp4-c-lease.c +++ b/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/src/n-dhcp4-c-probe.c b/src/n-dhcp4-c-probe.c index 80169688cf..7f20ac0527 100644 --- a/src/n-dhcp4-c-probe.c +++ b/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. diff --git a/src/n-dhcp4-client.c b/src/n-dhcp4-client.c index 403a693247..58a4d939e8 100644 --- a/src/n-dhcp4-client.c +++ b/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. */ @@ -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/src/n-dhcp4-s-connection.c b/src/n-dhcp4-s-connection.c index 71ae0be826..474a7b63c8 100644 --- a/src/n-dhcp4-s-connection.c +++ b/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/src/n-dhcp4-socket.c b/src/n-dhcp4-socket.c index c7e897726e..3e703b4fcb 100644 --- a/src/n-dhcp4-socket.c +++ b/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 @@ -50,8 +50,8 @@ int n_dhcp4_c_socket_packet_new(int *sockfdp, int ifindex) { BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 1, 0), /* IP protocol == UDP ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ - BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(struct iphdr, frag_off)), /* A <- Flags */ - BPF_STMT(BPF_ALU + BPF_AND + BPF_K, ntohs(IP_MF | IP_OFFMASK)), /* A <- A & (IP_MF | IP_OFFMASK) */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(struct iphdr, frag_off)), /* A <- Flags + Fragment offset */ + BPF_STMT(BPF_ALU + BPF_AND + BPF_K, IP_MF | IP_OFFMASK), /* A <- A & (IP_MF | IP_OFFMASK) */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 1, 0), /* fragmented packet ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ @@ -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/src/test-run-client.c b/src/test-run-client.c index d29dbf1f2a..e558801470 100644 --- a/src/test-run-client.c +++ b/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/src/test.h b/src/test.h index 6933982e8c..b5acd14b37 100644 --- a/src/test.h +++ b/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/src/util/packet.c b/src/util/packet.c index 38cb399d5c..fb0313abe7 100644 --- a/src/util/packet.c +++ b/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