Koozali.org: home of the SME Server

$localip returns -1

Offline compsos

  • *
  • 472
  • +0/-0
$localip returns -1
« on: January 23, 2014, 02:04:33 AM »
Hi
We have seen this on a few systems where the $localip in the template files returns -1 instead of the IP address. As systems do not change networks very often putting the IP address in the template is not a big deal.

But a cosmetic issue occurs on the System Info box in Globals
The $localip comes from line 536 in php/sarkglobal/view.php but as the templates are producing the same result the issue must be deeper.
Has anyone else seen this and have a cure?

Code: [Select]
<span style="color: #696969;" ><span style="font-weight:bold; font-size:small; ">Sysinfo</span><br />Serial #: <strong>534341</strong><br/>Release #: <strong>4.0.0-103 </strong><br/>Web Server: <strong>Apache</strong><br/>Browser: <strong>Firefox</strong><br/><span style="font-weight:bold;
font-size:small; ">Network</span><br />hostname: <strong>server</strong><br/>LAN IP: <strong>-1</strong><br/><span style="font-weight:bold;
font-size:small; ">Hardware</span><br />System Media: <strong>disk</strong><br/>Disk Usage: <strong>1%</strong><br/>RAM Size: <strong></strong>
<br/>RAM Free: <strong></strong><br/><span style="font-weight:bold; font-size:small; ">Status</span><br />PBX State: <strong>RUNNING</strong>
<br/>SysTime: <strong>10:43:02 </strong><br/>
Regards

Gordon............

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: $localip returns -1
« Reply #1 on: January 23, 2014, 09:43:44 AM »
SAIL expects eth0 to hold the localip.   It's likely on the systems where you've seen this issue that eth0 isn't being used. Check with ifconfig or ip addr.

Kind Regards

S

Offline compsos

  • *
  • 472
  • +0/-0
Re: $localip returns -1
« Reply #2 on: January 23, 2014, 10:31:52 PM »
Jeff
I think you are right. We have added OpenVPN to some systems because the standard vpn is unrealiable. OpenVPN creates a br0 that holds the IP address. Will recheck and see if the issue follows OpenVPN. Is there some code that can be adaptive to sensing the LocalIP? Maybe the 'config show InternalInterface | grep IPAddress' is correct.
Regards

Gordon............

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: $localip returns -1
« Reply #3 on: January 26, 2014, 09:15:44 PM »
Hi there

while config show InternalInterface | grep IPAddress may indeed work, it is rather too distro-centric to put into the mainline, at least without some further work.  As far as possible, we try to keep the mainline to vanilla Linux so it will run anywhere.  For individual installs you can just override $localip with a real address and you're done.   You can either do it for each phone extension or copy/create your own custom template.

Best

S
       

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: $localip returns -1
« Reply #4 on: January 28, 2014, 11:34:00 AM »
i've added a note to the development list to suppress display if it doesn't get a valid IP.

Best

S

Offline compsos

  • *
  • 472
  • +0/-0
Re: $localip returns -1
« Reply #5 on: February 08, 2014, 10:35:46 AM »
Thanks S
So there is no where else in Sail that is dependent on the $localip variable, just the sys info box?
Regards

Gordon............

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: $localip returns -1
« Reply #6 on: February 09, 2014, 04:34:02 PM »
Yes, it is used by the provisioning system so you'll need to override it in your provisioning files if you use them.  It isn't used anywhere else as far as I know.

Kind Regards
S



Offline compsos

  • *
  • 472
  • +0/-0
Re: $localip returns -1
« Reply #7 on: February 10, 2014, 09:48:58 AM »
S
saw this in the updates to ver9

Code: [Select]
- Do not hardcode NIC names to eth0 and eth1.
- Return nic names in probeAdapters so we can drop HWAddress.
- Remove HWAddress prop from interfaces.
- Remove the "swap interface" feature.

NIC names maybe more dynamic in 9?
Regards

Gordon............