diff options
-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'])) { |