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
6d3eded2
Commit
6d3eded2
authored
Jul 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: flush unused $auto_assign code
parent
81161cda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
153 deletions
+74
-153
config.console.inc
src/etc/inc/config.console.inc
+74
-153
No files found.
src/etc/inc/config.console.inc
View file @
6d3eded2
...
...
@@ -39,19 +39,13 @@ function set_networking_interfaces_ports()
$iflist
=
get_interface_list
();
/* Function flow is based on $key
and $auto_assign or the lack thereof
*/
/* Function flow is based on $key */
$key
=
null
;
/* Only present auto interface option if running from LiveCD and interface mismatch*/
if
(
is_install_media
()
&&
is_interface_mismatch
())
{
$auto_assign
=
false
;
}
echo
<<<EOD
Valid interfaces are:
EOD;
if
(
!
is_array
(
$iflist
))
{
...
...
@@ -64,15 +58,6 @@ EOD;
}
}
if
(
$auto_assign
)
{
echo
<<<EOD
!!! LiveCD Detected: Auto Interface Option !!!!
BEGIN MANUAL CONFIGURATION OR WE WILL PROCEED WITH AUTO CONFIGURATION.
EOD;
}
echo
<<<EOD
Do you want to set up VLANs first?
...
...
@@ -83,167 +68,103 @@ say no here and use the webConfigurator to configure VLANs later, if required.
Do you want to set up VLANs now ${yes_no_prompt}
EOD;
if
(
$auto_assign
)
{
$key
=
timeout
();
}
else
$key
=
chop
(
fgets
(
$fp
));
if
(
!
isset
(
$key
)
and
$auto_assign
)
{
// Auto Assign Interfaces
do
{
echo
<<<EOD
!!! Auto Assigning Interfaces !!!
For installation purposes, you must plug in at least one NIC
for the LAN connection. If you plug in a second NIC it will be
assigned to WAN. Otherwise, we'll temporarily assign WAN to the
next available NIC found regardless of activity. You should
assign and configure the WAN interface according to your requirements
If you haven't plugged in any network cables yet,
now is the time to do so.
We'll keep trying until you do.
$key
=
chop
(
fgets
(
$fp
));
Searching for active interfaces...
if
(
in_array
(
$key
,
array
(
'y'
,
'Y'
)))
vlan_setup
();
EOD;
unset
(
$wanif
,
$lanif
);
$media_iflist
=
$plugged_in
=
array
();
$media_iflist
=
get_interface_list
(
"media"
);
foreach
(
$media_iflist
as
$iface
=>
$ifa
)
{
if
(
$ifa
[
'up'
])
$plugged_in
[]
=
$iface
;
}
if
(
is_array
(
$config
[
'vlans'
][
'vlan'
])
&&
count
(
$config
[
'vlans'
][
'vlan'
]))
{
$lanif
=
array_shift
(
$plugged_in
)
;
$wanif
=
array_shift
(
$plugged_in
);
echo
"
\n\n
"
.
gettext
(
"VLAN interfaces:"
)
.
"
\n\n
"
;
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
if
(
isset
(
$lanif
)
&&
!
isset
(
$wanif
))
{
foreach
(
$iflist
as
$iface
=>
$ifa
)
{
if
(
$iface
!=
$lanif
)
{
$wanif
=
$iface
;
break
;
}
}
}
echo
sprintf
(
"% -16s%s
\n
"
,
"
{
$vlan
[
'if'
]
}
_vlan
{
$vlan
[
'tag'
]
}
"
,
"VLAN tag
{
$vlan
[
'tag'
]
}
, parent interface
{
$vlan
[
'if'
]
}
"
);
echo
<<<EOD
$iflist
[
$vlan
[
'if'
]
.
'_vlan'
.
$vlan
[
'tag'
]]
=
array
();
}
}
Assigned WAN to : ${wanif}
Assigned LAN to : ${lanif}
echo
<<<EOD
If you don't like this assignment,
press any key to go back to manual configuration.
If you do not know the names of your interfaces, you may choose to use
auto-detection. In that case, disconnect all interfaces now before
hitting 'a' to initiate auto detection.
EOD;
$key
=
timeout
(
20
);
if
(
isset
(
$key
))
return
;
}
while
(
!
isset
(
$wanif
));
$config
[
'system'
][
'ssh'
][
'enabled'
]
=
'enabled'
;
$key
=
'y'
;
}
else
{
//Manually assign interfaces
if
(
in_array
(
$key
,
array
(
'y'
,
'Y'
)))
vlan_setup
();
if
(
is_array
(
$config
[
'vlans'
][
'vlan'
])
&&
count
(
$config
[
'vlans'
][
'vlan'
]))
{
do
{
echo
"
\n
"
.
gettext
(
"Enter the WAN interface name or 'a' for auto-detection:"
)
.
" "
;
$wanif
=
chop
(
fgets
(
$fp
));
if
(
$wanif
===
""
)
{
return
;
}
if
(
$wanif
===
"a"
)
$wanif
=
autodetect_interface
(
"WAN"
,
$fp
);
else
if
(
!
array_key_exists
(
$wanif
,
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$wanif
,
"
\n
"
);
unset
(
$wanif
);
continue
;
}
}
while
(
!
$wanif
);
echo
"
\n\n
"
.
gettext
(
"VLAN interfaces:"
)
.
"
\n\n
"
;
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
do
{
printf
(
gettext
(
"%sEnter the LAN interface name or 'a' for auto-detection %s"
.
"NOTE: this enables full Firewalling/NAT mode.%s"
.
"(or nothing if finished):%s"
),
"
\n
"
,
"
\n
"
,
"
\n
"
,
" "
);
echo
sprintf
(
"% -16s%s
\n
"
,
"
{
$vlan
[
'if'
]
}
_vlan
{
$vlan
[
'tag'
]
}
"
,
"VLAN tag
{
$vlan
[
'tag'
]
}
, parent interface
{
$vlan
[
'if'
]
}
"
);
$lanif
=
chop
(
fgets
(
$fp
));
$iflist
[
$vlan
[
'if'
]
.
'_vlan'
.
$vlan
[
'tag'
]]
=
array
();
}
if
(
$lanif
==
"exit"
)
{
exit
;
}
echo
<<<EOD
If you do not know the names of your interfaces, you may choose to use
auto-detection. In that case, disconnect all interfaces now before
hitting 'a' to initiate auto detection.
if
(
$lanif
==
""
)
{
break
;
}
EOD;
if
(
$lanif
===
"a"
)
$lanif
=
autodetect_interface
(
"LAN"
,
$fp
);
else
if
(
!
array_key_exists
(
$lanif
,
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$lanif
,
"
\n
"
);
unset
(
$lanif
);
continue
;
}
}
while
(
!
$lanif
);
do
{
echo
"
\n
"
.
gettext
(
"Enter the WAN interface name or 'a' for auto-detection:"
)
.
" "
;
$wanif
=
chop
(
fgets
(
$fp
));
if
(
$wanif
===
""
)
{
return
;
}
if
(
$wanif
===
"a"
)
$wanif
=
autodetect_interface
(
"WAN"
,
$fp
);
else
if
(
!
array_key_exists
(
$wanif
,
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$wanif
,
"
\n
"
);
unset
(
$wanif
);
continue
;
}
}
while
(
!
$wanif
);
/* optional interfaces */
$i
=
0
;
$optif
=
array
();
do
{
printf
(
gettext
(
"%sEnter the LAN interface name or 'a' for auto-detection %s"
.
"NOTE: this enables full Firewalling/NAT mode.%s"
.
"(or nothing if finished):%s"
),
"
\n
"
,
"
\n
"
,
"
\n
"
,
" "
);
if
(
$lanif
<>
""
)
{
while
(
1
)
{
if
(
$optif
[
$i
])
$i
++
;
$io
=
$i
+
1
;
$lanif
=
chop
(
fgets
(
$fp
));
if
(
$config
[
'interfaces'
][
'opt'
.
$io
][
'descr'
])
printf
(
gettext
(
"%sOptional interface %s description found: %s"
),
"
\n
"
,
$io
,
$config
[
'interfaces'
][
'opt'
.
$io
][
'descr'
]);
if
(
$lanif
==
"exit"
)
{
exit
;
}
printf
(
gettext
(
"%sEnter the Optional %s interface name or 'a' for auto-detection%s"
.
"(or nothing if finished):%s"
),
"
\n
"
,
$io
,
"
\n
"
,
" "
);
if
(
$lanif
==
""
)
{
break
;
}
$optif
[
$i
]
=
chop
(
fgets
(
$fp
));
if
(
$lanif
===
"a"
)
$lanif
=
autodetect_interface
(
"LAN"
,
$fp
);
else
if
(
!
array_key_exists
(
$lanif
,
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$lanif
,
"
\n
"
);
unset
(
$lanif
);
continue
;
}
}
while
(
!
$lanif
);
/* optional interfaces */
$i
=
0
;
$optif
=
array
();
if
(
$lanif
<>
""
)
{
while
(
1
)
{
if
(
$optif
[
$i
])
$i
++
;
$io
=
$i
+
1
;
if
(
$config
[
'interfaces'
][
'opt'
.
$io
][
'descr'
])
printf
(
gettext
(
"%sOptional interface %s description found: %s"
),
"
\n
"
,
$io
,
$config
[
'interfaces'
][
'opt'
.
$io
][
'descr'
]);
printf
(
gettext
(
"%sEnter the Optional %s interface name or 'a' for auto-detection%s"
.
"(or nothing if finished):%s"
),
"
\n
"
,
$io
,
"
\n
"
,
" "
);
$optif
[
$i
]
=
chop
(
fgets
(
$fp
));
if
(
$optif
[
$i
])
{
if
(
$optif
[
$i
]
===
"a"
)
{
$ad
=
autodetect_interface
(
gettext
(
"Optional"
)
.
" "
.
$io
,
$fp
);
if
(
$ad
)
$optif
[
$i
]
=
$ad
;
else
unset
(
$optif
[
$i
]);
}
else
if
(
!
array_key_exists
(
$optif
[
$i
],
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$optif
[
$i
],
"
\n
"
);
if
(
$optif
[
$i
])
{
if
(
$optif
[
$i
]
===
"a"
)
{
$ad
=
autodetect_interface
(
gettext
(
"Optional"
)
.
" "
.
$io
,
$fp
);
if
(
$ad
)
$optif
[
$i
]
=
$ad
;
else
unset
(
$optif
[
$i
]);
continue
;
}
}
else
{
}
else
if
(
!
array_key_exists
(
$optif
[
$i
],
$iflist
))
{
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$optif
[
$i
],
"
\n
"
);
unset
(
$optif
[
$i
]);
break
;
continue
;
}
}
else
{
unset
(
$optif
[
$i
]);
break
;
}
}
...
...
@@ -286,7 +207,7 @@ EOD;
$config
[
'interfaces'
][
'lan'
]
=
array
();
$config
[
'interfaces'
][
'lan'
][
'if'
]
=
$lanif
;
$config
[
'interfaces'
][
'lan'
][
'enable'
]
=
true
;
}
elseif
(
!
file_exists
(
"/var/run/booting"
)
&&
!
$auto_assign
)
{
}
elseif
(
!
file_exists
(
"/var/run/booting"
))
{
echo
<<<EODD
...
...
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