in reply to Re: IP address validation when IP is picked dynamically
in thread IP address validation when IP is picked dynamically

Value of variable parameter_value is proper but it does not pass is_ipv4() function test

[root@localhost bond]# perl ifcfgbondverification.pl Enter the absolute directory location for ifcfg files /root/office/ifcfgverification/bond Value of parameter is 172.20.1.1 Failed -> IPADDR:172.20.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.26.1.1 Failed -> IPADDR:172.26.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.28.1.1 Failed -> IPADDR:172.28.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.30.1.1 Failed -> IPADDR:172.30.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.27.1.1 Failed -> IPADDR:172.27.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.21.1.1 Failed -> IPADDR:172.21.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no Value of parameter is 172.31.1.1 Failed -> IPADDR:172.31.1.1 Value of parameter is 255.0.0.0 Failed -> NETMASK:255.0.0.0 Value of parameter is 172.30.12.25 Failed -> DNS1:172.30.12.25 Value of parameter is Failed -> MTU: Value of parameter is none Failed -> BOOTPROTO:none Value of parameter is yes Failed -> ONBOOT:yes Value of parameter is NO Failed -> USERCTL:NO Value of parameter is no Failed -> NM_CONTROLLED:no [root@localhost bond]#

Replies are listed 'Best First'.
Re^3: IP address validation when IP is picked dynamically
by toolic (Bishop) on May 01, 2015 at 14:00 UTC
    That's not sufficient. There is probably whitespace at the end of $parameter_value:
    print "Failed -> $key:$parameter_value<<<\n"

    Please read the Basic debugging checklist.

    Print a full $line and post it.

    Are you using the latest version of Data::Validate::IP from CPAN?

Re^3: IP address validation when IP is picked dynamically
by Laurent_R (Canon) on May 01, 2015 at 14:10 UTC
    Could you show the revised code producing this result?

    And also use the printing debugging trick suggested by toolic ad the end of his post Re^3: IP address validation when IP is picked dynamically, i.e.:

    my($key, $parameter_value) = split("=", $line); print ">>>$parameter_value<<<\n";
    because this will tell you, for example, if there is a trailing new line or space character at the end of your $parameter_value variable.

    Update: Ooops, too late, toolic was much faster.

    Je suis Charlie.