Project

General

Profile

Bug #15449 » 15449.txt

Marcos M, 05/31/2024 04:03 PM

 
1
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
2
index 67aa569c3f..eea801beab 100644
3
--- a/src/etc/inc/interfaces.inc
4
+++ b/src/etc/inc/interfaces.inc
5
@@ -1554,6 +1554,12 @@ function interface_ipsec_vti_configure($ph1ent) {
6
 				mwexec("/sbin/ifconfig {$ipsecif} mtu {$vtimtu}");
7
 			}
8
 		}
9
+		/* Add the VTI to the interface cache directly because calling 'get_interface_arr(true)' is expensive.
10
+		   See: https://redmine.pfsense.org/issues/15449 */
11
+		global $interface_arr_cache;
12
+		if (is_array($interface_arr_cache) && !in_array($ipsecif, $interface_arr_cache)) {
13
+			$interface_arr_cache[] = $ipsecif;
14
+		}
15
 		system_routing_configure(convert_real_interface_to_friendly_interface_name($ipsecif));
16
 	}
17
 	return true;
18
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
19
index 4bb52eb12c..e9266d61c0 100644
20
--- a/src/etc/inc/util.inc
21
+++ b/src/etc/inc/util.inc
22
@@ -3212,8 +3212,13 @@ function route_add_or_change($target, $gw, $iface = '', $args = '',
23
 	}
24
 
25
 	if (empty($params)) {
26
-		log_error("route_add_or_change: Invalid gateway {$gw} and/or " .
27
-		    "network interface {$iface}");
28
+		if (!empty($gw) && !empty($iface)) {
29
+			log_error("route_add_or_change: Invalid gateway ({$gw}) and network interface was not found ({$iface})");
30
+		} elseif (!empty($gw)) {
31
+			log_error("route_add_or_change: Invalid gateway ({$gw})");
32
+		} else {
33
+			log_error("route_add_or_change: Network interface was not found ({$iface})");
34
+		}
35
 		return false;
36
 	}
37
 
(6-6/6)