Commit Graph

23 Commits

Author SHA1 Message Date
Yu Watanabe adea26ee62 util: specify the maximum-size element when initialize union
Fixes oss-fuzz#11344.
2018-11-12 00:36:01 +09:00
Yu Watanabe a4798d4e6d util: introduce in_addr_default_prefix_from_string() and friends
It is similar to in_addr_prefix_from_string() but it determines
the prefix length from address if it is not specified.
2018-11-05 16:46:26 +09:00
Yu Watanabe 6c39e02609 basic: introduce in_addr_data_hash_ops 2018-07-31 15:45:38 +09:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
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
Andreas Rammhold 3742095b27
tree-wide: use IN_SET where possible
In addition to the changes from #6933 this handles cases that could be
matched with the included cocci file.
2017-10-02 13:09:54 +02:00
Lennart Poettering 1274b6c687 ip-address-access: minimize IP address lists
Let's drop redundant items from the IP address list after parsing. Let's
also mask out redundant bits hidden by the prefixlength.
2017-09-22 15:24:55 +02:00
Lennart Poettering f4912f3a74 in-addr-util: add new helper call in_addr_prefix_from_string_auto()
This is much like in_addr_prefix_from_string(), but automatically
determines whether IPv4 or IPv6 addresses are specified. Also adds a
test for it.
2017-09-22 15:24:54 +02:00
Lennart Poettering 4e2d527361 in-addr-util: prefix return parameters with ret_ 2017-09-22 15:24:54 +02:00
Lennart Poettering 5a941f5f21 in-addr-util: be more systematic with naming our functions
Let's rename all our functions that process IPv4 in_addr structures
in4_addr_xyz(), following the already establishing naming logic for
this.

Leave the in_addr_xyz() prefix for functions that process the IPv4/IPv6
in_addr_union union instead.
2017-09-22 15:24:54 +02:00
Susant Sahani f7bf1abef9 socket-util: add parse_ip_prefix (#5867)
networkd: replace parse prefix with generic in_addr_prefix_from_string
2017-05-05 20:04:07 -04:00
Susant Sahani 85257f48be socket-util: introduce in_addr_is_multicast
This patch add support to test whether a internet
address is multicast or not.
2017-02-24 15:42:59 +05:30
Lennart Poettering fdedbe2676 basic: add explicit ipv4-specific in_addr classification calls
This adds in4_addr_is_localhost() and in4_addr_is_link_local() that only take
an IPv4 "struct in_addr", to match in_addr_is_localhost() and
in_addr_is_link_local() that that a "union in_addr_union".

This matches the existing in4_addr_is_null() call that already exists.

For IPv6 glibc already exports a set of macros, hence we don't add similar
functions in6_addr_is_localhost(). We also drop in6_addr_is_null() as
IN6_IS_ADDR_UNSPECIFIED() already provides that.
2016-11-21 22:47:47 +01:00
Martin Pitt 207c0b0ee3 Merge pull request #3432 from poettering/resolved-ll-ipv6
resolved: support IPv6 DNS servers on the local link
2016-06-09 10:18:07 +02:00
Lennart Poettering 34380032fb util: make it easier to check whether in_addr or in6_addr addresses are NULL 2016-06-06 19:59:09 +02:00
Lennart Poettering 2817157bb7 resolved: support IPv6 DNS servers on the local link
Make sure we can parse DNS server addresses that use the "zone id" syntax for
local link addresses, i.e. "fe80::c256:27ff:febb:12f%wlp3s0", when reading
/etc/resolv.conf.

Also make sure we spit this out correctly again when writing /etc/resolv.conf
and via the bus.

Fixes: #3359
2016-06-06 19:17:38 +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
Lennart Poettering 97e5d693c0 resolved: add bus API for configuring per-link DNS settings
This is useful for alternative network management solutions (such as NetworkManager) to push DNS configuration data
into resolved.

The calls will fail should networkd already have taken possesion of a link, so that the bus API is only available if
we don't get the data from networkd.
2016-01-19 18:37:45 +01:00
Thomas Hindoe Paaboel Andersen 11c3a36649 basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
2015-11-30 21:51:03 +01:00
Lennart Poettering d830ebbdf6 resolved: never cache RRs originating from localhost
After all, this is likely a local DNS forwarder that caches anyway,
hence there's no point in caching twice.

Fixes #2038.
2015-11-27 00:46:51 +01:00
Kay Sievers a095315b3c build-sys: split internal basic/ library from shared/
basic/      can be used by everything
            cannot use anything outside of basic/

libsystemd/ can use basic/
            cannot use shared/

shared/     can use libsystemd/
2015-06-11 10:52:46 +02:00
Renamed from src/shared/in-addr-util.h (Browse further)