bsdperimeter/pfsense — pull request #201 by phil-davis (2012-08-02 13:01:56+00:00)
Title: Bogons updated - make sure conf_mount_rw and conf_mount_ro are matched

Oh dear - I shouldn't keep looking at my nanobsd mount state! This one needed a bit of work to make sure the various error cases would be handled correctly and the mount state returned to RO as well...
On nanobsd, running /etc/rc.update_bogons.sh gives:
[2.1-BETA0][admin@test02.homedomain]/tmp(12): /etc/rc.update_bogons.sh 1
/etc/rc.update_bogons.sh: cannot create /etc/bogonsv6: Read-only file system

The code does 1 conf_mount_rw but 2 conf_mount_ro. This is also seen in system.log:
Aug 2 17:47:59 test02 admin: rc.update_bogons.sh is starting up.
Aug 2 17:47:59 test02 admin: rc.update_bogons.sh is beginning the update cycle.
Aug 2 17:49:27 test02 admin: Bogons file downloaded: 1 addresses added.
Aug 2 17:49:29 test02 php: : Reference 1000 is going negative, not doing unreference.
Aug 2 17:49:29 test02 admin: Bogons files downloaded: no changes.
Aug 2 17:49:29 test02 admin: rc.update_bogons.sh is ending the update cycle.

The V6 bogons file does not get applied because the filesystem is RO by that point.

I have reviewed the whole logic of this shell script. I believe it handles the various cases correctly now. After the changes, on nanobsd I get the following in system.log:
Aug 2 18:17:13 test02 admin: rc.update_bogons.sh is starting up.
Aug 2 18:17:13 test02 admin: rc.update_bogons.sh is beginning the update cycle.
Aug 2 18:18:02 test02 admin: Bogons V4 file downloaded: no changes.
Aug 2 18:18:10 test02 admin: Bogons V6 file downloaded: 58959 addresses added.
Aug 2 18:18:52 test02 admin: rc.update_bogons.sh is ending the update cycle.

Now I have a bogons file for V6 on my nanobsd system.