mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 06:00:35 +01:00
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
This commit is contained in:
parent
082aab5452
commit
5a5be392f2
9 changed files with 20 additions and 20 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue