Project

General

Profile

Actions

Bug #2645

closed

stristr() warning repeated dozens of times during boot

Added by Adam Thompson over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
CARP
Target version:
Start date:
09/25/2012
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.1
Affected Architecture:

Description

During boot, the message:
Warning: stristr(): Empty delimiter in /etc/inc/interfaces.inc on line 3872
is repeated dozens of times, at two separate points in the boot sequence. I've only managed to capture a screenshot of the second time, but it's probably the same bug anyway.

Given that this warning is being generated by find_carp_interface(), would this have something to do with why the "Configuring CARP..." stage of boot-up takes a very long time now?

Running 2.1-BETA0 (amd64) built on Tue Sep 25 12:35:17 EDT 2012 FreeBSD 8.3-RELEASE-p4.

This error has been occurring for a while, I think, but I haven't needed to troubleshoot anything until today :-).


Files

Clipboard02.png (25.8 KB) Clipboard02.png Adam Thompson, 09/25/2012 05:34 PM
Actions #1

Updated by Phillip Davis over 11 years ago

I put in some basic CARP settings (and maybe not a consistent/valid set?) and got the same PHP warnings from these config.xml sections:

    <hasync>
        <pfsyncpeerip>192.168.1.11</pfsyncpeerip>
        <pfsyncinterface>lan</pfsyncinterface>
        <synchronizetoip>192.168.1.11</synchronizetoip>
        <username/>
        <password/>
        <pfsyncenabled>on</pfsyncenabled>
        <synchronizealiases>on</synchronizealiases>
    </hasync>
    <virtualip>
        <vip>
            <mode>carp</mode>
            <interface>lan</interface>
            <vhid>1</vhid>
            <advskew>0</advskew>
            <advbase>1</advbase>
            <password>test</password>
            <descr><![CDATA[Test VIP]]></descr>
            <type>single</type>
            <subnet_bits>24</subnet_bits>
            <subnet>192.168.1.22</subnet>
        </vip>
    </virtualip>

filter.inc has code that looks for 'ipaddress' in 'hasync' but my config does not have 'ipaddress' mentioned. $ip is getting set to blank when calling find_carp_interface($ip) - and that generates the warning message when using $ip as the needle in stristr().
filter.inc line 3141:
if (is_array($config['hasync'])) {
    foreach($config['hasync'] as $carp) {
    $ip = $carp['ipaddress'];

This code was modified a month ago. Someone who knows what the XML structures in these arrays should be will be able to fix this in a flash.

Actions #2

Updated by Chris Buechler over 11 years ago

  • Target version set to 2.1
Actions #3

Updated by Pi Ba over 11 years ago

Found same issue and mailed to dev@lists a 'possible solution', maybe Ermal Luçi can take another look?

p.s. the long 30 second wait was probably to wait for pfsync to have time to sync the connection firewall states from the backup back to the CARP master. I have added a check in github(https://github.com/bsdperimeter/pfsense/commit/1be1a67a3941de56e6fc80db1d1ee21f6e9c4fce) to see if pfSync is actually set ON, and if not skip the wait.

Below the 'possibly fixed' function for the stristr warnings:

function filter_process_carp_nat_rules() {
    global $g, $config;

    update_filter_reload_status("Creating CARP NAT rules");
    if(isset($config['system']['developerspew'])) {
        $mt = microtime();
        echo "filter_process_carp_nat_rules() being called $mt\n";
    }
    $lines = "";
    if (is_array($config['hasync'])) {
        foreach($config['hasync'] as $carp) {
            $ip = $carp['ipaddress'];
            if($ip == "any") {
                $ipnet = "any";
            } else {
                $int = find_ip_interface($ip);
                $carp_int = find_carp_interface($ip);
            }
            if ($int != false and $int != $wan_interface) {

    $ipnet = convert_ip_to_network_format($ip, $carp['netmask']);
                if ($int && $carp_int)
                    $lines .= "nat on {$int} inet from {$ipnet} to any -> ({$carp_int}) \n";
            }
        }
    }
    return $lines;
}

Actions #4

Updated by Pi Ba over 11 years ago

Previous was not the 'possibly fixed' function it was the 'original' here is the 'fixed' one..:

function filter_process_carp_nat_rules() {
    global $g, $config;

    update_filter_reload_status("Creating CARP NAT rules");
    if(isset($config['system']['developerspew'])) {
        $mt = microtime();
        echo "filter_process_carp_nat_rules() being called $mt\n";
    }
    $lines = "";

    if (is_array($config['virtualip']['vip']) && is_array($config['virtualip'])) {
        foreach($config['virtualip']['vip'] as $carp) {
            if ($carp['mode']!="carp")
                continue;

            $ip = $carp['subnet'];
            if($ip == "any") {
                $ipnet = "any";
            } else {
                $int = find_ip_interface($ip, $carp['subnet_bits']);
                $carp_int = find_carp_interface($ip);
            }

            if ($int != false and $int != $wan_interface) {
                $ipnet = convert_ip_to_network_format($ip, $carp['subnet_bits']);
                if ($int && $carp_int)
                {
                    $lines .= "nat on {$int} inet from {$ipnet} to any -> ({$carp_int}) \n";
                }
            }
        }
    }
    return $lines;
}

Actions #5

Updated by Chris Buechler over 11 years ago

same error still there but has shifted to line 3840

Actions #6

Updated by Jim Pingle over 11 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #7

Updated by Chris Buechler over 11 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF