Systemd/src/network
Brandon Philips 9765ce69e1 network: dhcp: create explicit host route to gateway
Some DHCP servers gives you a netmask of 255.255.255.255 so the gateway is not
routable. Other DHCP client implementations look through the existing routes to
figure out if they should add an explicit host route. See below for a link.

However, it makes sense to just create the route explicitly whether it is
needed or not since it is explicit, makes the dhcp route entries independent of
other entries and saves us from knowing the state of the kernel tables.

After patch route table on a machine with a network (common case):

default via 10.0.2.2 dev ens3
10.0.2.0/24 dev ens3  proto kernel  scope link  src 10.0.2.15
10.0.2.2 dev ens3  scope link

After patch route table on a machine without a network (this case):

default via 10.240.0.1 dev ens4v1
10.240.0.1 dev ens4v1  scope link

The code from dhcpcd that works around this issue is on line 637.
https://android.googlesource.com/platform/external/dhcpcd/+/master/configure.c
2014-03-21 17:52:42 +01:00
..
.gitignore networkd: netdev - allow filtering on kernel cmdline, host and virt 2014-02-20 22:12:25 +01:00
Makefile networkd: add a basic network daemon 2013-11-09 23:41:17 +01:00
network-util.h networkd-wait-online: use automatic cleanup 2014-03-01 23:16:55 +01:00
networkd-address.c networkd: allow more than one static DNS server 2014-03-14 12:44:17 +01:00
networkd-link.c network: dhcp: create explicit host route to gateway 2014-03-21 17:52:42 +01:00
networkd-manager.c networkd: update mac address in clients when it changes 2014-03-20 20:18:15 +01:00
networkd-netdev-gperf.gperf networkd: add basic support for MACVLANs 2014-02-25 21:19:08 +01:00
networkd-netdev.c networkd: netdev - support joining already existing netdevs 2014-03-15 20:10:36 +01:00
networkd-network-gperf.gperf sd-network: IPv4 link-local support [v2] 2014-03-03 23:24:34 +01:00
networkd-network.c networkd: allow more than one static DNS server 2014-03-14 12:44:17 +01:00
networkd-route.c sd-network: IPv4 link-local support [v2] 2014-03-03 23:24:34 +01:00
networkd-wait-online.c networkd: wait-online - fix typo 2014-03-03 23:24:34 +01:00
networkd.c networkd: fix creation of runtime dirs at startup 2014-03-14 12:44:17 +01:00
networkd.h networkd: allow more than one static DNS server 2014-03-14 12:44:17 +01:00
sd-network.c util: replace close_nointr_nofail() by a more useful safe_close() 2014-03-18 19:31:34 +01:00
test-network.c networkd: handle SIGINT and SIGTERM 2014-02-22 21:24:36 +01:00