Bug #341
closedChanging PPP configuration doesn't update ppp.conf
0%
Description
Making changes to a PPP configuration, such as changing the default gateway checkbox, doesn't update ppp.conf with those changes.
Updated by Marcus Brown almost 15 years ago
Also, checking the "default gateway" checkbox doesn't persist when you re-visit interface_ppp_edit.php.
I've found this problem too. Here is what I've found.
1. User presses "Save"
2. Changes get flushed to config.xml
3. Changes don't get flushed to ppp.conf
4. Go edit the PPP interface again.
5. (Check the default gateway box again because it doesn't remain checked when you open the interface edit page again)
6. Click "Save" button.
7. Note that changes have been propagated to ppp.conf
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.
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.
$ppp['descr'] = $_POST['descr'];
interfaces_ppp_configure();
if (isset($id) && $a_ppps[$id])
$a_ppps[$id] = $ppp;
else
$a_ppps[] = $ppp;
write_config();
header("Location: interfaces_ppp.php");
exit;
}
}
Also, there's a mistake in interfaces_ppp_edit.php line 195. instead of quotes around the word "echo ->
"echo checked"
It should look like this.
<input type="checkbox" value="on" id="defaultgw" name="defaultgw" >
Incidentall, I noticed that its broken in system_gateways_edit.php too, but for a different reason. Code looks like this . . .
but should probably look like the above line, using -> if (isset($pconfig['defaultgw'])) echo "checked";
I tested it and it works.
Gabriel
Updated by Marcus Brown almost 15 years ago
Sorry, those code samples got clobbered.
code should read
echo "checked"
instead of
"echo checked"
and the other reference to the bad code got deleted, but the fix is still there.
Updated by Ermal Luçi almost 15 years ago
- Status changed from New to Feedback
Your suggestion are committed now.
Though there is no race between write_config() and calling a configuration function after.
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.
Thank you for your contribution.