summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/icmp6-util.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: copy timestamp data from cmsgYu Watanabe2023-04-161-3/+5
| | | | | | | On RISCV32, time_t is 64bit and size_t is 32bit, hence the timestamp data in message header may not be aligned. Fixes #27241.
* tree-wide: port more code over to CMSG_TYPED_DATA()Lennart Poettering2023-04-131-2/+2
|
* tree-wide: use -EBADF moreYu Watanabe2022-12-211-1/+1
|
* icmp6: shorten code a bitYu Watanabe2021-10-211-7/+6
|
* journal,network,timesync: fix segfault on 32bit timeval/timespec systemsYu Watanabe2021-09-161-1/+2
| | | | Fixes #20741.
* socket-util: introduce CMSG_SPACE_TIMEVAL/TIMESPEC macro to support ↵Yu Watanabe2021-08-301-1/+1
| | | | | | additional 64bit timeval or timespec Fixes #20482 and #20564.
* icmp6: drop unnecessary assertionYu Watanabe2021-08-201-1/+0
| | | | Follow-up for 3691bcf3c5eebdcca5b4f1c51c745441c57a6cd1.
* icmp6-util: add missing variable initializationLennart Poettering2021-02-231-1/+1
| | | | Coverity 1446712
* tree-wide: use in_addr_is_set() or friendsYu Watanabe2021-02-181-7/+11
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* libsystemd-network: rename index -> ifindexYu Watanabe2020-07-021-4/+4
|
* tree-wide: make sure our control buffers are properly alignedLennart Poettering2020-05-071-5/+3
| | | | | | | | | | | | | We always need to make them unions with a "struct cmsghdr" in them, so that things properly aligned. Otherwise we might end up at an unaligned address and the counting goes all wrong, possibly making the kernel refuse our buffers. Also, let's make sure we initialize the control buffers to zero when sending, but leave them uninitialized when reading. Both the alignment and the initialization thing is mentioned in the cmsg(3) man page.
* icmp6-util: port to recvmsg_safe()Lennart Poettering2020-04-241-2/+2
| | | | Split out of #15457, let's see if this is the culprit of the CI failure.
* tree-wide: drop socket.h when socket-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: port various users over to socket_bind_to_ifindex()Lennart Poettering2019-03-181-8/+4
|
* tree-wide: use IOVEC_MAKE() at many placesLennart Poettering2018-11-271-3/+3
|
* tree-wide: use setsockopt_int() moreYu Watanabe2018-10-191-7/+6
|
* tree-wide: introduce setsockopt_int() helper and make use of it everywhereLennart Poettering2018-10-181-6/+6
| | | | | | As suggested by @heftig: https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
* tree-wide: add a single version of "static const int one = 1"Lennart Poettering2018-10-151-4/+4
| | | | | | | | | | All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
* icmp6-util: stop ignoring EAGAIN and EINTR in icmp6_receiveEvgeny Vereshchagin2018-10-021-5/+1
| | | | | | | | | The code handling the errors was originally part of ndisc_recv, which, being an event handler, would be simply turned off if it returned a negative error code. It's no longer necessary. Plus, it helps avoid passing an uninitialized value to radv_send. Closes https://github.com/systemd/systemd/issues/10223.
* 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.
* macro: introduce new TAKE_FD() macroLennart Poettering2018-03-221-3/+1
| | | | | | | This is similar to TAKE_PTR() but operates on file descriptors, and thus assigns -1 to the fd parameter after returning it. Removes 60 lines from our codebase. Pretty good too I think.
* 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.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-10-021-1/+1
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* sd-radv: Receive Router SolicitationsPatrik Flykt2017-05-151-0/+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.
* icmp6-util: Bind Router Advertisement socketPatrik Flykt2017-05-151-10/+35
| | | | | | | | | | | | 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.
* network: beef up ipv6 RA support considerablyLennart Poettering2016-06-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* networkd: networkd: ndisc set SO_BINDTODEVICE on socket (#3294)Susant Sahani2016-05-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | From the issue #2004 we are receiving packet even if this packet is not intended for this interface. This can be reproduced. lp3s0: Updating address: 2001:db8:1:0:7e7a:91ff:fe6d:ffe2/64 (valid for 1d) wlp3s0: Updating address: fe80::7e7a:91ff:fe6d:ffe2/64 (valid forever) NDisc CLIENT: Received RA from non-link-local address ::. Ignoring. NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring. NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring. enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d) enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever) NDisc CLIENT: Sent Router Solicitation NDisc CLIENT: Sent Router Solicitation NDisc CLIENT: Sent Router Solicitation NDisc CLIENT: Received RA on wrong interface: 3 != 2. Ignoring. NDisc CLIENT: Received RA on wrong interface: 3 != 6. Ignoring. NDisc CLIENT: Received RA from non-link-local address ::. Ignoring. NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring. NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring. enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d) enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever) Add SO_BINDTODEVICE to socket fixes #2004
* sd-ndisc: better validate RA packetsTom Gundersen2015-11-251-13/+11
| | | | | | | 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>.
* sd-ndisc: always send the link-layer addressTom Gundersen2015-11-251-10/+10
| | | | | We never send packets without first knowing the link-local L3 address, so we should always include the L2 address in RS packets.
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-9/+9
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* libsystemd-network: split icm6-util.[ch] out of dhcp6 codeTom Gundersen2015-10-221-0/+129