bsdperimeter/pfsense — pull request #95 by phil-davis (2012-04-23 09:22:51+00:00)
Title: Remove existing RRD files before restoring from XML

My Alix console running:
"2.1-DEVELOPMENT (i386) built on Sun Apr 22 04:56:45 EDT 2012 FreeBSD 8.3-RELEASE"
displays the following text in the boot:
Generating RRD graphs...ERROR: creating '/var/db/rrd//WAN_DHCP-quality.rrd': File exists
ERROR: creating '/var/db/rrd//WAN_DHCP6-quality.rrd': File exists
ERROR: creating '/var/db/rrd//ipsec-packets.rrd': File exists
ERROR: creating '/var/db/rrd//ipsec-traffic.rrd': File exists
ERROR: creating '/var/db/rrd//lan-packets.rrd': File exists
ERROR: creating '/var/db/rrd//lan-traffic.rrd': File exists
ERROR: creating '/var/db/rrd//system-memory.rrd': File exists
ERROR: creating '/var/db/rrd//system-processor.rrd': File exists
ERROR: creating '/var/db/rrd//system-states.rrd': File exists
ERROR: creating '/var/db/rrd//wan-packets.rrd': File exists
ERROR: creating '/var/db/rrd//wan-traffic.rrd': File exists

At:
/etc/inc/interfaces.inc
interface_dhcpv6_configure()
mwexec("/sbin/ifconfig {$wanif} inet6 defroute_rtadv");

The console displays:
"pflog0: promiscuous mode enabled"
and at that time the above rrd files appear.

Later in the boot, "Generating RRD data" happens and tries to restore previous RRD data from saved XML files. The restore does not work because the target RRD files already exist.

This fix first deletes an RRD files if it exists, then restores from XML.

Also, maybe whatever is happening in:
/etc/inc/interfaces.inc
interface_dhcpv6_configure()
should not be doing so much so as to make the RRD files appear?
somehow could it be stopped from making RRD files earlier?
then the restore would go easily into an empty directory?

While working out what was going on in the interface creation code, I noticed a few minor typos in interfaces.inc which have no functional effect. So I have fixed those also in this pull request.