Commit Graph
43 Commits
Author SHA1 Message Date
Yu Watanabe 01e1303f9c Rename basic-forward.h, sd-forward.h, and shared-forward.h to forward.h
Follow-up for 74d392ed1b.
2026-07-15 02:18:05 +09:00
Yu Watanabe 6ae696a956 socket-util: extend the buffer in sockaddr_union to make it consistent with hw_addr_data
Concerned by Claude:
https://github.com/systemd/systemd/pull/42119#discussion_r3251133516
2026-05-16 22:33:40 +09:00
Yu Watanabe 304899fa57 sd-dhcp-client: always set default broadcast hardware address when unspecified
The default value for InfiniBand is copied from dhcp-network.c.
2026-05-13 07:47:53 +09:00
Nick Rosbrook caeec0de6d ether-addr-util: introduce hw_addr_is_valid()
Take this from udev, and adapt it to make it re-usable elsewhere.
2026-03-30 10:48:54 -04:00
Daan De Meyer f102bc3e5f tree-wide: Introduce sd-forward.h and shared-forward.h headers
Let's not leak details from src/shared and src/libsystemd into
src/basic, even though you can't actually do anything useful with
just forward declarations from src/shared.

The sd-forward.h header is put in src/libsystemd/sd-common as we
don't have a directory for shared internal headers for libsystemd
yet.

Let's also rename forward.h to basic-forward.h to keep things
self-explanatory.
2025-10-16 17:00:29 +02:00
Daan De Meyer 0c15577abe basic + fundamental: Clean up includes
Split out of #37344.
2025-05-25 10:06:07 +02:00
Daan De Meyer bcf716ca01 tree-wide: Remove dead code
This code seems to not be used anywhere at all, so let's drop it.

Follow up for ba8d00e859
Follow up for 85686b37b0
Follow up for aff853f8ea
Follow up for 36dad381a2
2025-04-24 10:15:19 +09:00
Zbigniew Jędrzejewski-Szmek ff3f29537c various: move ptr indicator to return value 2024-06-19 16:37:12 +02:00
Lennart Poettering e22ca70008 ether-addr-util: split out logic to mark MAC addresses as random 2023-12-19 11:48:05 +09:00
Yu Watanabe 069f5df051 ether-addr-util: introduce hw_addr_set() helper function 2022-08-06 04:53:36 +09:00
Yu Watanabe 847f1ea69e ether-addr-util: fix ether_addr_is_local() and add one more helper
Follow-up for 1f86a3fe52.
2021-11-12 20:00:29 +09:00
Lennart Poettering 371264b6c6 Merge pull request #21302 from yuwata/udev-drop-colon-from-ID_NET_NAME_MAC
udev: drop colon from ID_NET_NAME_MAC
2021-11-11 14:36:28 +01:00
Yu Watanabe e44cd43788 ether-addr-util: introduce hw_addr_to_string_full() 2021-11-11 18:29:52 +09:00
Yu Watanabe ca7d208367 ether-addr-util: expose hw_addr_hash_func() 2021-11-11 12:49:42 +09:00
Yu Watanabe c6df73ca72 ether-addr-util: introduce {hw,ether}_addr_hash_ops_free 2021-11-09 21:39:09 +09:00
Yu Watanabe 227e9ce255 ether-addr-util: replace ether_addr_from_string() with parse_ether_addr() 2021-11-09 21:39:09 +09:00
Yu Watanabe 02160bc909 ether-addr-util: introduce parse_ether_addr() 2021-11-09 21:39:09 +09:00
Yu Watanabe 76a5d3dee2 ether-addr-util: introduce parse_hw_addr() 2021-11-09 21:39:05 +09:00
Yu Watanabe de0f157984 ether-addr-util: make hw_addr_is_null() return true also for all zero address
This fixes the following error:
---
systemd-networkd[1449490]: ip6tnl0: Saved hardware address: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
systemd-networkd[1449490]: ip6tnl0: Failed to manage link by its new hardware address, ignoring: File exists
---
2021-11-09 08:20:51 +09:00
Yu Watanabe 1f86a3fe52 ether-addr-util: introduce several helper functions 2021-11-09 08:20:51 +09:00
Zbigniew Jędrzejewski-Szmek e265fa8198 test-ether-addr-util: add a simple test that HW_ADDR_TO_STR works with nesting
It seems to, but I was a bit incredulous… The comment is adjusted to match
the standard.

The trick with a temporary buffer is neat. I wasn't sure if it is valid, but
the standard says so. The test really tests that we are reading the rules right
and that the compiler doesn't do anythign strange or emit an unexpected
warning.
2021-07-09 11:03:35 +02:00
Yu Watanabe 907d5ce4d4 ether-addr-util: introduce hw_addr_hash_ops 2021-07-01 00:49:02 +09:00
Yu Watanabe 4b574fd813 ether-addr-util, network: introduce ETHER_ADDR_TO_STR() macro and use it 2021-06-10 00:37:50 +09:00
Yu Watanabe 30b977251c ether-addr-util: introduce hw_addr_compare(), hw_addr_equal(), and hw_addr_is_null() 2021-06-10 00:24:43 +09:00
Yu Watanabe ca2b7cd813 ether-addr-util: drop redundant "addr" from struct hw_addr_data
Also, this makes always specifiy "struct" for hw_addr_data.
2021-06-10 00:19:50 +09:00
Yu Watanabe ae8e3c2b25 ether-addr-util: introduce ether_addr_to_string_alloc() 2021-04-30 05:39:10 +09:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Timo Rothenpieler 4fc8a29a7e sd-netlink: introduce netlink_message_{read,append}_hw_addr
Hardware addresses come in various shapes and sizes, these new functions
and accomapying data structures account for that instead of hard-coding
a hardware address to the 6 bytes of an ethernet MAC.
2020-10-28 14:44:43 +01:00
Yu Watanabe 7a08d314f2 tree-wide: make hash_ops typesafe 2018-12-02 07:53:27 +01:00
Yu Watanabe afb76fdbff tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +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
Yu Watanabe 583706abf9 ether-addr-util: add hash_ops functions for struct ether_addr 2018-05-09 11:57:36 +09:00
Yu Watanabe e5c1be89b5 ether-addr-util: make ether_addr_from_string() stricter 2018-05-09 11:57:36 +09: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
Daniel Kahn Gillmor dd4d201ab1 util-lib: add ether_addr_from_string()
This isn't quite symmetrical to in_addr_from_string() because it also returns
an offset indicating how much of the string was consumed by the matched
pattern.  This offset reporting is needed for either of the following use
cases:

 * verifying the lack of trailing garbage after such an address
 * parsing subsequent data from the same string
2016-05-17 16:55:20 -04:00
Zbigniew Jędrzejewski-Szmek 6b0132e4e7 basic: simplify ether_addr_is_null 2016-02-23 08:50:49 -05:00
Lennart Poettering b553a6b13c sd-lldp: filter out LLDP messages coming from our own MAC address
Let's not get confused should we be connected to some bridge that mirrors back
our packets.
2016-02-21 20:40:58 +01: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 81a56d6f42 util-lib: move ether_addr_to_string() into ether-addr-util.c 2015-10-26 01:24:39 +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