Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
aaa15968
Commit
aaa15968
authored
May 11, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: some defaults for the questions...
parent
e9dbd8fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
40 deletions
+39
-40
rc.initial.setlanip
src/etc/rc.initial.setlanip
+39
-40
No files found.
src/etc/rc.initial.setlanip
View file @
aaa15968
...
@@ -2,30 +2,31 @@
...
@@ -2,30 +2,31 @@
<?php
<?php
/*
/*
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
* Copyright (C) 2017 Franco Fichtner <franco@opnsense.org>
All rights reserved.
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
* All rights reserved.
Redistribution and use in source and binary forms, with or without
*
modification, are permitted provided that the following conditions are met:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
*
this list of conditions and the following disclaimer.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
*
notice, this list of conditions and the following disclaimer in the
* 2. Redistributions in binary form must reproduce the above copyright
documentation and/or other materials provided with the distribution.
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
*
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
POSSIBILITY OF SUCH DAMAGE.
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/
* POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"config.inc"
);
require_once
(
"config.inc"
);
require_once
(
"interfaces.inc"
);
require_once
(
"interfaces.inc"
);
...
@@ -43,7 +44,7 @@ function console_prompt_for_yn($prompt_text, $default = '')
...
@@ -43,7 +44,7 @@ function console_prompt_for_yn($prompt_text, $default = '')
$prompt_yn
=
sprintf
(
'[%s/%s] '
,
$default
==
'y'
?
'Y'
:
'y'
,
$default
==
'n'
?
'N'
:
'n'
);
$prompt_yn
=
sprintf
(
'[%s/%s] '
,
$default
==
'y'
?
'Y'
:
'y'
,
$default
==
'n'
?
'N'
:
'n'
);
while
(
true
)
{
while
(
true
)
{
echo
"
\n
{
$prompt_text
}
{
$prompt_yn
}
"
;
echo
"
{
$prompt_text
}
{
$prompt_yn
}
"
;
switch
(
strtolower
(
chop
(
fgets
(
$fp
))))
{
switch
(
strtolower
(
chop
(
fgets
(
$fp
))))
{
case
'y'
:
case
'y'
:
return
true
;
return
true
;
...
@@ -93,9 +94,9 @@ function prompt_for_enable_dhcp_server($version = 4)
...
@@ -93,9 +94,9 @@ function prompt_for_enable_dhcp_server($version = 4)
return
false
;
return
false
;
}
}
$label_DHCP
=
(
$version
===
6
)
?
"DHCP6"
:
"DHCP"
;
$label_DHCP
=
(
$version
===
6
)
?
'DHCP6'
:
'DHCP'
;
$upperifname
=
strtoupper
(
$interface
);
$upperifname
=
strtoupper
(
$interface
);
return
console_prompt_for_yn
(
sprintf
(
'Do you want to enable the %s server on %s?'
,
$label_DHCP
,
$upperifname
));
return
console_prompt_for_yn
(
sprintf
(
'Do you want to enable the %s server on %s?'
,
$label_DHCP
,
$upperifname
)
,
'y'
);
}
}
function
get_interface_config_description
(
$iface
)
function
get_interface_config_description
(
$iface
)
...
@@ -245,14 +246,14 @@ function console_configure_ip_address($version)
...
@@ -245,14 +246,14 @@ function console_configure_ip_address($version)
$upperifname
=
strtoupper
(
$interface
);
$upperifname
=
strtoupper
(
$interface
);
if
(
$interface
==
"wan"
)
{
if
(
$interface
==
'wan'
)
{
if
(
console_prompt_for_yn
(
sprintf
(
'Configure %s address %s interface via %s?'
,
$label_IPvX
,
$upperifname
,
$label_DHCP
)))
{
if
(
console_prompt_for_yn
(
sprintf
(
'Configure %s address %s interface via %s?'
,
$label_IPvX
,
$upperifname
,
$label_DHCP
)
,
'y'
))
{
$ifppp
=
console_get_interface_from_ppp
(
get_real_interface
(
"wan"
));
$ifppp
=
console_get_interface_from_ppp
(
get_real_interface
(
'wan'
));
if
(
!
empty
(
$ifppp
))
{
if
(
!
empty
(
$ifppp
))
{
$ifaceassigned
=
$ifppp
;
$ifaceassigned
=
$ifppp
;
}
}
$intip
=
(
$version
===
6
)
?
"dhcp6"
:
"dhcp"
;
$intip
=
(
$version
===
6
)
?
'dhcp6'
:
'dhcp'
;
$intbits
=
""
;
$intbits
=
''
;
$isintdhcp
=
true
;
$isintdhcp
=
true
;
$restart_dhcpd
=
true
;
$restart_dhcpd
=
true
;
}
}
...
@@ -424,15 +425,15 @@ console_configure_dhcpd(6);
...
@@ -424,15 +425,15 @@ console_configure_dhcpd(6);
//*****************************************************************************
//*****************************************************************************
if
(
$config
[
'system'
][
'webgui'
][
'protocol'
]
==
"https"
)
{
if
(
$config
[
'system'
][
'webgui'
][
'protocol'
]
==
'https'
)
{
if
(
console_prompt_for_yn
(
'Do you want to revert to HTTP as the web GUI protocol?'
))
{
if
(
console_prompt_for_yn
(
'Do you want to revert to HTTP as the web GUI protocol?'
,
'n'
))
{
$config
[
'system'
][
'webgui'
][
'protocol'
]
=
"http"
;
$config
[
'system'
][
'webgui'
][
'protocol'
]
=
'http'
;
$restart_webgui
=
true
;
$restart_webgui
=
true
;
}
}
}
}
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'noantilockout'
]))
{
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'noantilockout'
]))
{
echo
"
\n
"
.
sprintf
(
'Note: the anti-lockout rule on %s has been re-enabled.'
,
$interface
)
.
"
\n
"
;
echo
sprintf
(
"Note: the anti-lockout rule on %s has been re-enabled.
\n
"
,
$interface
)
;
unset
(
$config
[
'system'
][
'webgui'
][
'noantilockout'
]);
unset
(
$config
[
'system'
][
'webgui'
][
'noantilockout'
]);
}
}
...
@@ -538,7 +539,5 @@ if ($intip != '' || $intip6 != '') {
...
@@ -538,7 +539,5 @@ if ($intip != '' || $intip6 != '') {
}
}
}
}
echo
"
\n
Press <ENTER> to continue."
;
/* rest now or hit CTRL-C */
sleep
(
3
);
fgets
(
$fp
);
fclose
(
$fp
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment