Commit Graph

24 Commits

Author SHA1 Message Date
Lennart Poettering 39cf0351c5 tree-wide: make use of new relative time events in sd-event.h 2020-07-28 11:24:55 +02:00
Yu Watanabe 1a6c913676 libsystemd-network: rename index -> ifindex 2020-07-02 16:58:06 +09:00
Dan Streetman 6b8a1aa6a3 network: return 1 on start and 0 if ipv4ll is already started
Instead of -EBUSY, return 0 from sd_ipv4ll_start() if it's already started,
and change successful start return value to 1.

This matches sd_ndisc_start() behavior; 1 indicates successful start, and
0 indicates already started.
2020-05-26 09:52:50 -04:00
Zbigniew Jędrzejewski-Szmek ca78ad1de9 headers: remove unneeded includes from util.h
This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
2019-03-27 11:53:12 +01:00
Yu Watanabe 3e29b8895a libsystemd-network: set SOCK_CLOEXEC and SOCK_NONBLOCK 2018-11-12 02:03:22 +09:00
Zbigniew Jędrzejewski-Szmek 6d7c403324 tests: use a helper function to parse environment and open logging
The advantages are that we save a few lines, and that we can override
logging using environment variables in more test executables.
2018-09-14 09:29:57 +02: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
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
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
Yu Watanabe 1950011227 tree-wide: do not work in assert()
Follow-up for 85e55d14de.
2017-11-09 18:38:02 +09:00
Patrik Flykt 5a67ed2403 test-ndisc-rs.c: Test Router Solicitation timer computation
Test ICMPv6 Router Solicitation exponential backoff timer by
computing the minimum and maximum values according to RFC 7559,
Section 2 and the algorithm itself described in RFC 3315, Section
14. Reset the sd_ndisc timer to trigger after a zero second delay,
which causes the ndisc timeout to be triggered immediately once
the caller of the "sending" function returns to the main loop.
2017-05-30 10:34:15 +03:00
Patrik Flykt 88d5a3db55 sd-radv: Receive Router Solicitations
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-15 14:49:50 +03:00
Patrik Flykt 6142bb37a5 icmp6-util: Bind Router Advertisement socket
Reuse and refactor the functionality already present for Router
Solicitations in order to create a socket for sending Router
Advertisements. Anticipate reception of incoming Router
Solicitations by setting the ICMPv6 filter accordingly. Also set
the unicast hop limit to 255 for ICMPv6 sockets as unicast Router
Advertisments are to be sent in response to Router Solicitations.

Update the Router Solicitation test case code with a function
definition in order to keep the test case working.
2017-05-15 14:49:50 +03:00
Lennart Poettering 1e7a0e21c9 network: beef up ipv6 RA support considerably
This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:

- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
  new configuration options have been added to networkd to make this
  configurable.

- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
  message, and has direct, friendly acessor functions for the singleton RA
  properties, as well as an iterative interface to iterate through known and
  unsupported options. The router object may either be retrieved from the wire,
  or generated from raw data. In many ways the sd-ndisc API now matches the
  sd-lldp API, except that no implicit database of seen data is kept. (Note
  that sd-ndisc actually had a half-written, but unused implementaiton of such
  a store, which is removed now.)

- sd-ndisc will now collect the reception timestamps of RA, which is useful to
  make sd_ndisc_router fully descriptive of what it covers.

Fixes: #1079
2016-06-06 20:11:38 +02:00
Lennart Poettering 2f8e763376 sd-network: rename "index" field of the various clients to "ifindex"
A field "index" is not particularly precise and also might conflict with libc's
index() function definition. Also, pretty much everywhere else we call this
concept "ifindex", including in networkd, the primary user of these libraries.
Hence, let's fix this up and call this "ifindex" everywhere here too.
2016-05-26 15:34:42 +02:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Tom Gundersen 9d96e6c3ef sd-ndisc: introduce separate callbacks
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-11 15:42:38 +01:00
Tom Gundersen cb53894d3b sd-ndisc: notify user on STOP
Also, stop the state machine when we get into a broken state, rather than just notify the user.
2015-11-11 15:42:38 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file 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-24 23:05:02 +02:00
Tom Gundersen 4e5ca364f4 sd-ndisc: drop sd_ndisc_get_prefixlen()
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-22 17:19:54 +02:00
Tom Gundersen 940367a0ab libsystemd-network: split icm6-util.[ch] out of dhcp6 code 2015-10-22 17:19:54 +02:00
Tom Gundersen 4d7b83da7b sd-ndisc: rename API from sd-icmp6-nd 2015-10-22 17:19:54 +02:00
Tom Gundersen 3ad0c5d8a4 sd-icmp6-nd: rename files to sd-ndisc
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).
2015-10-22 17:19:54 +02:00
Renamed from src/libsystemd-network/test-icmp6-rs.c (Browse further)