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
39689a70
Commit
39689a70
authored
Jul 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: make WAN optional as well; #5
parent
c8bc87f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
29 deletions
+50
-29
config.console.inc
src/etc/inc/config.console.inc
+50
-29
No files found.
src/etc/inc/config.console.inc
View file @
39689a70
...
@@ -113,6 +113,10 @@ EOD;
...
@@ -113,6 +113,10 @@ EOD;
echo
$wanif
.
PHP_EOL
;
echo
$wanif
.
PHP_EOL
;
}
}
if
(
$wanif
==
''
)
{
break
;
}
if
(
$wanif
==
'a'
)
{
if
(
$wanif
==
'a'
)
{
$wanif
=
autodetect_interface
(
'WAN'
,
$fp
);
$wanif
=
autodetect_interface
(
'WAN'
,
$fp
);
}
}
...
@@ -147,6 +151,15 @@ EOD;
...
@@ -147,6 +151,15 @@ EOD;
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$lanif
,
"
\n
"
);
printf
(
gettext
(
"%sInvalid interface name '%s'%s"
),
"
\n
"
,
$lanif
,
"
\n
"
);
unset
(
$lanif
);
unset
(
$lanif
);
}
}
if
(
$wanif
&&
$lanif
==
$wanif
)
{
unset
(
$lanif
);
echo
<<<EOD
Error: you cannot assign the same interface name twice!
EOD;
}
}
while
(
!
$lanif
);
}
while
(
!
$lanif
);
while
(
$lanif
!=
''
)
{
while
(
$lanif
!=
''
)
{
...
@@ -193,13 +206,12 @@ EOD;
...
@@ -193,13 +206,12 @@ EOD;
for
(
$i
=
0
;
$i
<
(
count
(
$ifarr
)
-
1
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
(
count
(
$ifarr
)
-
1
);
$i
++
)
{
for
(
$j
=
(
$i
+
1
);
$j
<
count
(
$ifarr
);
$j
++
)
{
for
(
$j
=
(
$i
+
1
);
$j
<
count
(
$ifarr
);
$j
++
)
{
if
(
$ifarr
[
$i
]
==
$ifarr
[
$j
])
{
if
(
$ifarr
[
$i
]
==
$ifarr
[
$j
])
{
$again
=
true
;
echo
<<<EOD
echo
<<<EOD
Error: you cannot assign the same interface name twice!
Error: you cannot assign the same interface name twice!
EOD;
EOD;
$again
=
true
;
}
}
}
}
}
}
...
@@ -210,9 +222,12 @@ EOD;
...
@@ -210,9 +222,12 @@ EOD;
echo
"
\n
"
.
gettext
(
"The interfaces will be assigned as follows:"
)
.
"
\n\n
"
;
echo
"
\n
"
.
gettext
(
"The interfaces will be assigned as follows:"
)
.
"
\n\n
"
;
if
(
$wanif
!=
''
)
{
echo
"WAN -> "
.
$wanif
.
"
\n
"
;
echo
"WAN -> "
.
$wanif
.
"
\n
"
;
if
(
$lanif
!=
""
)
}
if
(
$lanif
!=
''
)
{
echo
"LAN -> "
.
$lanif
.
"
\n
"
;
echo
"LAN -> "
.
$lanif
.
"
\n
"
;
}
for
(
$i
=
0
;
$i
<
count
(
$optif
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$optif
);
$i
++
)
{
echo
"OPT"
.
(
$i
+
1
)
.
" -> "
.
$optif
[
$i
]
.
"
\n
"
;
echo
"OPT"
.
(
$i
+
1
)
.
" -> "
.
$optif
[
$i
]
.
"
\n
"
;
}
}
...
@@ -239,6 +254,16 @@ EOD;
...
@@ -239,6 +254,16 @@ EOD;
}
}
$config
[
'interfaces'
][
'lan'
][
'if'
]
=
$lanif
;
$config
[
'interfaces'
][
'lan'
][
'if'
]
=
$lanif
;
$config
[
'interfaces'
][
'lan'
][
'enable'
]
=
true
;
$config
[
'interfaces'
][
'lan'
][
'enable'
]
=
true
;
if
(
match_wireless_interface
(
$lanif
))
{
if
(
is_array
(
$config
[
'interfaces'
][
'lan'
])
&&
(
!
is_array
(
$config
[
'interfaces'
][
'lan'
][
'wireless'
])))
{
$config
[
'interfaces'
][
'lan'
][
'wireless'
]
=
array
();
}
}
else
{
if
(
isset
(
$config
[
'interfaces'
][
'lan'
]))
{
unset
(
$config
[
'interfaces'
][
'lan'
][
'wireless'
]);
}
}
}
else
{
}
else
{
if
(
isset
(
$config
[
'interfaces'
][
'lan'
][
'if'
]))
if
(
isset
(
$config
[
'interfaces'
][
'lan'
][
'if'
]))
mwexec
(
"/sbin/ifconfig "
.
$config
[
'interfaces'
][
'lan'
][
'if'
]
.
" delete"
);
mwexec
(
"/sbin/ifconfig "
.
$config
[
'interfaces'
][
'lan'
][
'if'
]
.
" delete"
);
...
@@ -254,23 +279,14 @@ EOD;
...
@@ -254,23 +279,14 @@ EOD;
unset
(
$config
[
'nat'
]);
unset
(
$config
[
'nat'
]);
}
}
if
(
match_wireless_interface
(
$lanif
))
{
if
(
$wanif
)
{
if
(
is_array
(
$config
[
'interfaces'
][
'lan'
])
&&
(
!
is_array
(
$config
[
'interfaces'
][
'lan'
][
'wireless'
])))
{
$config
[
'interfaces'
][
'lan'
][
'wireless'
]
=
array
();
}
}
else
{
if
(
isset
(
$config
[
'interfaces'
][
'lan'
]))
{
unset
(
$config
[
'interfaces'
][
'lan'
][
'wireless'
]);
}
}
if
(
!
is_array
(
$config
[
'interfaces'
][
'wan'
]))
{
if
(
!
is_array
(
$config
[
'interfaces'
][
'wan'
]))
{
$config
[
'interfaces'
][
'wan'
]
=
array
();
$config
[
'interfaces'
][
'wan'
]
=
array
();
}
}
$config
[
'interfaces'
][
'wan'
][
'if'
]
=
$wanif
;
$config
[
'interfaces'
][
'wan'
][
'if'
]
=
$wanif
;
$config
[
'interfaces'
][
'wan'
][
'enable'
]
=
true
;
$config
[
'interfaces'
][
'wan'
][
'enable'
]
=
true
;
$config
[
'interfaces'
][
'wan'
][
'ipaddr'
]
=
'dhcp'
;
$config
[
'interfaces'
][
'wan'
][
'ipaddrv6'
]
=
'dhcpv6'
;
if
(
match_wireless_interface
(
$wanif
))
{
if
(
match_wireless_interface
(
$wanif
))
{
if
(
is_array
(
$config
[
'interfaces'
][
'wan'
])
&&
if
(
is_array
(
$config
[
'interfaces'
][
'wan'
])
&&
...
@@ -282,6 +298,10 @@ EOD;
...
@@ -282,6 +298,10 @@ EOD;
unset
(
$config
[
'interfaces'
][
'wan'
][
'wireless'
]);
unset
(
$config
[
'interfaces'
][
'wan'
][
'wireless'
]);
}
}
}
}
}
else
{
if
(
isset
(
$config
[
'interfaces'
][
'wan'
]))
unset
(
$config
[
'interfaces'
][
'wan'
]);
}
for
(
$i
=
0
;
$i
<
count
(
$optif
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$optif
);
$i
++
)
{
if
(
!
is_array
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]))
if
(
!
is_array
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]))
...
@@ -303,8 +323,9 @@ EOD;
...
@@ -303,8 +323,9 @@ EOD;
}
}
/* remove all other (old) optional interfaces */
/* remove all other (old) optional interfaces */
for
(;
isset
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]);
$i
++
)
for
(;
isset
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]);
$i
++
)
{
unset
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]);
unset
(
$config
[
'interfaces'
][
'opt'
.
(
$i
+
1
)]);
}
printf
(
gettext
(
"%sWriting configuration..."
),
"
\n
"
);
printf
(
gettext
(
"%sWriting configuration..."
),
"
\n
"
);
write_config
(
"Console assignment of interfaces"
);
write_config
(
"Console assignment of interfaces"
);
...
...
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