File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -129,11 +129,6 @@ class InterfaceGRE extends Model {
129129 * Applies changes to this Interface GRE Tunnel.
130130 */
131131 public function apply (): void {
132- # Create the GRE interface if no greif exists
133- if (!$ this ->greif ->value ) {
134- interface_gre_configure ($ this ->to_internal ());
135- }
136-
137132 # If the greif is already assigned to an interface, reconfigure the interface
138133 $ if_q = NetworkInterface::query (if: $ this ->greif ->value );
139134 if ($ if_q ->exists ()) {
@@ -148,6 +143,23 @@ class InterfaceGRE extends Model {
148143 pfSense_interface_destroy ($ this ->greif ->value );
149144 }
150145
146+ /**
147+ * Extend the default _create method to create the GRE interface and obtain the real interface name.
148+ */
149+ public function _create (): void
150+ {
151+ $ this ->greif ->value = interface_gre_configure ($ this ->to_internal ());
152+ parent ::_create ();
153+ }
154+
155+ /**
156+ * Extend the default _update method to reconfigure the GRE interface.
157+ */
158+ public function _update (): void {
159+ interface_gre_configure ($ this ->to_internal ());
160+ parent ::_update ();
161+ }
162+
151163 /**
152164 * Extend the default _delete method to prevent deletion of the GRE interface while in use.
153165 * @throws ConflictError If the GRE interface is in use.
You can’t perform that action at this time.
0 commit comments