Commit Graph

85 Commits

Author SHA1 Message Date
Phil Davis
e6abcccc54 Validation of y/n answers in setlanip
At the moment the user can answer "yes" to most of the questions, but then later code only checks if the answer is "y". Thus you can type in "yes" in some places, have it accepted, but actually the negative action is taken. That is weird and will mess up people who try typing a whole string starting with "y".
With this change it makes the user type one of "y", "yes", "n", "no". When they type 1 of those, it is turned into either "y" or "n". Then the existing implementation logic all works as expected.
Hopefully this is the "final" version that fixes the behavior of the (y/n) questions.
I also included the bit at 296-297 which adds the CIDR bit-count range to the prompt, so the user can see exactly what input is valid/expected there.
Redmine issue #4100
2014-12-12 23:01:07 +05:45
Phil Davis
87657b9528 rc.initial.setlanip fix validation of CIDR within range
Currently this allows the user to input any number for the CIDR. I happened to try 44 for an IPv4 CIDR when playing.
This fixes that little bug - I think it is good to commit that first/separately so it can be identified apart from the other (y/n) checking/handling I am working on. Better to have separate commits for distinct bugs.
2014-12-12 21:04:46 +05:45
Phil Davis
eca5402b32 Provide success return indication from console_configure_dhcpd
Recent commit 9ea554ee5c added testing of the return status of console_configure_dhcpd() - this let a user effectively abort from doing anything if they have answered "y" to prompt_for_enable_dhcp_server() and are being asked for the start and end of the range, and then decide they do not want to proceed.
However, even when they gave good answers, status 0 was being returned. This prevented changes ever being implemented.
Redmine: https://redmine.pfsense.org/issues/4080
The fix is to return 1 at the routine end, when all is good and the code should proceed.
2014-12-07 22:41:11 +05:45
Ermal LUÇI
3377dc9da6 Preserve exit code lost from s/exit/return/ 2014-12-02 12:59:54 +01:00
Ermal LUÇI
9ea554ee5c Remove exit from as much as possible backend code 2014-12-02 11:33:21 +01:00
Chris Buechler
8ce04d22fc Static gateways weren't being added to the routing table after configuring at the console, fix that. 2014-11-17 23:27:42 -06:00
Phil Davis
a3fad59243 Fixup dhcpd interface enabled check 2014-11-03 22:28:46 +05:45
Phil Davis
ba667cc6f4 Fix console set interface IP address
Problem as per forum https://forum.pfsense.org/index.php?topic=83651.0
The problem comes whenever services_dhcpd_configure is called - the global $config gets reset from the actual current config, and any pending changes in the current process are lost.
It was introduced by commit 86ce2df
in which services_dhcpdv4_configure() does:

require_once('pkg-utils.inc')

and pkg-utils.inc does various stuff like:

if(file_exists("/cf/conf/use_xmlreader"))
require_once("xmlreader.inc");
else
require_once("xmlparse.inc");

which seems to cause a reset of the $config variable, thus losing the pending changes the user has entered at the console.

The top-level code in rc.initial.setlanip really does not need to (and should not) implement any changes along the way - it should collect all the answers from the user, then write_config and then make all the necessary calls to routines to implement the changes on the running system. This fixes it - defer any calls to services_dhcpd_configure() until after all questions are answered and write_config has happened.
2014-11-03 20:49:15 +05:45
Phil Davis
8727b3c8ec Set interface address from consol tidy output
While trying to see why this is not working for me (forum https://forum.pfsense.org/index.php?topic=83651.0 ) I have fixed some little things:
1) Get the new-lines right so the output of the restarting looks neat
2) Fix a comparison that had just a single equal sign - it did not break anything real because the subsequent code was just text output to the console. Now that text output does take notice of the correctly-evaluated condition, and $interface is not overwritten.

The issue in the forum post, about the interface IP address config not actually changing, is still the case, at least for me.

IMO these little tidy ups might as well be committed. They make this code better!
2014-11-03 11:49:45 +05:45
Phillip Davis
974fb32ccd Enhance interface gateway data entry descriptions 2014-02-07 09:50:06 -08:00
Phil Davis
5a997d96b2 Use correct vars for IPv6 when checking subnet start and end 2013-12-09 03:07:04 -08:00
Phil Davis
12f5a2d861 Check that DHCP end IP is >= DHCP start IP 2013-12-09 01:53:14 -08:00
Phil Davis
3038ece777 Fix checking DHCP end IP is in range
Cut-paste bug
2013-12-08 19:15:22 -08:00
Renato Botelho
7a25652fae Check if dhcp start and end addresses are inside interface subnet, helps #3196 2013-12-06 09:42:11 -02:00
Renato Botelho
bebf0fa8dc When user attempt to set network or broadcast address, ask again for the IP address. Issue #3196 2013-12-06 09:34:55 -02:00
Renato Botelho
20dda76651 Prevent network or broadcast address to be set on interface (console, GUI and wizard). It should fix #3196 2013-12-04 18:21:18 -02:00
Renato Botelho
d632dd5aa9 Check if IP is already configured on console setup 2013-03-14 14:08:38 -03:00
Renato Botelho
9a15b8d2e9 Fix issues on "Set interface(s) IP address" option
- Avoid duplicate gateway entries
- Fix checking if a default gw already exists
- Set IPv6 to none when user choose it
- Set gateway on interface
2013-02-20 16:50:54 -03:00
Renato Botelho
1f56ce5866 Fix dhcp v6 config section name for console setup and check on interfaces.php, the correct is dhcpdv6 instead of dhcpd6. Fixes #2827 2013-02-20 09:41:26 -03:00
Renato Botelho
1b0074d5d1 Interface assignment wrongly changing:
When WAN is set to PPPoE and user set other interfaces IP address using
console, it wrongly change the interface assignment to use the same
device of wan. It was caused by a hard coded "wan" on
console_get_interface_from_ppp() call, when it should use $interface
instead.  It should fix #2074
2013-01-07 17:44:26 -02:00
Darren Embry
d23b53eb51 add gateways to config from cmdline 2012-06-07 20:39:22 -04:00
Darren Embry
1b8bf24dbe again, string interpolation kinda defeats the purpose of gettext. ;-) 2012-06-07 20:39:20 -04:00
Darren Embry
005a704988 variable interpolation defeats the purpose of gettext. 2012-06-07 20:39:19 -04:00
Darren Embry
c63e35947e work in progress: set gateway IPs from console
- add --dry-run mode
- prompts for gateway IP address as needed

does not yet do:
- add gateway to config
2012-06-07 20:39:18 -04:00
Darren Embry
0098aa734e show dhcp/dhcp6/static/staticv6 along with descriptions in console 2012-06-07 15:16:35 -04:00
Darren Embry
6499a7d5d9 show real interface names 2012-06-07 15:16:34 -04:00
Darren Embry
3f63e8e20b minor variable name change. 2012-06-07 15:16:34 -04:00
Darren Embry
d71371bcc0 actually display webconfigurator port numbers on console 2012-06-07 14:03:13 -04:00
Darren Embry
bfaafe2884 setting $config['interfaces']['wan']['ipaddrv6'] to 'dhcp6' *should* work now. 2012-06-07 13:33:42 -04:00
Darren Embry
b3cb233ff6 now shows ipv6 webConfigurator URLs (#2413) 2012-06-07 13:28:19 -04:00
Darren Embry
c1361a9f8b feature #2413 Allow IPv6 interface configuration from the menu 2012-05-17 20:17:48 -04:00
Darren Embry
416e1530bd normalize indentation 2012-05-17 19:17:01 -04:00
Ermal
aab5f04c47 Correct behaviour of switching from console from any ppp type device to other type. This has been broken since new ppp code. 2011-09-12 11:46:29 +00:00
Scott Ullrich
a53992b78d Simplify message that wraps off screen 2011-06-19 15:01:50 -04:00
lgcosta
7a18dfa4ed Fixes #1444. Implements the same fix that issue ermal made in #1522 to the console menu 2011-05-23 11:56:32 -03:00
Ermal
9b2e42c9fa When setting the ip from the console also enable the interface otherwise the HTTP_REFERER checks will not let you use the GUI. 2011-01-28 16:03:42 +00:00
Scott Ullrich
c9fa825423 Show disabled interfaces as well 2010-08-09 21:19:32 -04:00
Scott Ullrich
20252ff529 Make sure <dhcpd><wan> exists before blindly unsetting. 2010-03-10 18:57:18 -05:00
Chris Buechler
a64b5d3f92 if reverted to HTTP, restart lighty 2010-02-27 15:24:35 -05:00
Scott Ullrich
5f2d078e7d Decouple filter.inc from functions.inc. There is no need to process filter functions most of the time. Include filter.inc where it is needed 2009-11-21 19:10:37 -05:00
Scott Ullrich
1dcba27ccb Really restart DHCPD server after changes 2009-08-12 14:00:25 -04:00
Chris Buechler
af25d41585 move killall dhcpd above section that exits if no DHCP servers are enabled, and configure dhcpd if it's disabled by option #2 at the console.
Ticket #1867 (cvstrac)
2009-03-10 02:17:24 -04:00
Scott Ullrich
e3a13b0068 Add services_dhcp_server_enable which allows the DHCP server to be turned
off easily.
2008-10-29 03:07:11 +00:00
Scott Ullrich
e8dba7460f Reload interface being worked on, not blindly lan 2008-10-27 22:51:03 +00:00
Ermal Luçi
69e5a8be8d Rename interfaces_wan_configure to interface_configure now that it is used for all assigned interface configuration. 2008-09-09 11:08:02 +00:00
Ermal Luçi
4476d44751 Merge lan configuration to the interfaces_wan.php page wich does the configuration of all
other assigned interfaces.
2008-09-07 19:34:18 +00:00
Bill Marquette
12294e724d we don't care if rm can't find old dhcpd database files 2008-09-07 01:18:59 +00:00
Bill Marquette
ac6ddeffe1 fix debug code that never worked and make it disabled by default 2008-09-07 01:17:54 +00:00
Bill Marquette
b980f9e485 Semicolons after if's apparently parse...but it's not terribly helpful 2008-09-07 01:15:31 +00:00
Scott Ullrich
7993688e8b Check to see if key exists before unsetting 2008-09-07 01:06:39 +00:00