NetworkManager/shared/n-dhcp4/src
Beniamino Galvani c5d1d4c498 n-dhcp4: don't fail dispatch in case of receive errors
Currently any error encountered in n_dhcp4_c_connection_dispatch_io()
causes a dispatch failure and interrupts the library state
machine. The recvmsg() on the socket can fail for different reasons;
one of these is for example that the UDP request previously sent got a
ICMP port-unreachable response. This can be reproduced in the
following way:

 ip netns add ns1
 ip link add veth0 type veth peer name veth1
 ip link set veth1 netns ns1
 ip link set veth0 up

 cat > dhcpd.conf <<EOF
 server-identifier 172.25.0.1;
 max-lease-time 120;
 default-lease-time 120;
 subnet 172.25.0.0 netmask 255.255.255.0 {
        range 172.25.0.100 172.25.0.200;
 }
 EOF

 ip -n ns1 link set veth1 up
 ip -n ns1 address add dev veth1 172.25.0.1/24
 ip netns exec ns1 iptables -A INPUT -p udp --dport 67 -j REJECT
 ip netns exec ns1 dhcpd -4 -cf dhcpd.conf -pf /tmp/dhcp-server.pid

If a client is started on veth0, it is able to obtain a lease despite
the firewall rule blocking DHCP, because dhcpd uses a packet
socket. Then it fails during the renewal because the recvmsg() fails:

 dhcp4 (veth0): send REQUEST of 172.25.0.178 to 172.25.0.1
 dhcp4 (veth0): error -111 dispatching events
 dhcp4 (veth0): state changed bound -> fail

The client should consider such errors non fatal and keep running.

https://bugzilla.redhat.com/show_bug.cgi?id=1829178
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/486
2020-04-30 18:12:08 +02:00
..
util n-dhcp4: util/link: suppress gcc warning 2019-11-20 10:42:57 +01:00
libndhcp4.sym n-dhcp4/lease: expose the server IP address 2019-11-18 13:34:09 +01:00
meson.build license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
n-dhcp4-c-connection.c n-dhcp4: don't fail dispatch in case of receive errors 2020-04-30 18:12:08 +02:00
n-dhcp4-c-lease.c lease: add n_dhcp4_client_lease_get_basetime() 2019-11-20 10:58:51 +01:00
n-dhcp4-c-probe.c n-dhcp4: don't fail dispatch in case of receive errors 2020-04-30 18:12:08 +02:00
n-dhcp4-client.c n-dhcp4: fallback to CLOCK_MONOTONIC for timerfd (resync with upstream) 2020-03-18 16:10:49 +01:00
n-dhcp4-incoming.c n-dhcp4: accept options that are longer than requested 2020-01-25 11:31:58 +01:00
n-dhcp4-outgoing.c n-dhcp4: fix initialization of the 'secs' DHCP header field 2020-02-10 16:36:25 +01:00
n-dhcp4-private.h n-dhcp4: fallback to CLOCK_MONOTONIC for timerfd (resync with upstream) 2020-03-18 16:10:49 +01:00
n-dhcp4-s-connection.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
n-dhcp4-s-lease.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
n-dhcp4-server.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
n-dhcp4-socket.c n-dhcp4/socket: use SO_REUSEADDR on UDP socket 2019-12-11 09:25:05 +01:00
n-dhcp4.h n-dhcp4: add logging API 2019-11-22 10:24:49 +01:00
test-api.c n-dhcp4/lease: expose the server IP address 2019-11-18 13:34:09 +01:00
test-connection.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
test-message.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
test-run-client.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
test-socket.c Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00
test.h Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4' 2019-05-25 02:02:04 +02:00