diff options
author | gnhb <gnoahb@gmail.com> | 2010-08-13 21:54:14 +0700 |
---|---|---|
committer | gnhb <gnoahb@gmail.com> | 2010-08-13 21:54:14 +0700 |
commit | df309b3775db6f84ad2cc830b35c1c46c51ce318 (patch) | |
tree | 14819b8d2830a1338aa8f7bd41df3c17d0611a18 | |
parent | 2f848ab7ae9d1541bdaaa487e9cda5559f2c287d (diff) | |
download | pfsense-df309b3775db6f84ad2cc830b35c1c46c51ce318.zip pfsense-df309b3775db6f84ad2cc830b35c1c46c51ce318.tar.gz |
If mpd.conf files exists in the /conf directory, link to it instead of
generating a new one from config.xml data.
This allows power users to tweak mpd conf to their delight, and gives
devs a way of testing out conf tweaks without needing to alter php code.
-rw-r--r-- | etc/inc/interfaces.inc | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index a3b163e..97503b8 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1107,13 +1107,6 @@ function interface_ppps_configure($interface) { break; } } - - /* generate mpd.conf */ - $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); - if (!$fd) { - log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n"); - return 0; - } if (is_array($ports) && count($ports) > 1) $multilink = "enable"; @@ -1368,9 +1361,20 @@ EOD; $mpdconf .= "\topen\r\n"; } //end foreach($port) - // Write out mpd_ppp.conf - fwrite($fd, $mpdconf); - fclose($fd); + + /* Generate mpd.conf. If mpd_[interface].conf exists in the conf path, then link to it instead of generating a fresh conf file. */ + if (file_exists("{$g['conf_path']}/mpd_{$interface}.conf")) + mwexec("/bin/ln -s {$g['conf_path']}/mpd_{$interface}.conf {$g['varetc_path']}/."); + else { + $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); + if (!$fd) { + log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n"); + return 0; + } + // Write out mpd_ppp.conf + fwrite($fd, $mpdconf); + fclose($fd); + } // Create the uptime log if requested and if it doesn't exist already, or delete it if it is no longer requested. if (isset($ppp['uptime'])) { |