summaryrefslogtreecommitdiffstats
path: root/src/basic/in-addr-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* in-addr-util: make in_addr_default_prefix_from_string() or friend set 0 to ↵Yu Watanabe2018-11-071-8/+14
| | | | | | | prefixlen when family == AF_INET6 (#10665) Follow-up for a4798d4e6d88c2be2625ce62d8326eaa9b80f2ee. Fixes #10662.
* util: introduce in_addr_default_prefix_from_string() and friendsYu Watanabe2018-11-051-2/+12
| | | | | It is similar to in_addr_prefix_from_string() but it determines the prefix length from address if it is not specified.
* util: use strndup() instead of strndupa()Yu Watanabe2018-11-051-7/+22
| | | | As the input string may be comes from command line or config files.
* tree-wide: Convert compare_func's to use CMP() macro wherever possible.Filipe Brandenburger2018-08-071-2/+4
| | | | | | | | Looked for definitions of functions using the *_compare_func() suffix. Tested: - Unit tests passed (ninja -C build/ test) - Installed this build and booted with it.
* basic: use FAMILY_ADDRESS_SIZE() macro in hash_ops for in_addr_dataYu Watanabe2018-08-021-12/+2
|
* basic: introduce in_addr_data_hash_opsYu Watanabe2018-07-311-0/+31
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | 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.
* 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.
* 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.
* ip-address-access: minimize IP address listsLennart Poettering2017-09-221-0/+24
| | | | | Let's drop redundant items from the IP address list after parsing. Let's also mask out redundant bits hidden by the prefixlength.
* in-addr-util: add new helper call in_addr_prefix_from_string_auto()Lennart Poettering2017-09-221-13/+71
| | | | | | 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.
* in-addr-util: prefix return parameters with ret_Lennart Poettering2017-09-221-5/+5
|
* in-addr-util: be more systematic with naming our functionsLennart Poettering2017-09-221-7/+7
| | | | | | | | | 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.
* socket-util: add parse_ip_prefix (#5867)Susant Sahani2017-05-061-0/+42
| | | | networkd: replace parse prefix with generic in_addr_prefix_from_string
* socket-util: introduce in_addr_is_multicastSusant Sahani2017-02-241-0/+12
| | | | | This patch add support to test whether a internet address is multicast or not.
* basic: make sure in_addr_from_string() can take NULL argumentsLennart Poettering2016-11-211-7/+6
| | | | This way, we can use it for validating IP address strings.
* basic: add explicit ipv4-specific in_addr classification callsLennart Poettering2016-11-211-12/+18
| | | | | | | | | | | | 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.
* Merge pull request #3432 from poettering/resolved-ll-ipv6Martin Pitt2016-06-091-0/+85
|\ | | | | resolved: support IPv6 DNS servers on the local link
| * resolved: support IPv6 DNS servers on the local linkLennart Poettering2016-06-061-0/+85
| | | | | | | | | | | | | | | | | | | | | | 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
* | util: make it easier to check whether in_addr or in6_addr addresses are NULLLennart Poettering2016-06-061-6/+14
|/
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: check if errno is greater then zeroZbigniew Jędrzejewski-Szmek2016-01-131-2/+2
| | | | | | | | | | | | | | gcc is confused by the common idiom of return errno ? -errno : -ESOMETHING and thinks a positive value may be returned. Replace this condition with errno > 0 to help gcc and avoid many spurious warnings. I filed a gcc rfe a long time ago, but it hard to say if it will ever be implemented [1]. Both conventions were used in the codebase, this change makes things more consistent. This is a follow up to bcb161b0230f. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61846
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-0/+6
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* resolved: fix typo in in_addr_is_localhost()Mantas Mikulėnas2015-11-271-1/+1
|
* resolved: never cache RRs originating from localhostLennart Poettering2015-11-271-1/+14
| | | | | | | After all, this is likely a local DNS forwarder that caches anyway, hence there's no point in caching twice. Fixes #2038.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+338
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/