summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-radv.c
AgeCommit message (Collapse)AuthorFilesLines
2019-11-05sd-radv: fix memleakYu Watanabe1-0/+7
2019-09-20sd-radv: if lifetime < SD_RADV_DEFAULT_MAX_TIMEOUT_USEC, adjust timeout (#13491)Georg Müller1-0/+11
The RFC states that lifetime (AdvDefaultLifetime) must be at least MaxRtrAdvInterval (which more or less corresponds to SD_RADV_DEFAULT_MAX_TIMEOUT_USEC in systemd). To fulfill this limit, virtually lower MaxRtrAdvInterval and MinRtrAdvInterval accordingly. Also check that min is not lower than 3s and max is not lower than 4s.
2019-09-17network: Add support to advertie ipv6 routeSusant Sahani1-2/+128
Implements https://tools.ietf.org/html/rfc4191 cat veth99.network ``` [Match] Name=veth99 [Network] DHCP=no IPv6PrefixDelegation=yes Address=2001:db8:0:1::1/64 [IPv6Prefix] Prefix=2001:db8:0:1::4/64 [IPv6RoutePrefix] Route=2001:db0:fff::/48 ``` Wireshark ``` Frame 481: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) on interface 0 Ethernet II, Src: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4), Dst: IPv6mcast_01 (33:33:00:00:00:01) Internet Protocol Version 6, Src: fe80::1c04:f8ff:feb8:2fd4, Dst: ff02::1 Internet Control Message Protocol v6 Type: Router Advertisement (134) Code: 0 Checksum: 0xec77 [correct] [Checksum Status: Good] Cur hop limit: 0 Flags: 0x00, Prf (Default Router Preference): Medium Router lifetime (s): 0 Reachable time (ms): 0 Retrans timer (ms): 0 ICMPv6 Option (Source link-layer address : 1e:04:f8:b8:2f:d4) Type: Source link-layer address (1) Length: 1 (8 bytes) Link-layer address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) ICMPv6 Option (MTU : 1500) Type: MTU (5) Length: 1 (8 bytes) Reserved MTU: 1500 ICMPv6 Option (Prefix information : 2001:db8:0:1::4/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: 2592000 Preferred Lifetime: 604800 Reserved Prefix: 2001:db8:0:1::4 ICMPv6 Option (Route Information : Medium 2001:db0:fff::/48) Type: Route Information (24) Length: 3 (24 bytes) Prefix Length: 48 Flag: 0x00, Route Preference: Medium ...0 0... = Route Preference: Medium (0) 000. .000 = Reserved: 0 Route Lifetime: 604800 Prefix: 2001:db0:fff:: ```
2019-05-07sd-radv: fix memleakYu Watanabe1-0/+1
Fixes one memleak found in #12452.
2019-03-13util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering1-1/+1
Just some source rearranging.
2018-11-30networkd: refuse IPv6 RADV prefixes that lack Prefix= settingLennart Poettering1-0/+4
Fixes: #9589
2018-11-27tree-wide: use IOVEC_MAKE() at many placesLennart Poettering1-24/+11
2018-11-26sd-radv: use struct initializersLennart Poettering1-15/+13
2018-11-26sd-radv: per our CODING_STYLE don't use 'bool' in public headersLennart Poettering1-1/+1
2018-11-26sd-radv: no need to initialize r to zeroLennart Poettering1-1/+1
2018-11-26sd-radv: make sure we can deal with in_addr_to_string() failingLennart Poettering1-2/+2
2018-11-26sd-radv: when receiving a too short packet, make sure we dequeue itLennart Poettering1-3/+7
2018-11-26sd-radv: propagate OOM, it's reason to failLennart Poettering1-1/+1
2018-11-26sd-radv: follow our usualy rule that destructors can take NULLLennart Poettering1-1/+2
2018-11-26sd-radv: simplify IPv6 address is-null checkLennart Poettering1-1/+3
2018-11-26sd-radv: drop const from non-ptr argumentLennart Poettering1-2/+1
2018-11-26sd-radv: use ether_addr_is_null() where appropriateLennart Poettering1-2/+2
2018-11-16sd-radv: do not unref() event sources when update or disable themYu Watanabe1-31/+17
2018-11-16sd-radv: use structured initializer at one more placeYu Watanabe1-5/+5
2018-10-02sd-radv: EAGAIN is not really unexpected, distinguishit from other errors ↵Lennart Poettering1-1/+4
when logging
2018-10-02sd-radv: remove log_radv_warning_errno()Lennart Poettering1-4/+4
According to our CODING_STYLE our library code should generally not log beyond LOG_DEBUG. Let's hence get rid of log_radv_warning_errno() and just use log_radv_errno() instead.
2018-08-27tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicableYu Watanabe1-41/+5
2018-06-18Correct a number of trivial typos.Chris Lamb1-1/+1
2018-06-14tree-wide: use proper unicode © instead of (C) where we canLennart Poettering1-1/+1
Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
2018-06-14tree-wide: drop 'This file is part of systemd' blurbLennart Poettering1-2/+0
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-13sd-radv: use strv_isempty() where we canLennart Poettering1-2/+1
2018-06-13sd-radv: normalize function parameters a bitLennart Poettering1-3/+3
Let's add "const" where we don't change structures passed. Also, we generally use "unsigned char" for IP prefix length values, do so here too. Previously different parts of the sd-radv.h API used different types for this.
2018-06-13sd-radv: close fd when destroying objectLennart Poettering1-0/+4
2018-06-13networkd: Don't try to close fd in sd_radv_stop if fd is closed.Susant Sahani1-0/+3
sd_radv_stop is called from two places. if sd_radv_stop is alrady success then just don't try to close it . ``` systemd-networkd[604]: RADV: Stopping IPv6 Router Advertisement daemon systemd-networkd[604]: RADV: Unable to send last Router Advertisement with router lifetime set to zero: Bad file descriptor <==================HERE systemd-networkd[604]: RADV: Updated prefix 2a0a:*:*:fc::/64 preferred 1h valid 2h systemd-networkd[604]: RADV: Started IPv6 Router Advertisement daemon ``` Closes one of the issue #8960
2018-04-06tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek1-13/+0
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-05tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe1-10/+4
2018-01-15Merge pull request #7582 from pfl/dhcp6_prefix_delegationLennart Poettering1-9/+88
DHCPv6 prefix delegation
2018-01-10sd-radv: avoid redefinition of struct in6_addrHans-Christian Noren Egtvedt1-1/+0
Both netinet/icmp6.h and linux/in6.h will define struct in6_addr, and in user space we want to use the netinet/icmp6.h variant. Fixes build problem: In file included from src/libsystemd-network/sd-radv.c:23:0: /home/hegtvedt/work/os/product/sunrise/root/_build/v2/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr'
2018-01-04radv: Allow setting MTU in all casesPatrik Flykt1-3/+0
Setting MTU is allowed in all cases and the MTU value will be announced in the subsequent Router Advertisements.
2018-01-04radv: Add function to remove prefixesPatrik Flykt1-0/+26
As DHCPv6 leases may expire at some point, the delegated prefixes have to be removed. Add a prefix removal function to the Router Advertisement handling code.
2018-01-04radv: Add prefixes with dynamically updated lifetimesPatrik Flykt1-6/+62
Add a boolean that indicates whether the prefixes will always exist or if they will time out after the assigned valid lifetime. In the latter case calculate the expiry times for both preferred and valid lifetimes for the prefixes, and decrease the remaining lifetimes each time when a Router Advertisement is sent. Should the prefix be updated, re-calculate the prefix lifetime. When updating, update the existing entry, if any, with the lifetimes of the added entry as the existing entry has its lifetimes set according to its previously calculated expiry times.
2017-11-19Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek1-0/+1
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-10-20sd-radv: Allocate space also for DNSSL iov option (#7144)Patrik Flykt1-2/+3
The iov array needs to hold five entries in addition to the number of prefixes.
2017-09-18sd-radv: Free DNS domain search list on unref (#6858)Patrik Flykt1-0/+1
2017-09-15sd-radv: Add Router Advertisement DNS Search List optionPatrik Flykt1-0/+60
Add Router Advertisement DNS Search List option as specified in RFC 8106. The search list option uses and identical option header as the RDNSS option and therefore the option header structure can be reused. If systemd is compiled with IDNA support, internationalization of the provided search domain is applied, after which the search list is written in wire format into the DNSSL option.
2017-09-07sd-radv: Add Router Advertisement DNS informationPatrik Flykt1-2/+46
Add Router Advertisement Recursive DNS Server information as specified in RFC 8106.
2017-05-15sd-radv: Receive Router SolicitationsPatrik Flykt1-2/+72
Receive Router Solicitations and send a unicast Router Advertisment in response. Refactor ICMPv6 packet handling code so that the common ICMPv6 validation parts are reused between the existing router discovery and the new functionality adding reception of Router Solicitation messages.
2017-05-15sd-radv: Send Router AdvertismentsPatrik Flykt1-1/+74
Create and remove the ICMPv6 Router Advertisement socket file descriptor and implement Router Advertisment sending. As not all options are mandatory, use IO vectors to point to the included options and the prefix information.
2017-05-15sd-radv: Implement Router Advertisement timeout handlingPatrik Flykt1-0/+113
Router Advertisements are sent uniformly distributed between a minimum and maximum time according to RFC 4861, Section 6.2.4. Default values from RFC 4861 are for now used as minimum and maximum Router Advertisement timeouts. When stopping, a Router Advertisement with a router lifetime set to zero is sent in order to inform any nodes that the interface on this host no longer is a router.
2017-05-15sd-radv: Add Router Advertisement functionalityPatrik Flykt1-0/+261
Add Router Advertisement header files, data structures and core functionality that is quite similar to other parts of networkd.
2017-05-15sd-radv: Add Router Advertisement prefix handlingPatrik Flykt1-0/+136
Define Router Advertisement prefix structure. Add the Prefix Information ICMPv6 option defined in RFC 4861 to the prefix information structure, as it will simplify sending a Prefix Information option later on. In order to handle endianness correctly, the structure is redefined here instead of using the one in netinet/icmp6.h. Add functions to create and modify prefix information and set default values as defined in RFC 4861, Section 6.2.1.