GetIPadrress broken - fedora 20



  • Hi,
    fedora 20 ifconfig reports no ‘:’ that break getIPaddress.
    So, the groupmanager.log reports:

    7-25-14 9:45:11 am] * Checking if I am the group manager.
    [07-25-14 9:45:11 am] * I don’t appear to be the group manager, I will check back later. log
    [07-25-14 9:45:11 am] * Checking if I am the group manager.
    [07-25-14 9:45:11 am] * I don’t appear to be the group manager, I will check back later.

    I used more standard ‘ip’ command (tested on ubuntu too):
    FOGCore.class.php

    369c369
    < exec(“ip -4 -o address|awk ‘{print $4}’|sed ‘s//.*//’”, $arR, $retVal);

              exec("/sbin/ifconfig | grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'| cut -d':' -f 2 | cut -d' ' -f1", $arR, $retVal);
    

    Ciao
    Enrico



  • Sorry, I attach the fedora 20 output:
    [B]em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet x.x.x.x netmask 255.255.255.224 broadcast x.x.x.y[/B]
    As you can see, there is not a ‘:’ but the source code search for it:
    exec("/sbin/ifconfig | grep ‘[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}’|[B] cut -d’:’ -f 2[/B] | cut -d’ ’ -f1", $arR, $retVal);
    so the outuput is null…
    Ciao
    Enrico


  • Senior Developer

    I don’t understand the issue.
    the ifconfig is attempting to use standard methods to get the ipaddress, and while the ip -4 -o address may work in a couple cases I’m not 100% sure that this works on all cases of linux.


 

530
Online

41.9k
Users

12.5k
Topics

117.6k
Posts