Bug #2645
closed
stristr() warning repeated dozens of times during boot
Added by Adam Thompson about 12 years ago.
Updated about 12 years ago.
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
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.
- Target version set to 2.1
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;
}
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;
}
same error still there but has shifted to line 3840
- Status changed from New to Feedback
- % Done changed from 0 to 100
- Status changed from Feedback to Resolved
Also available in: Atom
PDF