summaryrefslogtreecommitdiff
path: root/src/network/networkd-setlink.h
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-14 19:46:33 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-06-15 20:58:20 +0200
commit9b682672e4b21e6325b48da3dcca4b4a479378a6 (patch)
treeb88da54268a123a9b58f56245782bb124cb669df /src/network/networkd-setlink.h
parentb428efa54bc9f8851514c595f14020a99fcf62a7 (diff)
downloadsystemd-9b682672e4b21e6325b48da3dcca4b4a479378a6.tar.gz
network: use void* to correctly store SetLinkOperation in Request
Previously, when `link_request_queue()` is called in link_request_set_link(), `SetLinkOperation` is casted with INT_TO_PTR(), and the value is assigned to `void *object`. However the value was read directly through the member `SetLinkOperation set_link_operation` of the union which `object` beloging to. Thus, read value was always 0 on big-endian systems. Fixes configuring link issue on s390x systems.
Diffstat (limited to 'src/network/networkd-setlink.h')
-rw-r--r--src/network/networkd-setlink.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/networkd-setlink.h b/src/network/networkd-setlink.h
index 87aa26e46f..d3e9f2b9d7 100644
--- a/src/network/networkd-setlink.h
+++ b/src/network/networkd-setlink.h
@@ -21,6 +21,10 @@ typedef enum SetLinkOperation {
_SET_LINK_OPERATION_INVALID = -EINVAL,
} SetLinkOperation;
+/* SetLinkOperation is casted to int, then stored in void* with INT_TO_PTR(). */
+assert_cc(sizeof(SetLinkOperation) <= sizeof(void*));
+assert_cc(sizeof(SetLinkOperation) <= sizeof(int));
+
int link_request_to_set_addrgen_mode(Link *link);
int link_request_to_set_bond(Link *link);
int link_request_to_set_bridge(Link *link);