[1/9] ipsec-interfaces: Fixes bug12763

Message ID 20240411150108.21573-1-adolf.belka@ipfire.org
State Staged
Commit 87a97a431915849cf6d19e1b7137b4fb0b6dd91d
Headers
Series [1/9] ipsec-interfaces: Fixes bug12763 |

Commit Message

Adolf Belka April 11, 2024, 3:01 p.m. UTC
  - Some of the ip route commands are not redirected to null. This causes the "FIB table does
   not exist" message from bug12763
- This patch makes all ip route commands get redirected to null, preventing the error
   message from being seen at boot.
- One of the ip rule commands is not redirected to null. This causes the "RTNETLINK
    answers: no such file or directory" message.
- This patch makes all ip rule commands get redirected to null, preventing the error
   message from being seen at boot.
- Additional patches in this set ensure that all ip route and ip rule commands in all
   IPFire code is redirected to null unless the output of the ip route or ip rule command
   is used in a variable for use elsewhere in the code.
- Tested on my vm system and confirmed that the fix in ipsec-interfaces stops the "FIB
   table does not exist" and "RTNETLINK answers: no such file or directory" messages during
   boot.

Fixes: Bug#12763
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 src/scripts/ipsec-interfaces | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/src/scripts/ipsec-interfaces b/src/scripts/ipsec-interfaces
index 23512b9bd..974d3ac84 100644
--- a/src/scripts/ipsec-interfaces
+++ b/src/scripts/ipsec-interfaces
@@ -107,15 +107,15 @@  main() {
 	local interfaces=()
 
 	# Flush IPsec routes
-	ip route flush table "${ROUTE_TABLE}"
+	ip route flush table "${ROUTE_TABLE}" >/dev/null 2>&1
 
 	# Remove lookups
-	ip rule del lookup "${ROUTE_TABLE}"
+	ip rule del lookup "${ROUTE_TABLE}" >/dev/null 2>&1
 
 	# We are done when IPsec is not enabled
 	if [ "${ENABLED}" = "on" ]; then
 		# Enable route table lookup
-		ip rule add lookup "${ROUTE_TABLE}" prio "${ROUTE_TABLE_PRIO}"
+		ip rule add lookup "${ROUTE_TABLE}" prio "${ROUTE_TABLE_PRIO}" >/dev/null 2>&1
 
 		while IFS="," read -r "${VARS[@]}"; do
 			# Check if the connection is enabled
@@ -158,7 +158,7 @@  main() {
 
 						log "Creating route to ${rightsubnet} (via ${address} and ${RED_INTF})"
 						ip route add table "${ROUTE_TABLE}" "${rightsubnet}" proto static \
-							dev "${RED_INTF}" src "${address}"
+							dev "${RED_INTF}" src "${address}" >/dev/null 2>&1
 					done
 
 					# No interface processing required