summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/radv-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* network: Add support to advertie ipv6 routeSusant Sahani2019-09-171-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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:: ```
* Drop trailing slash from assert_cc() definitionZbigniew Jędrzejewski-Szmek2019-07-171-1/+1
| | | | | | We use assert_cc(...); almost everywhere. Let's always require that. https://github.com/systemd/systemd/issues/12997#issuecomment-510103988
* tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek2019-07-041-1/+1
| | | | This replaces the internal uses of __FILE__ with the new macro.
* libsystemd-network: remove _packed_ attribute to appease the compilerZbigniew Jędrzejewski-Szmek2019-02-041-10/+25
| | | | | | | | | | | | | | gcc-9 warns whenever the elements of a structure defined with _packed_ are used: ../src/network/networkd-dhcp6.c: In function ‘dhcp6_pd_prefix_assign’: ../src/network/networkd-dhcp6.c:92:53: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member] 92 | r = manager_dhcp6_prefix_add(link->manager, &p->opt.in6_addr, link); | ^~~~~~~~~~~~~~~~ And the compiler is right, because in principle the alignment could be wrong. In this particular case it is not, because the structure is carefully defined not to have holes. Let's remove _packed_ and use compile-time asserts to verify that the offsets are not changed.
* sd-radv: remove log_radv_warning_errno()Lennart Poettering2018-10-021-1/+0
| | | | | | 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.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-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.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-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.
* radv: Add prefixes with dynamically updated lifetimesPatrik Flykt2018-01-041-0/+3
| | | | | | | | | | | | | 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.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-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.
* networkd: Automatically set DNS and search domain informationPatrik Flykt2017-10-061-2/+0
| | | | | | | | | | | | When EmitDNS or EmitDomains is set, automatically look up values for Router Advertisement DNS and DNS search domain options starting with the values in the IPv6PrefixDelegationsection, if any. If none are found, use the values set for the network, and as a last resort try with the preferred upstream network. The default DNS lifetime and therefore Router Advertisement interval is added to the public sd_radv.h header as the DNS lifetime depends on the maximum advertisement interval.
* sd-radv: Add Router Advertisement DNS Search List optionPatrik Flykt2017-09-151-0/+2
| | | | | | | | | | | 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.
* sd-radv: Add Router Advertisement DNS informationPatrik Flykt2017-09-071-0/+12
| | | | | Add Router Advertisement Recursive DNS Server information as specified in RFC 8106.
* sd-radv: Receive Router SolicitationsPatrik Flykt2017-05-151-0/+1
| | | | | | | | 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.
* sd-radv: Send Router AdvertismentsPatrik Flykt2017-05-151-0/+1
| | | | | | | 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.
* sd-radv: Implement Router Advertisement timeout handlingPatrik Flykt2017-05-151-0/+13
| | | | | | | | | | | 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.
* sd-radv: Add Router Advertisement functionalityPatrik Flykt2017-05-151-0/+25
| | | | | Add Router Advertisement header files, data structures and core functionality that is quite similar to other parts of networkd.
* sd-radv: Add Router Advertisement prefix handlingPatrik Flykt2017-05-151-0/+48
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.