Project

General

Profile

Actions

Bug #14035

closed

PHP error when attempting to create a GIF interface when ``if_gif`` kernel module is not loaded

Added by Steve Wheeler over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Category:
Interfaces
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.05
Release Notes:
Default
Affected Version:
2.7.0
Affected Architecture:
All

Description

After removing an recreating a GIF tunnel:

[24-Feb-2023 20:52:20 America/Chicago] PHP Fatal error:  Uncaught TypeError: pfSense_interface_flags(): Argument #1 ($ifname) must be of type string, array given in /etc/inc/interfaces.inc:44
Stack trace:
#0 /etc/inc/interfaces.inc(44): pfSense_interface_flags(Array, 1)
#1 /etc/inc/interfaces.inc(1271): interfaces_bring_up(Array)
#2 /usr/local/www/interfaces_gif_edit.php(124): interface_gif_configure(Array)
#3 {main}
  thrown in /etc/inc/interfaces.inc on line 44


Related issues

Related to Regression #14086: Current snapshot builds missing most kernel modules that were on previous builds/releasesResolvedBrad Davis

Actions
Actions #1

Updated by Jim Pingle over 1 year ago

I can't reproduce this by adding/removing/adding a GIF interface. Do we know what was in the config.xml section for the GIF interfaces here (<gifs>...</gifs>)?

Actions #2

Updated by Steve Wheeler over 1 year ago

See: https://forum.netgate.com/post/1090298

More detail needed to reproduce

Actions #3

Updated by Jay Maynard over 1 year ago

What information can I supply?

Actions #4

Updated by Jim Pingle over 1 year ago

Jay Maynard wrote in #note-3:

What information can I supply?

See my comment in #note-1 above.

Actions #5

Updated by Steve Wheeler over 1 year ago

We actually have the full config this is hitting this in Nextcloud.

The gif section is empty:

    <gifs>
    </gifs>

Actions #6

Updated by Jim Pingle over 1 year ago

  • Subject changed from PHP Error: /etc/inc/interfaces.inc:44 to PHP Error when attempting to create a GIF interface

My configuration also has <gifs></gifs> and I can create a new GIF OK. I still can't find a way to reproduce this reliably. The problem here seems to be something different than an empty config element, though.

Somehow it's getting an array in the GIF interface field when it should be a string. It's not clear if that's coming from a call to pfSense_interface_create2("gif") on its own or if somehow the $_POST variable is getting an array value.

If someone can reproduce this, try going to Diagnostics > Command Prompt and running this in the PHP exec box:

var_dump( pfSense_interface_create2("gif") );

It should return a string like:

string(4) "gif0" 

If it's an array, then that's the reason it's failing.

If that is a string, then the problem is more likely coming from the POST values the client browser is submitting to interfaces_gif_edit.php which would be tricky to nail down remotely. First step would be to open the browser's debug panel to the network pane and then try to submit the form, and show the contents of the variables it submitted in the request.

Actions #7

Updated by Jim Pingle over 1 year ago

  • Category changed from Web Interface to Interfaces
  • Status changed from New to Feedback
  • Plus Target Version changed from 23.05 to 23.09

This is going to have to wait unless someone can find a way to reproduce it reliably since I still am unable to replicate it.

Actions #8

Updated by Steve Wheeler over 1 year ago

  • Status changed from Feedback to Confirmed
  • Plus Target Version changed from 23.09 to 23.05

I'm hitting this on a clean(ish) 23.05 armv7 install. Full log shows more errors:

Apr 25 23:18:34     php-fpm     1140     /interfaces_gif_edit.php: The command '/sbin/ifconfig Array tunnel 172.21.16.18 '172.21.16.59'' returned exit code '1', the output was 'ifconfig: interface Array does not exist'
Apr 25 23:18:34     php-fpm     1140     /interfaces_gif_edit.php: The command '/sbin/ifconfig Array '10.15.1.1' '10.15.1.2' netmask 255.255.255.252' returned exit code '1', the output was 'ifconfig: interface Array does not exist'
Apr 25 23:18:34     php-fpm     1140     /interfaces_gif_edit.php: PHP ERROR: Type: 1, File: /etc/inc/interfaces.inc, Line: 44, Message: Uncaught TypeError: pfSense_interface_flags(): Argument #1 ($ifname) must be of type string, array given in /etc/inc/interfaces.inc:44
Apr 25 23:18:34     php-fpm     1140     Stack trace:
Apr 25 23:18:34     php-fpm     1140     #0 /etc/inc/interfaces.inc(44): pfSense_interface_flags(Array, 1)
Apr 25 23:18:34     php-fpm     1140     #1 /etc/inc/interfaces.inc(1271): interfaces_bring_up(Array)
Apr 25 23:18:34     php-fpm     1140     #2 /usr/local/www/interfaces_gif_edit.php(124): interface_gif_configure(Array)
Apr 25 23:18:34     php-fpm     1140     #3 {main}
Apr 25 23:18:34     php-fpm     1140     thrown
Apr 25 23:18:34     php-fpm     1140     /interfaces_gif_edit.php: New alert found: PHP ERROR: Type: 1, File: /etc/inc/interfaces.inc, Line: 44, Message: Uncaught TypeError: pfSense_interface_flags(): Argument #1 ($ifname) must be of type string, array given in /etc/inc/interfaces.inc:44
Apr 25 23:18:34     php-fpm     1140     Stack trace:
Apr 25 23:18:34     php-fpm     1140     #0 /etc/inc/interfaces.inc(44): pfSense_interface_flags(Array, 1)
Apr 25 23:18:34     php-fpm     1140     #1 /etc/inc/interfaces.inc(1271): interfaces_bring_up(Array)
Apr 25 23:18:34     php-fpm     1140     #2 /usr/local/www/interfaces_gif_edit.php(124): interface_gif_configure(Array)
Apr 25 23:18:34     php-fpm     1140     #3 {main}
Apr 25 23:18:34     php-fpm     1140     thrown 

23.05-DEVELOPMENT (arm)
built on Mon Apr 24 06:04:52 UTC 2023
FreeBSD 14.0-CURRENT

The config file has no gif tags

Actions #9

Updated by Reid Linnemann over 1 year ago

  • Status changed from Confirmed to Feedback
  • Assignee set to Reid Linnemann

Since MODULES_OVERRIDE was fixed in crossbuild at on 3 March 2023, all modules are no longer being built and included in the images. As it happens, for armv7 devices gif and tuntap are omitted from the kernconfs and have previously been available as KLDs. To rectify this, in crossbuild revision 1303b49 I have added the if_gif and if_tuntap modules to the overrides for armv7, the next snapshot build should use this updated crossbuild and include the modules in the resulting image.

Actions #10

Updated by Jim Pingle over 1 year ago

  • Related to Regression #14086: Current snapshot builds missing most kernel modules that were on previous builds/releases added
Actions #11

Updated by Reid Linnemann over 1 year ago

  • Status changed from Feedback to Confirmed

This is closer but not enough, the module isn't automatically loaded when creating the GIF with pfSense_interface_create2, so we fail with the same error, which is happening in 23.01.

Actions #12

Updated by Reid Linnemann over 1 year ago

  • Status changed from Confirmed to Feedback
  • % Done changed from 0 to 100
Actions #13

Updated by Jim Pingle over 1 year ago

  • Subject changed from PHP Error when attempting to create a GIF interface to PHP error when attempting to create a GIF interface on ARM

Updating subject for release notes.

Actions #14

Updated by Jim Pingle over 1 year ago

  • Status changed from Feedback to Resolved

This is working well on current snapshots. Creating a GIF on a 3100 (ARMv7) loads the module and no longer generates a PHP error when creating a GIF interface.

Actions #15

Updated by Jim Pingle over 1 year ago

  • Subject changed from PHP error when attempting to create a GIF interface on ARM to PHP error when attempting to create a GIF interface when ``if_gif`` kernel module is not loaded
Actions #16

Updated by Jim Pingle over 1 year ago

  • Affected Version set to 2.7.0
Actions

Also available in: Atom PDF