Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lost "wan" interface in the JSON output. #4

Closed
Snille opened this issue Jun 9, 2017 · 8 comments
Closed

Lost "wan" interface in the JSON output. #4

Snille opened this issue Jun 9, 2017 · 8 comments

Comments

@Snille
Copy link

Snille commented Jun 9, 2017

Hi, I updated to latest version of pfSense 2.3.4-RELEASE (amd64)
Then I lost my "wan" interface in the JSON output.

If I print the "$a_gateways" I get this:

Array (
[VPN_VPNV4] => Array (
[interface] => bge1
[gateway] => dynamic
[name] => VPN_VPNV4
[weight] => 1
[ipprotocol] => inet
[interval] =>
[descr] => Interface VPN_VPNV4 Gateway
[dynamic] => 1
[monitor] => dynamic
[friendlyiface] => lan
[attribute] => 0
)
[WAN_DHCP] => Array (
[interface] => bge0
[gateway] => 81.233.82.1
[name] => WAN_DHCP
[weight] => 1
[ipprotocol] => inet
[interval] =>
[descr] => Interface WAN_DHCP Gateway
[defaultgw] => 1
[dynamic] => 1
[monitor] => 81.233.82.1
[friendlyiface] => wan
[attribute] => 1
)
)

But the JSON output is:
{"lan":{"inKbps":3864.2620418484,"outKbps":5268.2221868671,"interface":"bge1"}}

Not sure why this happens... Any ideas? :)

Best regards Snille

@Snille
Copy link
Author

Snille commented Jun 9, 2017

Looks like the "$gateways_status" variable is just an empty array.
Maybe that's why it does not work?

@alexpmorris
Copy link
Owner

alexpmorris commented Jun 17, 2017

It's possible it's something with a newer version of PHP they're using. I haven't upgraded to the latest pfSense yet so can't check myself right now. But from looking at the latest code, they seem to initialize the variable with array() before calling return_gateways_status():

$gateways_status = array();
$gateways_status = return_gateways_status(true);

Try adding that first line and see if it works for you. If so, I'll update the repo. Thanks!

Reference: https://github.com/pfsense/pfsense/blob/7cdb1ff98361bd352134d78732fb519957803728/src/usr/local/www/status_gateways.php

@Snille
Copy link
Author

Snille commented Jun 20, 2017

Nope, still only get the "lan" interface in the json. :(

@alexpmorris
Copy link
Owner

from their code, really the only other line from pfsense's "status_gateways.php" there is require_once("guiconfig.inc");. Perhaps they changed something that requires that first. Maybe try dropping the following php file into that directory to see if that gives you anything.

testgateways.php:

require_once("guiconfig.inc");
//define('COLOR', true);
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
print_r($gateways_status);

@Snille
Copy link
Author

Snille commented Jun 27, 2017

Nope, just an empty array... :(
Array ( )

@alexpmorris
Copy link
Owner

That's really strange then, possible something else is going on then with your setup, because that's the exact code from the pfsense interface! how about when you visit your router's "Status: Gateways" page. Does that show the information, or is it blank too? http://routerip/status_gateways.php

@Snille
Copy link
Author

Snille commented Jun 28, 2017

Oh, that gave a hint! :)
First I got this when entering the URL:
image
Then I wounder, is that really right.... So I "restarted" the gateways? (clicked the circle arrow at the top right corner) and then I got this:
image
And now it works! :)

Sorry for all your troubles... I actually did not know you could restart the "gateways". :)

@Snille Snille closed this as completed Jun 28, 2017
@alexpmorris
Copy link
Owner

ok great, glad you finally solved it! hopefully this thread will at least help others who also run into the same issue! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants