From 6066bc28dc8b40335ea2a4554691900fa6813c8a Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Wed, 1 Mar 2023 01:57:42 +0100 Subject: [PATCH 1/4] - disable lock checks (happens on LUKS2 and fails during system boot) --- rc.d/init.d/cryptsetup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc.d/init.d/cryptsetup b/rc.d/init.d/cryptsetup index 263a39c..d5ac2c3 100755 --- a/rc.d/init.d/cryptsetup +++ b/rc.d/init.d/cryptsetup @@ -105,7 +105,7 @@ init_crypto() { continue fi - if /sbin/cryptsetup isLuks "$src" 2>/dev/null; then + if /sbin/cryptsetup --disable-locks isLuks "$src" 2>/dev/null; then if key_is_random "$key"; then nls "%s: LUKS requires non-random key, skipping" "$dst" ret=1 @@ -114,7 +114,7 @@ init_crypto() { if [ -n "$params" ]; then nls "%s: options are invalid for LUKS partitions, ignoring them" "$dst" fi - /sbin/cryptsetup ${key:+-d $key} luksOpen "$src" "$dst" <&1 + /sbin/cryptsetup --disable-locks ${key:+-d $key} luksOpen "$src" "$dst" <&1 fi rc=$? if [ $rc -ne 0 ]; then @@ -144,7 +144,7 @@ halt_crypto() { [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue if [ -b "/dev/mapper/$dst" ]; then if LC_ALL=C /sbin/dmsetup info "$dst" | grep -q '^Open count: *0$'; then - /sbin/cryptsetup remove "$dst" + /sbin/cryptsetup --disable-locks remove "$dst" else fnval=1 fi -- 2.44.0 From 6692a4555d8b1918484db9dc5561453e5ce1b6c5 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 16 May 2024 01:06:48 +0200 Subject: [PATCH 2/4] - use ip command for configuring bond interfaces --- lib/ifdown-bond | 10 +++++----- lib/ifup | 12 +++++++----- lib/ifup-bond | 11 +++-------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/ifdown-bond b/lib/ifdown-bond index 80a2cf2..f490bbe 100755 --- a/lib/ifdown-bond +++ b/lib/ifdown-bond @@ -35,19 +35,19 @@ fi setup_ip_param # forget all addresses -LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush" +LC_ALL=C ip addr flush dev "${DEVICE}" 2>&1 | grep -v "Nothing to flush" # release slave devices for SLAVE_DEV in $(cat /sys/class/net/${DEVICE}/bonding/slaves 2>/dev/null); do - echo "-${SLAVE_DEV}" > /sys/class/net/${DEVICE}/bonding/slaves + ip link set "${SLAVE_DEV}" nomaster done # bring bonding master down -ip link set ${DEVICE} down +ip link set "${DEVICE}" down # remove bonding master -if grep -wq "${DEVICE}" /sys/class/net/bonding_masters; then - echo "-${DEVICE}" > /sys/class/net/bonding_masters +if [ -d "/sys/class/net/${DEVICE}" ]; then + ip link del "${DEVICE}" type bond if [ $? -ne 0 ]; then exit 1 fi diff --git a/lib/ifup b/lib/ifup index 5d6fc21..b8536af 100755 --- a/lib/ifup +++ b/lib/ifup @@ -125,11 +125,13 @@ if [ -n "$ETHTOOL_OPTS" ] ; then fi if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then - if ! grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null; then - nls "Enslaving %s to %s" "$DEVICE" "$MASTER" - ip link set dev ${DEVICE} down - echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null - fi + # create master if it doesn't exist yet + [ ! -d "/sys/class/net/${MASTER}" ] && ip link add "${MASTER}" type bond + + nls "Enslaving %s to %s" "${DEVICE}" "${MASTER}" + ip link set "${DEVICE}" master "${MASTER}" + ip link set "${DEVICE}" up + exit 0 fi diff --git a/lib/ifup-bond b/lib/ifup-bond index 5651839..3c1d648 100755 --- a/lib/ifup-bond +++ b/lib/ifup-bond @@ -35,20 +35,15 @@ fi if [ ! -f /sys/class/net/bonding_masters ]; then modprobe -s bonding || exit 1 # delete default bond0 - echo "-bond0" > /sys/class/net/bonding_masters + ip link del bond0 type bond fi # set all major variables setup_ip_param # create bonding master -if ! grep -wq "${DEVICE}" /sys/class/net/bonding_masters; then - echo "+${DEVICE}" > /sys/class/net/bonding_masters - if [ $? -eq 0 ]; then - ip link set dev ${DEVICE} multicast ${MULTICAST} ${ARP} - else - exit 1 - fi +if [ ! -d "/sys/class/net/${DEVICE}" ]; then + ip link add "${DEVICE}" type bond fi # add the bits to setup driver parameters here -- 2.44.0 From 7e0a5a475aed51976d99f13f350894a4e50bb76f Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 16 May 2024 01:09:19 +0200 Subject: [PATCH 3/4] - set handling for bond interfaces too --- lib/functions.network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.network b/lib/functions.network index 862d42b..b4ea5d0 100644 --- a/lib/functions.network +++ b/lib/functions.network @@ -226,7 +226,7 @@ setup_ip_param () # set handling for bridge case "$DEVICETYPE" in - br|atm|lec|irda|vlan) + bond|br|atm|lec|irda|vlan) HANDLING=1 ;; esac -- 2.44.0 From 17f4654f40c97984b28cef85b70d29a32ad1f0cd Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 16 May 2024 01:10:40 +0200 Subject: [PATCH 4/4] - version 0.5.3 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4a83cf6..61fa785 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -AC_INIT([rc-scripts], [0.5.2], [tld-devel@lists.tld-linux.org], [rc-scripts]) +AC_INIT([rc-scripts], [0.5.3], [tld-devel@lists.tld-linux.org], [rc-scripts]) dnl Do not require AUTHORS, ChangeLog, NEWS, and README to exist AM_INIT_AUTOMAKE([foreign]) -- 2.44.0