diff --git a/bootstrap.d/dev-libs.yml b/bootstrap.d/dev-libs.yml index 9db27abe8..767fae67b 100644 --- a/bootstrap.d/dev-libs.yml +++ b/bootstrap.d/dev-libs.yml @@ -1700,6 +1700,52 @@ packages: DESTDIR: '@THIS_COLLECT_DIR@' quiet: true + - name: newt + architecture: '@OPTION:arch@' + metadata: + summary: Redhat's Newt windowing toolkit development files + description: Newt is a programming library for color text mode, widget based user interfaces. It can be used to add stacked windows, entry widgets, checkboxes, radio buttons, labels, plain text fields, scrollbars, etc., to text mode user interfaces. Newt is based on the S-Lang library. + spdx: 'LGPL-2.0-only' + website: 'https://pagure.io/newt' + maintainer: 'Dennis Bonke ' + categories: ['dev-libs'] + source: + subdir: ports + git: 'https://github.com/mlichvar/newt.git' + tag: 'r0-52-24' + version: '0.52.24' + tools_required: + - host-autoconf-v2.69 + - host-automake-v1.15 + - host-libtool + - host-pkg-config + regenerate: + - args: | + sed -e '/install -m 644 $(LIBNEWT)/ s/^/#/' -e '/$(LIBNEWT):/,/rv/ s/^/#/' -e 's/$(LIBNEWT)/$(LIBNEWTSH)/g' -i @THIS_SOURCE_DIR@/Makefile.in + - args: ['autoreconf', '-fvi'] + tools_required: + - system-gcc + pkgs_required: + - mlibc + - popt + - slang + - libintl + revision: 1 + configure: + # newt does not seem to support out-of-tree builds, so we just copy + # the source tree into the build directory instead + - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@'] + - args: + - './configure' + - '--host=@OPTION:arch-triple@' + - '--prefix=/usr' + - '--without-gpm-support' + build: + - args: ['make', '-j@PARALLELISM@'] + - args: ['make', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + - name: nspr architecture: '@OPTION:arch@' metadata: diff --git a/bootstrap.d/net-libs.yml b/bootstrap.d/net-libs.yml index 41d6828cf..d7fcc2225 100644 --- a/bootstrap.d/net-libs.yml +++ b/bootstrap.d/net-libs.yml @@ -148,6 +148,48 @@ packages: environ: DESTDIR: '@THIS_COLLECT_DIR@' + - name: libndp + architecture: '@OPTION:arch@' + metadata: + summary: Library for Neighbor Discovery Protocol + description: This package provides a wrapper for IPv6 Neighbor Discovery Protocol. It also provides a tool named ndptool for sending and receiving NDP messages. + spdx: 'LGPL-2.1-or-later' + website: 'http://libndp.org/' + maintainer: 'Dennis Bonke ' + categories: ['net-libs'] + source: + subdir: ports + git: 'https://github.com/jpirko/libndp.git' + tag: 'v1.8' + version: '1.8' + tools_required: + - host-autoconf-v2.69 + - host-automake-v1.15 + - host-libtool + - host-pkg-config + regenerate: + - args: ['./autogen.sh'] + tools_required: + - system-gcc + pkgs_required: + - mlibc + revision: 1 + configure: + - args: + - '@THIS_SOURCE_DIR@/configure' + - '--host=@OPTION:arch-triple@' + - '--prefix=/usr' + - '--sysconfdir=/etc' + - '--localstatedir=/var' + - '--disable-static' + environ: + ac_cv_func_malloc_0_nonnull: 'yes' + build: + - args: ['make', '-j@PARALLELISM@'] + - args: ['make', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + - name: libpsl architecture: '@OPTION:arch@' metadata: diff --git a/bootstrap.d/net-misc.yml b/bootstrap.d/net-misc.yml index 0a7161528..bf18e8987 100644 --- a/bootstrap.d/net-misc.yml +++ b/bootstrap.d/net-misc.yml @@ -105,6 +105,97 @@ packages: - args: ['cp', '@THIS_BUILD_DIR@/services', '@THIS_COLLECT_DIR@/etc/'] - args: ['cp', '@THIS_BUILD_DIR@/protocols', '@THIS_COLLECT_DIR@/etc/'] + - name: networkmanager + architecture: '@OPTION:arch@' + metadata: + summary: A set of co-operative tools that make networking simple and straightforward + description: NetworkManager is a set of co-operative tools that make networking simple and straightforward. Whether you use WiFi, wired, 3G, or Bluetooth, NetworkManager allows you to quickly move from one network to another. Once a network has been configured and joined once, it can be detected and re-joined automatically the next time it's available. + spdx: 'GPL-2.0-or-later LGPL-2.1-or-later' + website: 'https://wiki.gnome.org/Projects/NetworkManager' + maintainer: 'Dennis Bonke ' + categories: ['net-misc'] + source: + subdir: 'ports' + git: 'https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git' + tag: '1.48.0' + version: '1.48.0' + tools_required: + - host-pkg-config + - system-gcc + - virtual: pkgconfig-for-target + triple: "@OPTION:arch-triple@" + pkgs_required: + - mlibc + - libndp + - curl + - dhcpcd + - glib + - libpsl + - newt + - nss + - readline + revision: 1 + configure: + - args: + - 'meson' + - 'setup' + - '--native-file' + - '@SOURCE_ROOT@/scripts/meson.native-file' + - '--cross-file' + - '@SOURCE_ROOT@/scripts/meson-@OPTION:arch-triple@.cross-file' + - '--prefix=/usr' + - '--libdir=lib' + - '--buildtype=debugoptimized' + - '-Dlibaudit=no' + - '-Dnmtui=true' + - '-Dovs=false' + - '-Dppp=false' + - '-Dselinux=false' + - '-Dsession_tracking=no' + - '-Dmodem_manager=false' # Needs mobile-broadband-provider-info + - '-Dsystemdsystemunitdir=no' + - '-Dsystemd_journal=false' + - '-Dqt=false' + - '-Dpolkit=false' + - '-Debpf=false' + - '-Dintrospection=false' + - '-Dvapi=false' + - '-Dsystem_ca_path=/etc/ssl/certs' + - '-Ddbus_conf_dir=/usr/share/dbus-1/system.d' + - '-Dmodify_system=true' + - '-Dconfig_plugins_default=keyfile' + - '-Difcfg_rh=false' + - '-Difupdown=false' + - '-Dconfig_dhcp_default=dhcpcd' + - '-Dcrypto=nss' + - '-Dreadline=libreadline' + - '-Dteamdctl=false' + - '-Dtests=no' + - '@THIS_SOURCE_DIR@' + build: + - args: ['ninja'] + - args: ['ninja', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + - args: ['mkdir', '-pv', '@THIS_COLLECT_DIR@/etc/NetworkManager/conf.d'] + - args: ['cp', '@SOURCE_ROOT@/extrafiles/networkmanager/NetworkManager.conf', '@THIS_COLLECT_DIR@/etc/NetworkManager/'] + - args: ['cp', '@SOURCE_ROOT@/extrafiles/networkmanager/no-dns-update.conf', '@THIS_COLLECT_DIR@/etc/NetworkManager/conf.d/'] + - args: ['cp', '@SOURCE_ROOT@/extrafiles/networkmanager/dhcp.conf', '@THIS_COLLECT_DIR@/etc/NetworkManager/conf.d/'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/dispatcher.d/pre-down.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/dispatcher.d/no-wait.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/dispatcher.d/pre-up.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/system-connections/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/dispatcher.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/conf.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/NetworkManager/VPN/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/dispatcher.d/pre-down.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/dispatcher.d/no-wait.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/dispatcher.d/pre-up.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/system-connections/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/dnsmasq.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/etc/NetworkManager/dnsmasq-shared.d/.keep'] + - args: ['touch', '@THIS_COLLECT_DIR@/var/lib/NetworkManager/.keep'] + - name: rsync architecture: '@OPTION:arch@' source: diff --git a/bootstrap.d/sys-libs.yml b/bootstrap.d/sys-libs.yml index 9bf404802..dc79ed0fe 100644 --- a/bootstrap.d/sys-libs.yml +++ b/bootstrap.d/sys-libs.yml @@ -411,6 +411,49 @@ packages: - args: ['patchelf', '--set-soname', 'libreadline.so.8', '@THIS_COLLECT_DIR@/usr/lib/libreadline.so.8'] - args: ['patchelf', '--set-soname', 'libhistory.so.8', '@THIS_COLLECT_DIR@/usr/lib/libhistory.so.8'] + - name: slang + architecture: '@OPTION:arch@' + metadata: + summary: Multi-platform library designed to allow a developer to create robust software + description: S-Lang (slang) is an interpreted language that may be embedded into an application to make the application extensible. It provides facilities required by interactive applications such as display/screen management, keyboard input and keymaps. + spdx: 'CJK' + website: 'https://www.jedsoft.org/slang/' + maintainer: 'Dennis Bonke ' + categories: ['sys-libs'] + source: + subdir: ports + git: 'git://git.jedsoft.org/git/slang.git' + tag: 'v2.2.3' + version: '2.2.3' + tools_required: + - host-automake-v1.16 + regenerate: + - args: ['cp', + '@BUILD_ROOT@/tools/host-automake-v1.16/share/automake-1.16/config.sub', + '@THIS_SOURCE_DIR@/autoconf/'] + tools_required: + - system-gcc + pkgs_required: + - mlibc + - libpng + - readline + revision: 1 + configure: + # slang does not seem to support out-of-tree builds, so we just copy + # the source tree into the build directory instead + - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@'] + - args: + - './configure' + - '--host=@OPTION:arch-triple@' + - '--prefix=/usr' + - '--sysconfdir=/etc' + - '--with-readline=gnu' + build: + - args: ['make', '-j1'] + - args: ['make', 'install_doc_dir=@THIS_COLLECT_DIR@/usr/share/doc/slang-2.3.3', 'SLSH_DOC_DIR=@THIS_COLLECT_DIR@/usr/share/doc/slang-2.3.3/slsh', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + - name : tzdata labels: [aarch64] architecture: noarch diff --git a/extrafiles/networkmanager/NetworkManager.conf b/extrafiles/networkmanager/NetworkManager.conf new file mode 100644 index 000000000..c37b59680 --- /dev/null +++ b/extrafiles/networkmanager/NetworkManager.conf @@ -0,0 +1,2 @@ +[main] +plugins=keyfile diff --git a/extrafiles/networkmanager/dhcp.conf b/extrafiles/networkmanager/dhcp.conf new file mode 100644 index 000000000..8da4fe048 --- /dev/null +++ b/extrafiles/networkmanager/dhcp.conf @@ -0,0 +1,2 @@ +[main] +dhcp=dhcpcd diff --git a/extrafiles/networkmanager/no-dns-update.conf b/extrafiles/networkmanager/no-dns-update.conf new file mode 100644 index 000000000..d435aba99 --- /dev/null +++ b/extrafiles/networkmanager/no-dns-update.conf @@ -0,0 +1,2 @@ +[main] +dns=none diff --git a/patches/networkmanager/0001-Add-initial-Managarm-support.patch b/patches/networkmanager/0001-Add-initial-Managarm-support.patch new file mode 100644 index 000000000..890dae407 --- /dev/null +++ b/patches/networkmanager/0001-Add-initial-Managarm-support.patch @@ -0,0 +1,402 @@ +From e6d362b82d61af2603006893cc8900d4b73bbabb Mon Sep 17 00:00:00 2001 +From: Dennis Bonke +Date: Fri, 2 Aug 2024 16:30:25 +0200 +Subject: [PATCH] Add initial Managarm support + +Signed-off-by: Dennis Bonke +--- + meson.build | 37 +++++++----- + src/c-stdaux/src/c-stdaux-generic.h | 2 +- + src/libnm-glib-aux/nm-random-utils.c | 2 + + src/libnm-glib-aux/nm-shared-utils.c | 6 ++ + src/libnm-platform/nm-linux-platform.c | 11 +++- + src/libnm-systemd-core/meson.build | 1 + + .../sd-adapt-core/nm-sd-adapt-core.h | 2 + + .../src/libsystemd-network/sd-dhcp6-client.c | 2 +- + .../src/libsystemd/sd-id128/hmac.c | 60 +++++++++++++++++++ + .../src/libsystemd/sd-id128/hmac.h | 12 ++++ + .../src/libsystemd/sd-id128/id128-util.c | 2 + + .../src/libsystemd/sd-id128/sd-id128.c | 4 ++ + .../sd-adapt-shared/nm-sd-adapt-shared.h | 4 ++ + .../src/basic/missing_syscall.h | 5 ++ + src/nmcli/polkit-agent.c | 2 + + tools/create-exports-NetworkManager.sh | 2 +- + 16 files changed, 134 insertions(+), 20 deletions(-) + create mode 100644 src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.c + create mode 100644 src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.h + +diff --git a/meson.build b/meson.build +index da78cdb..13cb181 100644 +--- a/meson.build ++++ b/meson.build +@@ -256,22 +256,27 @@ libudev_dep = dependency('libudev', version: '>= 175') + dbus_dep = dependency('dbus-1', version: '>= 1.1') + libndp_dep = dependency('libndp') + +-jansson_dep = dependency('jansson', version: '>= 2.7', required: false) +-config_h.set10('WITH_JANSSON', jansson_dep.found()) +- +-jansson_msg = 'no' +-if jansson_dep.found() +- jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir') +- res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false) +- jansson_soname = '' +- foreach line: res.stdout().split('\n') +- if line.strip().contains('SONAME') +- jansson_soname = line.split('[')[1].split(']')[0] +- endif +- endforeach +- assert(jansson_soname != '', 'Unable to determine Jansson SONAME') +- config_h.set_quoted('JANSSON_SONAME', jansson_soname) +- jansson_msg = 'yes (soname: ' + jansson_soname + ')' ++if target_machine.system() != 'managarm' ++ jansson_dep = dependency('jansson', version: '>= 2.7', required: false) ++ config_h.set10('WITH_JANSSON', jansson_dep.found()) ++ ++ jansson_msg = 'no' ++ if jansson_dep.found() ++ jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir') ++ res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false) ++ jansson_soname = '' ++ foreach line: res.stdout().split('\n') ++ if line.strip().contains('SONAME') ++ jansson_soname = line.split('[')[1].split(']')[0] ++ endif ++ endforeach ++ assert(jansson_soname != '', 'Unable to determine Jansson SONAME') ++ config_h.set_quoted('JANSSON_SONAME', jansson_soname) ++ jansson_msg = 'yes (soname: ' + jansson_soname + ')' ++ endif ++else ++ jansson_dep = dependency('jansson', version: '>= 99999999', required: false) ++ jansson_msg = 'no' + endif + + libsystemd_dep = dependency('libsystemd', version: '>= 209', required: false) +diff --git a/src/c-stdaux/src/c-stdaux-generic.h b/src/c-stdaux/src/c-stdaux-generic.h +index 6f87fd4..51d6e08 100644 +--- a/src/c-stdaux/src/c-stdaux-generic.h ++++ b/src/c-stdaux/src/c-stdaux-generic.h +@@ -60,7 +60,7 @@ extern "C" { + # define C_COMPILER_MSVC 1 + #endif + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__managarm__) + # define C_OS_LINUX 1 + #endif + +diff --git a/src/libnm-glib-aux/nm-random-utils.c b/src/libnm-glib-aux/nm-random-utils.c +index bbc5536..5a6950f 100644 +--- a/src/libnm-glib-aux/nm-random-utils.c ++++ b/src/libnm-glib-aux/nm-random-utils.c +@@ -9,7 +9,9 @@ + + #include + #include ++#ifndef __managarm__ + #include ++#endif + #include + + #if USE_SYS_RANDOM_H +diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c +index 421e4d1..5127ab5 100644 +--- a/src/libnm-glib-aux/nm-shared-utils.c ++++ b/src/libnm-glib-aux/nm-shared-utils.c +@@ -13,7 +13,9 @@ + #include + #include + #include ++#ifndef __managarm__ + #include ++#endif + #include + #include + #include +@@ -138,7 +140,11 @@ nm_utils_inet6_interface_identifier_to_token(const NMUtilsIPv6IfaceId *iid, + pid_t + nm_utils_gettid(void) + { ++#ifndef __managarm__ + return (pid_t) syscall(SYS_gettid); ++#else ++ return gettid(); ++#endif + } + + /* Used for asserting that this function is called on the main-thread. +diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c +index 5b595a9..b7cc59b 100644 +--- a/src/libnm-platform/nm-linux-platform.c ++++ b/src/libnm-platform/nm-linux-platform.c +@@ -11683,12 +11683,19 @@ nm_linux_platform_new(NMDedupMultiIndex *multi_idx, + gboolean netns_support, + gboolean cache_tc) + { ++ nm_log_info(LOGD_CORE, "nm_linux_platform_new 1?"); + gboolean use_udev = FALSE; + ++#ifndef __managarm__ + if (nmp_netns_is_initial() && path_is_read_only_fs("/sys") == FALSE) + use_udev = TRUE; ++#else ++ use_udev = TRUE; ++ netns_support = FALSE; ++#endif ++ nm_log_info(LOGD_CORE, "nm_linux_platform_new 2?"); + +- return g_object_new(NM_TYPE_LINUX_PLATFORM, ++ NMPlatform *ret = g_object_new(NM_TYPE_LINUX_PLATFORM, + NM_PLATFORM_MULTI_IDX, + multi_idx, + NM_PLATFORM_LOG_WITH_PTR, +@@ -11700,6 +11707,8 @@ nm_linux_platform_new(NMDedupMultiIndex *multi_idx, + NM_PLATFORM_CACHE_TC, + cache_tc, + NULL); ++ nm_log_info(LOGD_CORE, "nm_linux_platform_new 3?"); ++ return ret; + } + + static void +diff --git a/src/libnm-systemd-core/meson.build b/src/libnm-systemd-core/meson.build +index 15e1c8a..adfa0ae 100644 +--- a/src/libnm-systemd-core/meson.build ++++ b/src/libnm-systemd-core/meson.build +@@ -16,6 +16,7 @@ libnm_systemd_core = static_library( + 'src/libsystemd/sd-event/sd-event.c', + 'src/libsystemd/sd-id128/id128-util.c', + 'src/libsystemd/sd-id128/sd-id128.c', ++ 'src/libsystemd/sd-id128/hmac.c', + 'nm-sd.c', + 'sd-adapt-core/netif-util.c', + 'sd-adapt-core/nm-sd-adapt-core.c', +diff --git a/src/libnm-systemd-core/sd-adapt-core/nm-sd-adapt-core.h b/src/libnm-systemd-core/sd-adapt-core/nm-sd-adapt-core.h +index 9cb5574..2165657 100644 +--- a/src/libnm-systemd-core/sd-adapt-core/nm-sd-adapt-core.h ++++ b/src/libnm-systemd-core/sd-adapt-core/nm-sd-adapt-core.h +@@ -37,7 +37,9 @@ + #include + #endif + #include ++#ifndef __managarm__ + #include ++#endif + #include + + #define HAVE_EPOLL_PWAIT2 0 +diff --git a/src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c b/src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c +index 7c20116..5904656 100644 +--- a/src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c +@@ -7,7 +7,7 @@ + + #include + #include +-#ifdef __GLIBC__ ++#if defined __GLIBC__ || defined __managarm__ + #include + #endif + #include +diff --git a/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.c b/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.c +new file mode 100644 +index 0000000..a5f66d5 +--- /dev/null ++++ b/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.c +@@ -0,0 +1,60 @@ ++/* SPDX-License-Identifier: LGPL-2.1-or-later */ ++ ++#include ++#include ++ ++#include "hmac.h" ++#include "sha256.h" ++ ++#define HMAC_BLOCK_SIZE 64 ++#define INNER_PADDING_BYTE 0x36 ++#define OUTER_PADDING_BYTE 0x5c ++ ++void hmac_sha256(const void *key, ++ size_t key_size, ++ const void *input, ++ size_t input_size, ++ uint8_t res[static SHA256_DIGEST_SIZE]) { ++ ++ uint8_t inner_padding[HMAC_BLOCK_SIZE] = { }; ++ uint8_t outer_padding[HMAC_BLOCK_SIZE] = { }; ++ uint8_t replacement_key[SHA256_DIGEST_SIZE]; ++ struct sha256_ctx hash; ++ ++ assert(key); ++ assert(key_size > 0); ++ assert(res); ++ ++ /* Implement algorithm as described by FIPS 198. */ ++ ++ /* The key needs to be block size length or less, hash it if it's longer. */ ++ if (key_size > HMAC_BLOCK_SIZE) { ++ sha256_direct(key, key_size, replacement_key); ++ key = replacement_key; ++ key_size = SHA256_DIGEST_SIZE; ++ } ++ ++ /* First, copy the key into the padding arrays. If it's shorter than ++ * the block size, the arrays are already initialized to 0. */ ++ memcpy(inner_padding, key, key_size); ++ memcpy(outer_padding, key, key_size); ++ ++ /* Then, XOR the provided key and any padding leftovers with the fixed ++ * padding bytes as defined in FIPS 198. */ ++ for (size_t i = 0; i < HMAC_BLOCK_SIZE; i++) { ++ inner_padding[i] ^= INNER_PADDING_BYTE; ++ outer_padding[i] ^= OUTER_PADDING_BYTE; ++ } ++ ++ /* First pass: hash the inner padding array and the input. */ ++ sha256_init_ctx(&hash); ++ sha256_process_bytes(inner_padding, HMAC_BLOCK_SIZE, &hash); ++ sha256_process_bytes(input, input_size, &hash); ++ sha256_finish_ctx(&hash, res); ++ ++ /* Second pass: hash the outer padding array and the result of the first pass. */ ++ sha256_init_ctx(&hash); ++ sha256_process_bytes(outer_padding, HMAC_BLOCK_SIZE, &hash); ++ sha256_process_bytes(res, SHA256_DIGEST_SIZE, &hash); ++ sha256_finish_ctx(&hash, res); ++} +diff --git a/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.h b/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.h +new file mode 100644 +index 0000000..e58c183 +--- /dev/null ++++ b/src/libnm-systemd-core/src/libsystemd/sd-id128/hmac.h +@@ -0,0 +1,12 @@ ++/* SPDX-License-Identifier: LGPL-2.1-or-later */ ++#pragma once ++ ++#include ++#include ++ ++#include "sha256.h" ++ ++/* Unoptimized implementation based on FIPS 198. 'res' has to be allocated by ++ * the caller. Prefer external OpenSSL functions, and use this only when ++ * linking to OpenSSL is not desirable (eg: libsystemd.so). */ ++void hmac_sha256(const void *key, size_t key_size, const void *input, size_t input_size, uint8_t res[static SHA256_DIGEST_SIZE]); +diff --git a/src/libnm-systemd-core/src/libsystemd/sd-id128/id128-util.c b/src/libnm-systemd-core/src/libsystemd/sd-id128/id128-util.c +index 5817305..41cca04 100644 +--- a/src/libnm-systemd-core/src/libsystemd/sd-id128/id128-util.c ++++ b/src/libnm-systemd-core/src/libsystemd/sd-id128/id128-util.c +@@ -204,6 +204,7 @@ void id128_hash_func(const sd_id128_t *p, struct siphash *state) { + int id128_compare_func(const sd_id128_t *a, const sd_id128_t *b) { + return memcmp(a, b, sizeof(sd_id128_t)); + } ++#endif + + sd_id128_t id128_make_v4_uuid(sd_id128_t id) { + /* Stolen from generate_random_uuid() of drivers/char/random.c +@@ -218,6 +219,7 @@ sd_id128_t id128_make_v4_uuid(sd_id128_t id) { + return id; + } + ++#if 0 + DEFINE_HASH_OPS(id128_hash_ops, sd_id128_t, id128_hash_func, id128_compare_func); + DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(id128_hash_ops_free, sd_id128_t, id128_hash_func, id128_compare_func, free); + +diff --git a/src/libnm-systemd-core/src/libsystemd/sd-id128/sd-id128.c b/src/libnm-systemd-core/src/libsystemd/sd-id128/sd-id128.c +index ff0db77..5f3e1af 100644 +--- a/src/libnm-systemd-core/src/libsystemd/sd-id128/sd-id128.c ++++ b/src/libnm-systemd-core/src/libsystemd/sd-id128/sd-id128.c +@@ -345,6 +345,8 @@ _public_ int sd_id128_randomize(sd_id128_t *ret) { + return 0; + } + ++#endif ++ + _public_ int sd_id128_get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret) { + assert_cc(sizeof(sd_id128_t) < SHA256_DIGEST_SIZE); /* Check that we don't need to pad with zeros. */ + union { +@@ -375,6 +377,8 @@ _public_ int sd_id128_get_machine_app_specific(sd_id128_t app_id, sd_id128_t *re + return sd_id128_get_app_specific(id, app_id, ret); + } + ++#if 0 ++ + _public_ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret) { + sd_id128_t id; + int r; +diff --git a/src/libnm-systemd-shared/sd-adapt-shared/nm-sd-adapt-shared.h b/src/libnm-systemd-shared/sd-adapt-shared/nm-sd-adapt-shared.h +index 83916fb..2662813 100644 +--- a/src/libnm-systemd-shared/sd-adapt-shared/nm-sd-adapt-shared.h ++++ b/src/libnm-systemd-shared/sd-adapt-shared/nm-sd-adapt-shared.h +@@ -38,7 +38,9 @@ + + #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD + ++#ifndef __managarm__ + #include ++#endif + #include + #include + +@@ -71,6 +73,8 @@ raw_getpid(void) + { + #if defined(__alpha__) + return (pid_t) syscall(__NR_getxpid); ++#elif defined(__managarm__) ++ return getpid(); + #else + return (pid_t) syscall(__NR_getpid); + #endif +diff --git a/src/libnm-systemd-shared/src/basic/missing_syscall.h b/src/libnm-systemd-shared/src/basic/missing_syscall.h +index 149c5b4..1994bb5 100644 +--- a/src/libnm-systemd-shared/src/basic/missing_syscall.h ++++ b/src/libnm-systemd-shared/src/basic/missing_syscall.h +@@ -11,7 +11,9 @@ + #include + #endif + #include ++#ifndef __managarm__ + #include ++#endif + #include + #include + #include +@@ -374,6 +376,9 @@ static inline int missing_pidfd_open(pid_t pid, unsigned flags) { + static inline int missing_rt_sigqueueinfo(pid_t tgid, int sig, siginfo_t *info) { + # if defined __NR_rt_sigqueueinfo && __NR_rt_sigqueueinfo >= 0 + return syscall(__NR_rt_sigqueueinfo, tgid, sig, info); ++#elif defined __managarm__ ++ // Ignored? ++ return 0; + # else + # error "__NR_rt_sigqueueinfo not defined" + # endif +diff --git a/src/nmcli/polkit-agent.c b/src/nmcli/polkit-agent.c +index 8b74b33..810bc55 100644 +--- a/src/nmcli/polkit-agent.c ++++ b/src/nmcli/polkit-agent.c +@@ -83,6 +83,8 @@ nmc_polkit_agent_fini(NmCli *nmc) + gboolean + nmc_start_polkit_agent_start_try(NmCli *nmc) + { ++ // HACK: fuck polkit? ++ return TRUE; + gs_free_error GError *error = NULL; + + /* We don't register polkit agent at all when running non-interactively */ +diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh +index 855d837..2540576 100755 +--- a/tools/create-exports-NetworkManager.sh ++++ b/tools/create-exports-NetworkManager.sh +@@ -1,6 +1,6 @@ + #!/bin/bash + +-set -e ++#set -e + set -o pipefail + + die() { +-- +2.45.2 +