summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ndisc.c
AgeCommit message (Collapse)Author
2016-02-20libsystemd-network: sd-event uses 64bit priorities, expose them in the APIs ↵Lennart Poettering
as such
2016-02-16networkd: FIONREAD is not reliable on some socketsLennart Poettering
Fixes: #2457
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-18sd-ndisc: simplify if stmt and reindent log messagesZbigniew Jędrzejewski-Szmek
Merge separate two error handling statements into two nested ifs. This looks cleaner, and avoids a gcc warning about *prefix being uninitialized. While at it, fix identation of logging statements elsewhere in the file.
2016-01-18sd-ndisc: simplify ndisc_prefix_newZbigniew Jędrzejewski-Szmek
If the initial allocation succeeded, there is no way to fail, so cleanup function is not necessary.
2015-11-27tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering
GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
2015-11-25sd-ndisc: better validate RA packetsTom Gundersen
Verify the hoplimit and that the received packet is large enough for the RA header. See <http://tools.ietf.org/html/rfc4861#section-6.1.2>.
2015-11-25sd-ndisc: always send the link-layer addressTom Gundersen
We never send packets without first knowing the link-local L3 address, so we should always include the L2 address in RS packets.
2015-11-25libsystemd-network: clean up recv functionsTom Gundersen
2015-11-19nd-ndisc: don't fail if src address is unsetTom Gundersen
This happens when running our test-suite over a socketpair, so don't fall over in that case. Fixes issue #1952.
2015-11-19sd-ndisc: drop RA packets from non-link-local addressesTom Gundersen
See https://tools.ietf.org/html/rfc4861#section-4.2. Some routers (dnsmasq) will send packets from global addresses, which would break the default route setup, so ignore those. This is also what the kernel does.
2015-11-16networkd: ndisc/dhcpv6 - handle starting running clientsTom Gundersen
The clients may be triggered to be started repeatedly without being stopped first, simply swallow the error rather than failing the link.
2015-11-12sd-ndisc: add missing parensTom Gundersen
Reported by Thomas Andersen.
2015-11-11networkd: ndisc - handle router advertisement in userspaceTom Gundersen
Router Discovery is a core part of IPv6, which by default is handled by the kernel. However, the kernel implementation is meant as a fall-back, and to fully support the protocol a userspace implementation is desired. The protocol essentially listens for Router Advertisement packets from routers on the local link and use these to configure the client automatically. The four main pieces of information are: what kind (if any) of DHCPv6 configuration should be performed; a default gateway; the prefixes that should be considered to be on the local link; and the prefixes with which we can preform SLAAC in order to pick a global IPv6 address. A lot of additional information is also available, which we do not yet fully support, but which will eventually allow us to avoid the need for DHCPv6 in the common case. Short-term, the reason for wanting this is in userspace was the desire to fully track all the addresses on links we manage, and that is not possible for addresses managed by the kernel (as the kernel does not expose to us the fact that it manages these addresses). Moreover, we would like to support stable privacy addresses, which will soon be mandated and the legacy MAC-based global addresses deprecated, to do this well we need to handle the generation in userspace. Lastly, more long-term we wish to support more RA options than what the kernel exposes.
2015-11-11sd-ndisc: introduce separate callbacksTom Gundersen
As the data passed is very different, we introduce four different callbacks: - Generic - router discovery timed out or state machine stopped - Router - router and link configuration received - Prefix onlink - configuration for an onlink prefix received - Prefix autonomous - configuration for to configure a SLAAC address for a prefix received
2015-11-11sd-ndisc: notify user on STOPTom Gundersen
Also, stop the state machine when we get into a broken state, rather than just notify the user.
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-10-22sd-ndisc: reduce callbacksTom Gundersen
Only callback on error when the statemachine is in a truly broken state. This is now only the case when we fail to rearm a timer.
2015-10-22sd-ndisc: drop sd_ndisc_get_prefixlen()Tom Gundersen
This is unused, and in the future we will pass prefixes and prefixlengths directly to the callbacks when needed rather than having to search for them.
2015-10-22sd-ndisc: drop sd_ndisc_prefix_match()Tom Gundersen
This is no longer used.
2015-10-22sd-ndisc: don't trigger timeout on prefix expiryTom Gundersen
The caller of the library is no longer notified, so triggering a timer just to clean up is not necessary. Instead check for and clean up invalid prefixes lazily.
2015-10-22sd-ndisc: remove a prefix from the ndisc object when freeing itTom Gundersen
This follows the coding style, and allows some simplification to the rest of the code.
2015-10-22sd-ndisc: don't inform the caller of expired prefixesTom Gundersen
The caller should push any lifetime information into the kernel and let the kernel handle prefix expiration.
2015-10-22sd-ndisc: clean up state enumTom Gundersen
There is no need to assign valuse to the states. Also add _INVALID and _MAX, even though these are not used, it keeps it consistent.
2015-10-22sd-ndisc: rename icmp6 to ndisc throughout the codeTom Gundersen
2015-10-22libsystemd-network: split icm6-util.[ch] out of dhcp6 codeTom Gundersen
2015-10-22sd-ndisc: rename API from sd-icmp6-ndTom Gundersen
2015-10-22sd-icmp6-nd: rename files to sd-ndiscTom Gundersen
The actual code rename will follow. The reason for the change of name is to make it simpler and more uniform with how we name other libraries (we don't include the underlying protocol). The new name also matches the naming in the kernel (which is particularly relevent here as we expect to let the kernel do some parts of the protocol and we do others).