Error saving raw BGP config



  • When saving some minor edits to an existing OpenBGP raw config I get the following error:
    Fatal error: Call to undefined function write_rcfile() in /usr/local/pkg/openbgpd.inc on line 195

    Checking the config afterwards shows that the config was actually saved.

    I'm running this:
    2.1-BETA0 (i386)
    built on Sat Jul 7 20:01:54 EDT 2012
    FreeBSD 8.3-RELEASE-p3

    I've also submitted a crash report just now.



  • write_rcfile is in service-utils.inc
    It seems odd that /usr/local/pkg/openbgpd.inc does not have any require_once statements at all, I expected to see:

    require_once('service-utils.inc');
    

    and maybe some others, so it can find other routines like conf_mount_rw.
    I notice that openospfd.inc also does not have any require_once statements - it uses conf_mount_rw and write_rcfile.
    I guess that some paths to activating these things have already included the necessary things, and there are other paths that miss out on the includes.
    Other package inc files (pfblocker.inc, squid.inc …) have a whole list of require_once, so they can find the routines they need.
    Hopefully someone who understands why OpenBGP and OpenOSPF have worked without require_once statements for so long can make the fixes - I am reticent to make pull requests when I don't understand how it ever worked.


  • Rebel Alliance Developer Netgate

    Those .inc files for packages are rarely included on their own. The package system will include them and then execute the commands, and the package system generally has most things loaded that could be needed. Especially things like write_rcfile.

    However if you add a require_once("service-utils.inc"); and that works when it's otherwise broken, then by all means, submit a pull request.



  • I added require_once('service-utils.inc'); and the error seems to be gone.


  • Rebel Alliance Developer Netgate

    Added some includes there and in ospfd/quagga since they have similar sets of code, and someone could hit the same issue there potentially.

    https://github.com/bsdperimeter/pfsense-packages/commit/b85fee0718d37e8da27ab2530e311cf5ac6d7434


Locked