Commit Graph

178 Commits

Author SHA1 Message Date
Yu Watanabe 93b0b88c3a network: free address when it is removed 2020-07-15 17:15:25 +09:00
Zbigniew Jędrzejewski-Szmek de7fef4b6e tree-wide: use set_ensure_put()
Patch contains a coccinelle script, but it only works in some cases. Many
parts were converted by hand.

Note: I did not fix errors in return value handing. This will be done separate
to keep the patch comprehensible. No functional change is intended in this
patch.
2020-06-22 16:32:37 +02:00
Zbigniew Jędrzejewski-Szmek 10b20e5a93 network: allow empty assignment to PreferredLifetime=
Users might want to use that to unset a previous setting. The docs seem OK as
they are: we don't need to explictly mention the empty value, since it is
almost always allowed.
2020-05-25 14:52:04 +02:00
Zbigniew Jędrzejewski-Szmek d273579667 network: use consistent type when parsing lifetimes
Those fields are both uint32_t, so we should use the same type when parsing.
Having a different type didn't change the result, but let's be consistent.
2020-05-25 14:52:00 +02:00
Susant Sahani 5ead535224 network: Introduce method to generate EUI-64 addresses 2020-03-01 00:16:51 +09:00
Yu Watanabe 07336a0672 network: assume Scope=host when Address= is loopback address
Fixes #14903.
2020-02-28 09:53:36 +01:00
Kevin P. Fleming 8a98f11ed0 network: Make address_hash_ops available outside of networkd-address.c
In order to allow other parts of systemd-networkd to use sets/hashmaps
of Address objects, the address_hash_ops structure needs to be made
available to them.
2020-02-10 15:37:37 +09:00
Yu Watanabe 98b0299479 network: append INTERFACE= attributes for logs corresponds to a netif 2020-01-07 22:20:43 +09:00
Yu Watanabe de697db05b network: introduce AddPrefixRoute= and deprecate PrefixRoute=
PrefixRoute= was added by e63be0847c,
but unfortunately, the meaning of PrefixRoute= is inverted; when true
IFA_F_NOPREFIXROUTE flag is added. This introduces AddPrefixRoute=
setting.
2019-12-18 16:32:31 +01:00
AJ Bagwell e92b60b20f ipv4ll: do not reset conflict counter on restart
Don't reset the conflict counter when trying a new pseudo random
address, so that after trying 10 addresses the londer timeout is used in
accordance with the RFC

Fixes #14299.
2019-12-11 13:26:31 +09:00
Susant Sahani 051e77cac1 network: introduce DAD for static address
Closes #2527.
2019-12-06 23:29:07 +09:00
Yu Watanabe 5ecb131d94 network: include NLMSGERR_ATTR_MSG attribute in error message 2019-11-30 16:14:02 +09:00
Zbigniew Jędrzejewski-Szmek 24be91817f networkd: split out helper function for address extraction 2019-09-17 19:09:57 +02: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 ce158189a8 network: do not check deprecated flag in address_is_ready()
Without this change, the address with PreferredLifetime=0 cannot be ready,
and thus, no consequent setting up process does not start.
The bug was introduced by 6aa5773.

Follow-up for b7ed5384ab.

Fixes #13341.
2019-08-19 00:04:42 +09:00
Yu Watanabe 75a302b561 network: fix potential memleaks related to set_put() 2019-08-11 08:57:01 +09:00
Yu Watanabe fe2e4b6961 tree-wide: use htobe{32,16}() instead of hton{l,s}() 2019-06-20 06:34:05 +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 54a1a535bd network: ignore requested ipv6 addresses when ipv6 is disabled by sysctl 2019-06-12 11:02:33 +09:00
Yu Watanabe 3681d63935 network: fix UBSAN issue
Closes #12724.
2019-06-04 09:12:44 +02:00
Yu Watanabe 67a4683364 network: use IN_ADDR_NULL and ETHER_ADDR_NULL
The change in manager_rtnl_process_address() may not be necessary,
but for safety, let's initialize the value.
2019-05-07 16:55:19 +02:00
Lennart Poettering 0a9707187b util: split out memcmp()/memset() related calls into memory-util.[ch]
Just some source rearranging.
2019-03-13 12:16:43 +01:00
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 7750b79695 network: update logs 2019-03-11 08:10:50 +01:00
Yu Watanabe 7e43ebfbf9 network: propagate error from in_addr_is_null() 2019-03-01 15:55:55 +09:00
Yu Watanabe c9207ff3a4 network: check prefixlen when null address is specified to Address= 2019-03-01 15:52:12 +09:00
Yu Watanabe 2850cd40ee network: wrap long lines 2019-02-28 10:57:20 +09:00
Yu Watanabe 33680b0a26 network: simplify config_parse_lifetime() 2019-02-28 10:56:33 +09:00
Yu Watanabe 4aa4c4b0f4 network: avoid address section freed
Otherwise, if HomeAddress= or friends are specified at the first line of
a section, then its assignment will be ignored.
2019-02-28 10:54:20 +09:00
Yu Watanabe 959f65d32e network: make bond master follow operstates of slaves
If one of bond slaves is in off, no-carrier, or dormant, then
bond master is set to degraded.
2019-02-18 18:04:11 +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
Fabrice Fontaine 081aea2502 networkd-address.c: fix build without IFA_F_NOPREFIXROUTE
systemd fails to build on kernel without IFA_F_NOPREFIXROUTE
since 9714c02

So put include missing_network.h

Fixes:
 - http://autobuild.buildroot.org/results/970b09e1d49b53dff12a07ca4ad424ef9dd29a69

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-02-03 18:34:36 +01:00
Yu Watanabe 0f707207b9 network: warn if Address= is specified without prefixlen
This is the first step for #11307.
2019-01-29 07:36:35 +01:00
Yu Watanabe 9e0fdc211b util: add a new mode for in_addr_prefix_from_string_auto_internal() which refuses address without prefixlen
This also drops in_addr_default_prefix_from_string(), as it is only
used by test-in-addr.
2019-01-29 07:35:17 +01:00
Susant Sahani dfef713f3e networkd: wait for kernel to reply ipv6 peer address
When we configure address with peer, peer address is repliedby kernel.
Hence add the peer when it is available.

Closes #9130.
2019-01-15 07:36:14 +09:00
Yu Watanabe c8f7123e00 network: always check link is ready when address is updated 2018-12-23 08:04:36 +09:00
Yu Watanabe 66e0bb336e network: decrease and fix indentation 2018-12-23 07:38:55 +09: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
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 63ae056909 network: use address_remove_handler() as the default callback of address_remove() 2018-12-02 06:23:45 +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
Tobias Jungel 30226d2718 networkd: don't remove ip address
In case networkd is restarted this prevents a removal of an already existing IP
address that would be configured using networkd. With the proposed changes the
IP address 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:26:37 +01:00
Lennart Poettering a54e373163
Merge pull request #10618 from yuwata/fix-10615
network: fix several issues in config parser
2018-11-05 17:37:25 +03:00
Yu Watanabe b7cb445235 network: use in_addr_default_prefix_from_string_auto() in config_parse_address() 2018-11-05 16:46:26 +09:00