Commit Graph

159 Commits

Author SHA1 Message Date
Yu Watanabe 750f919112 network: drop redundant and invalid destination address
When dst_prefixlen is not set, the value is not used.
2019-09-15 22:33:11 +09:00
Yu Watanabe 70dc23624e network: do not use implicit cast to boolean 2019-09-15 22:33:11 +09:00
Zbigniew Jędrzejewski-Szmek 57ad760746 network: drop all checks of ipv6_disabled sysctl
*We* control the sysctl setting. If the user configured IPv6, then we apply the
settings, and just make sure that at some point during the configuration the
sysctl is disabled (i.e. ipv6 enabled) if we have IPv6 configured.

Replaces #13283.
2019-08-27 15:31:48 +02:00
Yu Watanabe 75a302b561 network: fix potential memleaks related to set_put() 2019-08-11 08:57:01 +09:00
William A. Kennington III 0b1cd3e25a networkd: Routes should take the gateway into account
Otherwise, changing the default gateway doesn't purge old gateway routes
left on the system during daemon restart. This also fixes removing other
foreign gateway routes that don't match the expected configuration.

Tested:
    Changed gateway addresses prior to the patch and they lingered on
    the system during each reconfiguration. Applied this patch and
    reconfigured gateways and other routes multiple times and it removed
    the foreign routes that had gateways that didn't match.

Signed-off-by: William A. Kennington III <william@wkennington.com>
2019-08-07 20:32:36 +09:00
Yu Watanabe 01aaa3df16 network: introduce route_full_hash_ops
Will be used later.
2019-07-19 01:44:44 +09:00
Yu Watanabe ca420b6201 network: show known route protocol name nicely in debugging logs 2019-07-15 02:05:40 +09:00
Yu Watanabe d3e291fd62 network: also show route protocol in debugging logs 2019-07-12 09:39:43 +09:00
Yu Watanabe 1b64651bd1 network: use string table for route protocol 2019-07-12 09:39:43 +09:00
Yu Watanabe 41b90a1eb5 network: use string table to parse route table or scope 2019-07-12 09:39:43 +09:00
Yu Watanabe b297e0a7b0 network: show route scope, table, and type in debugging logs 2019-07-12 09:39:43 +09:00
Yu Watanabe 94d6e29963 network: make Route.Type= support local, broadcast, anycast, multicast, nat, and xresolve
Closes #12975.
2019-07-12 09:39:43 +09:00
Yu Watanabe 7a22312d68 network: use string table to parse route type 2019-07-12 09:39:43 +09:00
Yu Watanabe ca5ad760a5 network: move conf parsers and function prototypes 2019-06-30 04:45:56 +09:00
Yu Watanabe bafa964144 network: read link specific sysctl value
This introduce link_sysctl_ipv6_enabled() and replaces
manager_sysctl_ipv6_enabled() with it.
2019-06-15 14:56:42 +02:00
Yu Watanabe c442331750 network: ignore requested ipv6 route when ipv6 is disabled by sysctl 2019-06-12 11:03:08 +09:00
Susant Sahani 9b88f20aba networkd: route add MPLS TTL propagate 2019-05-18 10:30:41 +09:00
Yu Watanabe 5d5003ab35 network: add DefaultRouteOnDevice= setting in [Network] section
When enabled, then default route bound to the interface will be created.
This is useful when adding routes on point-to-point interfaces.

Closes #788.
2019-05-15 12:44:30 +09:00
Susant Sahani 67c193bfb0 networkd: route fix coding style 2019-05-14 08:09:54 +05:30
Susant Sahani 633c725865 networkd: route add support to configure fastopen_no_cookie
This patch adds fastopen_no_cookie option to enable/disable TCP fastopen
without a cookie on a per-route basis.
2019-05-14 08:08:36 +05:30
Yu Watanabe fcbf4cb727 network: drop sections contain invalid settings in network_verify()
If e.g., an [Address] section has an invalid setting, then
previously assigned settings in the section is freed, and
only later settings are stored. That may cause partially broken
section stored in Network object.

This makes if an invalid setting is found, then set 'invalid' flag
instead of freeing it. And invalid sections are dropped later by
network_verify().
2019-03-13 11:59:18 +09:00
Yu Watanabe 9560e5b323 network: make all xxx_new_static() static
These functions are called from only config parsers, and the parsers are
in the same files. So, let's make them static.
2019-03-13 11:59:18 +09:00
Yu Watanabe fa7cd7117f network: add IPv4LL route right after .network file is parsed
Previously, the route is added when the .network config is assigned
to a Link. So, if multiple links match the .network file, the route
entry becomes duplicated in the corresponding Network object.
2019-03-13 11:59:18 +09:00
Yu Watanabe 7750b79695 network: update logs 2019-03-11 08:10:50 +01:00
Yu Watanabe f205a92a5c network: cleanup logging in route related config parsers 2019-02-28 10:39:14 +09:00
Yu Watanabe 01d4e7323c network: do not override previously specified family 2019-02-28 10:37:58 +09:00
Yu Watanabe 54901fd222 network: save GatewayOnLink= value as tristate in Route
This should not change any behavior. But used in the later commit.
2019-02-28 10:16:55 +09:00
Yu Watanabe 9cb8c55934 network: rename GatewayOnlink= to GatewayOnLink=
But still GatewayOnlink= is supported for backward compatibility.
2019-02-28 10:00:22 +09:00
Lennart Poettering 702451b038
Merge pull request #11698 from yuwata/fix-network-route-table
network: honor specified route table
2019-02-18 12:58:32 +01:00
Yu Watanabe 156ed65e3c network: add more debugging logs when adding, removing, updateing and configuring route 2019-02-15 10:26:06 +09:00
Yu Watanabe 434094864c network: use netlink_message_append_{in_addr,sockaddr}_union() 2019-02-11 01:28:09 +09:00
Yu Watanabe d40b01e44b network: in_addr_is_null() may return negative errno
So, do not silently cast the returned value to boolean.
Exception is the case that family is trivially AF_INET or AF_INET6.
2019-02-11 01:28:09 +09:00
Yu Watanabe 36dd5ffd5d util: drop missing.h from util.h 2018-12-04 10:00:34 +01:00
Lennart Poettering 76b31bbb24
Merge pull request #10920 from yuwata/hashmap-destructor
hashmap: make hashmap_free() call destructors of key or value
2018-12-03 17:59:44 +01:00
Lennart Poettering a20f73221a
Merge pull request #10976 from yuwata/typesafe-netlink-call
netlink: introduce typesafe netlink functions
2018-12-03 17:55:00 +01:00
Yu Watanabe 7934dede41 network: drop unnecessary buffers 2018-12-03 12:15:26 +01:00
Yu Watanabe 7a08d314f2 tree-wide: make hash_ops typesafe 2018-12-02 07:53:27 +01:00
Yu Watanabe 302a796f5a network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
Yu Watanabe bd1175bc46 network: add assertions
As they do not have default callback functions.
2018-12-02 06:23:45 +01:00
Yu Watanabe 4645ad47ac network: use route_remove_handler() as the default callback of route_remove() 2018-12-02 06:23:45 +01:00
Lennart Poettering 192602cb1e
Merge pull request #10734 from yuwata/network-use-structured-initializers
network: several cleanups
2018-11-12 11:42:02 +01:00
Yu Watanabe 3e5700428e network: allocate hashmap objects when they are required 2018-11-12 16:32:11 +09:00
Yu Watanabe 0f7f27694e network: fixes related to NetworkConfigSection
- Do not allocate NetworkConfigSection when filename == NULL
- set .network element before calling hashmap_put()
- Always free NetworkConfigSection in each object.
2018-11-12 16:32:11 +09:00
Yu Watanabe 17f9c355d5 network: use structured initializers 2018-11-12 16:32:10 +09:00
Yu Watanabe 3c7911e810 network: use IN_ADDR_NULL 2018-11-12 00:48:30 +09:00
Tobias Jungel 7ecf0c3e17 networkd: don't remove route
In case networkd is restarted this prevents a removal of an already existing
route that would be configured using networkd. With the proposed changes the
route will be kept on the interface without removing. This happens only on
physical hosts or VMs since networkd handles interface configuration slightly
different in containers.
2018-11-06 13:28:12 +01:00
Lennart Poettering c0815ca93d
Merge pull request #10407 from yuwata/netlink-slot
sd-netlink: introduce sd_netlink_slot object and relevant functions
2018-10-18 18:05:58 +02:00
Hui Yiqun 2d53f310de networkd: type support for "throw" in [Route] section 2018-10-16 17:09:21 +02:00
Yu Watanabe 8190a388a6 sd-netlink: make sd_netlink_slot take its description 2018-10-16 18:42:23 +09:00
Yu Watanabe ee38400bba sd-netlink: introduce sd_netlink_slot 2018-10-15 18:10:04 +09:00