Commit graph

85 commits

Author SHA1 Message Date
Yu Watanabe d739fddeb5 network: add setting to support RA without DHCPv6 client
Closes #13991.
2020-03-07 01:39:26 +09:00
Susant Sahani a781ddefe5 network: make use of generate_ipv6_eui_64_address 2020-03-01 00:49:24 +09:00
Kevin P. Fleming c24c83dc67 network: Allow multiple IPv6Token 'static' items to generate addresses
This patch allows multiple addresses using 'static' IPv6Tokens to
be generated for a single network interface.
2020-02-10 18:40:57 +09:00
Kevin P. Fleming 0ddad04eda network: Document the lack of actual DAD usage in prefixstable algorithm
The RFC 7217 (prefixstable) algorithm can use Duplicate Address
Detection to produce multiple candidate addresses, but the implementation
here does not currently employ that mechanism.
2020-02-10 15:37:30 +09:00
Kevin P. Fleming 53f8cced45 network: Correct typo and naming in error message
This error message will be emitted when any form of SLAAC address
generation fails, not just 'prefix stable', so the message should
only refer to SLAAC.
2020-02-10 15:37:13 +09:00
Kevin P. Fleming 87f9d6ea8e network: Improve variable name for address generation
The logic which can produce an IPv6 address using SLAAC produces an
address, not a prefix, so the boolean variable used to detect whether
it succeeded should reflect that.
2020-02-10 15:36:46 +09:00
Yu Watanabe b751c3e747 network fix parser for IPv6Token=
extract_first_word() drops multiple ':'. So, it is not suitable for
parsing 'static' case.
2020-02-10 00:40:18 +09:00
Yu Watanabe f0c1ad308d network: fix ABRT
Fixes #14811 and oss-fuzz#20548.
2020-02-07 17:18:58 +09:00
Yu Watanabe e2c4070edf network: rename eui64 to static
See RFC 4291.

Follow-up for 5f506a5560.
2020-02-07 13:30:40 +09:00
Susant Sahani 5f506a5560 network: Allow to specify multiple IPv6Token for SLAAC
Provide names to choose between different auto-generation types:
2.1 "eui64" for EUI-64 of RFC 4291
2.2 "prefixstable" for RFC 7217

```
[Match]
Name=veth99

[Network]
DHCP=no
IPv6AcceptRA=yes
IPv6Token=prefixstable:2001:888:0db8:1::
```
2020-02-05 17:44:42 +09:00
Yu Watanabe 1985c54ff3 network: static routes via DHCP gateway
This makes Gateway= also take "DHCP". If "DHCP" is set, then the gateway
address provided by DHCP or IPv6 RA is used.

Closes #8213.
2020-01-07 19:10:54 +09:00
Yu Watanabe 5ecb131d94 network: include NLMSGERR_ATTR_MSG attribute in error message 2019-11-30 16:14:02 +09:00
Yu Watanabe 55d3fdcf5e network: ndisc: do not drop all prefixes when a prefix matches a blacklist
Fixes #13767.
2019-10-14 20:54:43 +09:00
Yu Watanabe 4ff296b024 network: make link enter failed state when a configuration fails
Some path of configuring address, route or etc., go to failed state, but
some do not. E.g., failure in address configuration which is provided by
DHCPv4 goes to failed state, but static address does not.

This is just for consistency. This should not change anything if
everything is fine.

This also voidify manager_rtnl_process_address().
2019-07-15 21:52:06 +09:00
Yu Watanabe 6545067aa9 network: re-assign static routes when dynamic address is updated
Follow-up for b5799eeb07.

Closes #7354.
2019-07-11 22:37:00 +09:00
Yu Watanabe 73854ba1a0 network: process address reply message 2019-07-11 22:37:00 +09:00
Yu Watanabe e4443f9bfc network: fix memleak
set_put() does not return -EEXIST.

Fixes #12995 and oss-fuzz#15678.
2019-07-10 12:27:48 +02:00
Yu Watanabe ca5ad760a5 network: move conf parsers and function prototypes 2019-06-30 04:45:56 +09:00
Yu Watanabe c442331750 network: ignore requested ipv6 route when ipv6 is disabled by sysctl 2019-06-12 11:03:08 +09:00
Yu Watanabe 54a1a535bd network: ignore requested ipv6 addresses when ipv6 is disabled by sysctl 2019-06-12 11:02:33 +09:00
Susant Sahani e520ce6440 networkd: Ability to selectively ignore IPv6 prefixes supplied via router advertisement
Closes https://github.com/systemd/systemd/issues/10647
2019-05-19 22:23:06 +09:00
Yu Watanabe 86e2be7bc3 network: drop unnecessary initializations 2019-05-11 06:24:04 +09:00
Yu Watanabe 57e447078d network: replace inet_ntop() with in_addr_to_string() 2019-05-09 01:44:31 +02:00
Yu Watanabe ce2ea782c2 network: fix conditional jump depends on uninitialised value(s)
When address is in IPv4, the remaining buffer in in_addr_union may
not be initialized.

Fixes the following valgrind warning:
```
==13169== Conditional jump or move depends on uninitialised value(s)
==13169==    at 0x137FF6: UnknownInlinedFun (networkd-ndisc.c:77)
==13169==    by 0x137FF6: UnknownInlinedFun (networkd-ndisc.c:580)
==13169==    by 0x137FF6: ndisc_handler.lto_priv.83 (networkd-ndisc.c:597)
==13169==    by 0x11BE23: UnknownInlinedFun (sd-ndisc.c:201)
==13169==    by 0x11BE23: ndisc_recv.lto_priv.174 (sd-ndisc.c:254)
==13169==    by 0x4AA18CF: source_dispatch (sd-event.c:2821)
==13169==    by 0x4AA1BC2: sd_event_dispatch (sd-event.c:3234)
==13169==    by 0x4AA1D88: sd_event_run (sd-event.c:3291)
==13169==    by 0x4AA1FAB: sd_event_loop (sd-event.c:3313)
==13169==    by 0x117401: UnknownInlinedFun (networkd.c:113)
==13169==    by 0x117401: main (networkd.c:120)
==13169==  Uninitialised value was created by a stack allocation
==13169==    at 0x1753C8: manager_rtnl_process_address (networkd-manager.c:479)
```
2019-05-07 16:55:19 +02:00
Yu Watanabe 87d8a4dee8 network: merge conditions and use FLAGS_SET() macro 2019-02-27 16:48:19 +09:00
Yu Watanabe e8c9b5b06f network: make ndisc_router_process_options() propagate error
And its caller ignore the error.
2019-02-27 16:48:19 +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 bdb9f58086 network: honor VRF table or explicitly specified route table 2019-02-15 11:45:39 +09:00
Susant Sahani 062c2eea3a networkd: ipv6ra allow to ignore addresses
Allows to ignore prefixes.

```
UseAutonomousPrefix=
UseOnLinkPrefix=
```

closes #9582
2019-02-14 21:05:17 +05:30
Fabrice Fontaine d909e4af6a networkd-ndisc.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:30:38 +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
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 10ff4eb621 network: rename ndisc_route_handler() to ndisc_netlink_message_handler()
As it is also called when configuring addresses.
2018-12-02 06:28:44 +01:00
Yu Watanabe d5017c8410 network: make ndisc related handlers return negative errno but caller ignore the errors 2018-11-12 16:32:10 +09:00
Yu Watanabe c6de4729b1 network: rename ndisc_netlink_handler() to ndisc_route_handler() 2018-10-10 14:43:05 +09:00
Yu Watanabe 1046bf9b1a network: add destroy callbacks for asynchronous netlink calls 2018-10-10 14:43:05 +09:00
Yu Watanabe 51517f9e09 network: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
Lennart Poettering 810adae9e9 tree-wide: use proper unicode © instead of (C) where we can
Let's use a proper unicode copyright symbol where we can, it's prettier.

This important patch is very important.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering 8e766630f0 tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.

In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.

Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.

Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.

Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
2018-04-25 12:31:45 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Lennart Poettering 8c6f6a2f91
Merge pull request #6910 from ssahani/issue-6359
networkd: For IPv6 addresses do not treat IFA_F_DEPRECATED as not ready. (Fix #6359)
2017-11-20 19:21:36 +01:00
Lennart Poettering 4ff971ac08
Merge pull request #6918 from ssahani/issue-5625
networkd: ndisc - do not stop ndisc client incase of conf error.
2017-11-20 19:20:23 +01:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Susant Sahani 7f676aa324 networkd: ndisc Do not stop ndisc client incase of conf error.
Now in ndisc_netlink_handler if route or address fails we stop the clients.
link_enter_failed->link_stop_clients that is dhcp, ndisc etc.

The clients should be keep on running .

Fixes #5625
2017-09-26 17:17:32 +05:30
Susant Sahani 92bdc3ffce networkd: ndisc The preferred lifetime is never greater than the valid lifetime.
Silently ignore if the preferred lifetime is never greater than the
valid lifetime.
2017-09-26 16:26:18 +05:30
hendrikw01 6554550f35 networkd: RFC compliant autonomous prefix handling (#5636)
Previously, `lifetime_valid` of a Router Advertisement was not handled
the way RFC4862 has specified.

In particular: Sections 5.5.3.d and  5.5.3.e
2017-03-31 15:10:59 +02:00
Cédric Schieli fe0252e5b8 ndisc: honor IPv6AcceptRA.UseDNS when parsing RA options (#5071)
RDNSS and DNSLL options received in RA are always used, possibly breaking the resolution of private domains hosted on a local DNS server. When setting UseDNS=no in a [IPv6AcceptRA] section of a .network file, both RDNSS and DNSLL options in received RA should be ignored. 

Fixes: #5040
2017-01-16 12:23:26 -05:00
Susant Sahani 91b8fd3cad networkd: RouteMetric for IPv6 Stateless Autoconfiguration (#5045)
Add support to set route metric for IPv6

Fixes: #5002
2017-01-10 08:58:04 +01:00