From 2413cb75cea238b821a821593fc6b030f0c61c01 Mon Sep 17 00:00:00 2001
From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz>
Date: Mon, 26 Feb 2024 16:11:31 +0100
Subject: [PATCH] NET dhcpcd magic

---
 network/hopik/dhcpcd.enter-hook | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/network/hopik/dhcpcd.enter-hook b/network/hopik/dhcpcd.enter-hook
index 537c928..11767a4 100644
--- a/network/hopik/dhcpcd.enter-hook
+++ b/network/hopik/dhcpcd.enter-hook
@@ -4,6 +4,27 @@ msg_prefix="$interface: dhcpd.enter-hook:"
 
 echo $msg_prefix $reason $interface $if_up $ifssid
 
+mtu_wg_blatto(){
+	ip link set wg-blatto mtu $1
+}
+mtu_limit(){
+	if [ "$reason" == CARRIER ]
+	then
+		if [[ $3 -le $2 ]]
+		then
+			$1 $3
+		else
+			$1 $2
+		fi
+	fi
+	if [ "$reason" == NOCARRIER ]
+	then
+		$1 $2
+	fi
+}
+mtu(){
+	mtu_limit mtu_wg_blatto 1432 $(( $1 - 60 ))
+}
 conntrack_hack(){
 	if [ "$reason" == CARRIER ]
 	then
@@ -62,9 +83,10 @@ then
 
 	if [ "$ifssid" == CDWiFi ]
 	then
+		mtu 1340
 		if [ "$reason" == BOUND ]
 		then
-			systemctl restart cdwifi-autologin
+			CDWIFI_IFACE=$interface cdwifi-autologin
 		fi
 	fi
 
-- 
GitLab