https://redmine.pfsense.org/https://redmine.pfsense.org/favicon.ico?16780521162010-02-07T23:51:57ZpfSense bugtrackerpfSense - Bug #341: Changing PPP configuration doesn't update ppp.confhttps://redmine.pfsense.org/issues/341?journal_id=9652010-02-07T23:51:57ZMarcus Brown
<ul></ul><p>Also, checking the "default gateway" checkbox doesn't persist when you re-visit interface_ppp_edit.php.</p>
<p>I've found this problem too. Here is what I've found. <br />1. User presses "Save" <br />2. Changes get flushed to config.xml<br />3. Changes don't get flushed to ppp.conf<br />4. Go edit the PPP interface again.<br />5. (Check the default gateway box again because it doesn't remain checked when you open the interface edit page again)<br />6. Click "Save" button.<br />7. Note that changes have been propagated to ppp.conf</p>
<p>The ppp_interface_configure function reads config data from conf.xml and its called before "write_config():" in interfaces_ppp_edit.php. So its pulling the old data from config.xml before the call to write the new settings to config.xml.</p>
<p>Here's the end of the POST function in interfaces_ppp_edit.php. I fixed mine by putting the interfaces_ppp_configure(); call after write_config();. BEWARE race condition. I put a sleep(6); command in there too to give the write command time to finish. It's a bad hack, but I'm not good enough to figure out how to do it elegantly.</p>
<pre><code>$ppp['descr'] = $_POST['descr'];</code></pre>
<pre><code>interfaces_ppp_configure();</code></pre>
<pre><code>if (isset($id) && $a_ppps[$id])<br /> $a_ppps[$id] = $ppp;<br /> else<br /> $a_ppps[] = $ppp;</code></pre>
<pre><code>write_config();</code></pre>
<pre><code>header("Location: interfaces_ppp.php");<br /> exit;<br /> }<br />}</code></pre>
<p>Also, there's a mistake in interfaces_ppp_edit.php line 195. instead of quotes around the word "echo -><br />"echo checked" <br />It should look like this.<br /><input type="checkbox" value="on" id="defaultgw" name="defaultgw" <?php if (isset($pconfig['defaultgw'])) echo "checked"; ?>></p>
<p>Incidentall, I noticed that its broken in system_gateways_edit.php too, but for a different reason. Code looks like this . . .</p>
<p><?php if ($pconfig['defaultgw'] == true) echo "checked"; ?></p>
<p>but should probably look like the above line, using -> if (isset($pconfig['defaultgw'])) echo "checked";<br />I tested it and it works.</p>
<p>Gabriel</p> pfSense - Bug #341: Changing PPP configuration doesn't update ppp.confhttps://redmine.pfsense.org/issues/341?journal_id=9662010-02-07T23:54:52ZMarcus Brown
<ul></ul><p>Sorry, those code samples got clobbered.<br />code should read</p>
<p>echo "checked" <br />instead of<br />"echo checked"</p>
<p>and the other reference to the bad code got deleted, but the fix is still there.</p> pfSense - Bug #341: Changing PPP configuration doesn't update ppp.confhttps://redmine.pfsense.org/issues/341?journal_id=9802010-02-08T17:08:40ZErmal Luçieri@pfsense.org
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Feedback</i></li></ul><p>Your suggestion are committed now.<br />Though there is no race between write_config() and calling a configuration function after.<br />It would be perfectly safe to call the configure function just before write_config but seem code in pfSense usually does it after so for consistency i choose this way.</p>
<p>Thank you for your contribution.</p> pfSense - Bug #341: Changing PPP configuration doesn't update ppp.confhttps://redmine.pfsense.org/issues/341?journal_id=13372010-03-24T09:24:25ZMarcus Brown
<ul></ul><p>I think this can be closed.</p> pfSense - Bug #341: Changing PPP configuration doesn't update ppp.confhttps://redmine.pfsense.org/issues/341?journal_id=13392010-03-24T09:48:01ZErmal Luçieri@pfsense.org
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul>