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
94c0f816
Commit
94c0f816
authored
Jan 04, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor interfaces_qinq_edit.php
parent
d7f94e6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
208 additions
and
389 deletions
+208
-389
interfaces_qinq_edit.php
src/www/interfaces_qinq_edit.php
+208
-389
No files found.
src/www/interfaces_qinq_edit.php
View file @
94c0f816
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Ermal Luçi
Copyright (C) 2009 Ermal Luçi
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
error_reporting
(
E_ALL
);
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
require_once
(
"interfaces.inc"
);
require_once
(
"interfaces.inc"
);
if
(
!
is_array
(
$config
[
'qinqs'
][
'qinqentry'
]))
if
(
!
isset
(
$config
[
'qinqs'
])
||
!
is_array
(
$config
[
'qinqs'
]))
{
$config
[
'qinqs'
][
'qinqentry'
]
=
array
();
$config
[
'qinqs'
]
=
array
();
$a_qinqs
=
&
$config
[
'qinqs'
][
'qinqentry'
];
$portlist
=
get_interface_list
();
/* add LAGG interfaces */
if
(
isset
(
$config
[
'laggs'
][
'lagg'
]))
{
foreach
(
$config
[
'laggs'
][
'lagg'
]
as
$lagg
)
{
$portlist
[
$lagg
[
'laggif'
]]
=
$lagg
;
}
}
}
if
(
!
isset
(
$config
[
'qinqs'
][
'qinqentry'
])
||
!
is_array
(
$config
[
'qinqs'
][
'qinqentry'
]))
{
if
(
count
(
$portlist
)
<
1
)
{
$config
[
'qinqs'
][
'qinqentry'
]
=
array
();
header
(
"Location: interfaces_qinq.php"
);
exit
;
}
}
$a_qinqs
=
&
$config
[
'qinqs'
][
'qinqentry'
];
if
(
is_numericint
(
$_GET
[
'id'
]))
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
$id
=
$_GET
[
'id'
];
// read form data
if
(
isset
(
$_POST
[
'id'
])
&&
is_numericint
(
$_POST
[
'id'
]))
if
(
!
empty
(
$a_qinqs
[
$_GET
[
'id'
]]))
{
$id
=
$_POST
[
'id'
];
$id
=
$_GET
[
'id'
];
}
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
])
{
$pconfig
[
'if'
]
=
isset
(
$a_qinqs
[
$id
][
'if'
])
?
$a_qinqs
[
$id
][
'if'
]
:
null
;
$pconfig
[
'if'
]
=
$a_qinqs
[
$id
][
'if'
];
$pconfig
[
'tag'
]
=
isset
(
$a_qinqs
[
$id
][
'tag'
])
?
$a_qinqs
[
$id
][
'tag'
]
:
null
;
$pconfig
[
'tag'
]
=
$a_qinqs
[
$id
][
'tag'
];
$pconfig
[
'members'
]
=
isset
(
$a_qinqs
[
$id
][
'members'
])
?
explode
(
' '
,
$a_qinqs
[
$id
][
'members'
])
:
array
();
$pconfig
[
'members'
]
=
$a_qinqs
[
$id
][
'members'
];
$pconfig
[
'descr'
]
=
isset
(
$a_qinqs
[
$id
][
'descr'
])
?
$a_qinqs
[
$id
][
'descr'
]
:
null
;
$pconfig
[
'descr'
]
=
html_entity_decode
(
$a_qinqs
[
$id
][
'descr'
]);
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
/*
// validate / save form data
$pconfig['autoassign'] = isset($a_qinqs[$id]['autoassign']);
if
(
!
empty
(
$a_qinqs
[
$_POST
[
'id'
]]))
{
$pconfig['autoenable'] = isset($a_qinqs[$id]['autoenable']);
$id
=
$_POST
[
'id'
];
*/
}
$pconfig
[
'autogroup'
]
=
isset
(
$a_qinqs
[
$id
][
'autogroup'
]);
$input_errors
=
array
();
$pconfig
[
'autoadjustmtu'
]
=
isset
(
$a_qinqs
[
$id
][
'autoadjustmtu'
]);
$pconfig
=
$_POST
;
}
if
(
$_POST
)
{
unset
(
$input_errors
);
$pconfig
=
$_POST
;
if
(
empty
(
$_POST
[
'tag'
]))
$input_errors
[]
=
gettext
(
"First level tag cannot be empty."
);
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
][
'tag'
]
!=
$_POST
[
'tag'
])
$input_errors
[]
=
gettext
(
"You are editing an existing entry and modifying the first level tag is not allowed."
);
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
][
'if'
]
!=
$_POST
[
'if'
])
$input_errors
[]
=
gettext
(
"You are editing an existing entry and modifying the interface is not allowed."
);
if
(
!
isset
(
$id
))
{
foreach
(
$a_qinqs
as
$qinqentry
)
if
(
$qinqentry
[
'tag'
]
==
$_POST
[
'tag'
]
&&
$qinqentry
[
'if'
]
==
$_POST
[
'if'
])
$input_errors
[]
=
gettext
(
"QinQ level already exists for this interface, edit it!"
);
if
(
is_array
(
$config
[
'vlans'
][
'vlan'
]))
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
if
(
$vlan
[
'tag'
]
==
$_POST
[
'tag'
]
&&
$vlan
[
'if'
]
==
$_POST
[
'if'
])
$input_errors
[]
=
gettext
(
"A normal VLAN exists with this tag please remove it to use this tag for QinQ first level."
);
}
}
$qinqentry
=
array
();
$qinqentry
[
'if'
]
=
$_POST
[
'if'
];
$qinqentry
[
'tag'
]
=
$_POST
[
'tag'
];
/*
if ($_POST['autoassign'] == "yes") {
$qinqentry['autoassign'] = true;
if ($_POST['autoenable'] == "yes")
$qinqentry['autoenable'] = true;
if ($_POST['autoadjust'] == "yes")
$qinqentry['autoadjustmtu'] = true;
*/
if
(
$_POST
[
'autogroup'
]
==
"yes"
)
$qinqentry
[
'autogroup'
]
=
true
;
$members
=
""
;
$isfirst
=
0
;
/* item is a normal qinqentry type */
for
(
$x
=
0
;
$x
<
9999
;
$x
++
)
{
if
(
$_POST
[
"members
{
$x
}
"
]
<>
""
)
{
$member
=
explode
(
"-"
,
$_POST
[
"members
{
$x
}
"
]);
if
(
count
(
$member
)
>
1
)
{
if
(
preg_match
(
"/([^0-9])+/"
,
$member
[
0
],
$match
)
||
preg_match
(
"/([^0-9])+/"
,
$member
[
1
],
$match
))
$input_errors
[]
=
gettext
(
"Tags can contain only numbers or a range in format #-#."
);
for
(
$i
=
$member
[
0
];
$i
<=
$member
[
1
];
$i
++
)
{
if
(
$isfirst
>
0
)
$members
.=
" "
;
$members
.=
$i
;
$isfirst
++
;
}
}
else
{
if
(
preg_match
(
"/([^0-9 ])+/"
,
$_POST
[
"members
{
$x
}
"
],
$match
))
$input_errors
[]
=
gettext
(
"Tags can contain only numbers or a range in format #-#."
);
if
(
$isfirst
>
0
)
$members
.=
" "
;
$members
.=
$_POST
[
"members
{
$x
}
"
];
$isfirst
++
;
}
}
}
if
(
!
$input_errors
)
{
$qinqentry
[
'members'
]
=
$members
;
$qinqentry
[
'descr'
]
=
$_POST
[
'descr'
];
$qinqentry
[
'vlanif'
]
=
"
{
$_POST
[
'if'
]
}
_
{
$_POST
[
'tag'
]
}
"
;
$nmembers
=
explode
(
" "
,
$members
);
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
])
{
$omembers
=
explode
(
" "
,
$a_qinqs
[
$id
][
'members'
]);
$delmembers
=
array_diff
(
$omembers
,
$nmembers
);
$addmembers
=
array_diff
(
$nmembers
,
$omembers
);
if
((
count
(
$delmembers
)
>
0
)
||
(
count
(
$addmembers
)
>
0
))
{
$fd
=
fopen
(
'/tmp/netgraphcmd'
,
'w'
);
foreach
(
$delmembers
as
$tag
)
{
fwrite
(
$fd
,
"shutdown
{
$qinqentry
[
'vlanif'
]
}
h
{
$tag
}
:
\n
"
);
fwrite
(
$fd
,
"msg
{
$qinqentry
[
'vlanif'
]
}
qinq: delfilter
\\\"
{
$qinqentry
[
'vlanif'
]
}{
$tag
}
\\\"\n
"
);
}
foreach
(
$addmembers
as
$member
)
{
if
(
empty
(
$pconfig
[
'tag'
]))
{
$qinq
=
array
();
$input_errors
[]
=
gettext
(
"First level tag cannot be empty."
);
$qinq
[
'if'
]
=
$qinqentry
[
'vlanif'
];
}
$qinq
[
'tag'
]
=
$member
;
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
][
'tag'
]
!=
$pconfig
[
'tag'
])
{
$macaddr
=
get_interface_mac
(
$qinqentry
[
'vlanif'
]);
$input_errors
[]
=
gettext
(
"You are editing an existing entry and modifying the first level tag is not allowed."
);
interface_qinq2_configure
(
$qinq
,
$fd
,
$macaddr
);
}
}
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
][
'if'
]
!=
$pconfig
[
'if'
])
{
$input_errors
[]
=
gettext
(
"You are editing an existing entry and modifying the interface is not allowed."
);
}
fclose
(
$fd
);
if
(
!
isset
(
$id
))
{
mwexec
(
'/usr/sbin/ngctl -f /tmp/netgraphcmd'
);
foreach
(
$a_qinqs
as
$qinqentry
)
{
}
if
(
$qinqentry
[
'tag'
]
==
$pconfig
[
'tag'
]
&&
$qinqentry
[
'if'
]
==
$pconfig
[
'if'
])
{
$a_qinqs
[
$id
]
=
$qinqentry
;
$input_errors
[]
=
gettext
(
"QinQ level already exists for this interface, edit it!"
);
}
else
{
}
interface_qinq_configure
(
$qinqentry
);
}
$a_qinqs
[]
=
$qinqentry
;
if
(
is_array
(
$config
[
'vlans'
][
'vlan'
]))
{
}
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
if
(
$_POST
[
'autogroup'
]
==
"yes"
)
{
if
(
$vlan
[
'tag'
]
==
$pconfig
[
'tag'
]
&&
$vlan
[
'if'
]
==
$pconfig
[
'if'
])
{
if
(
!
is_array
(
$config
[
'ifgroups'
][
'ifgroupentry'
]))
$input_errors
[]
=
gettext
(
"A normal VLAN exists with this tag please remove it to use this tag for QinQ first level."
);
$config
[
'ifgroups'
][
'ifgroupentry'
]
=
array
();
}
foreach
(
$config
[
'ifgroups'
][
'ifgroupentry'
]
as
$gid
=>
$group
)
{
}
if
(
$group
[
'ifname'
]
==
"QinQ"
)
{
}
$found
=
true
;
}
break
;
}
}
$additions
=
""
;
foreach
(
$nmembers
as
$qtag
)
$additions
.=
"
{
$qinqentry
[
'vlanif'
]
}
_
{
$qtag
}
"
;
$additions
.=
"
{
$qinqentry
[
'vlanif'
]
}
"
;
if
(
$found
==
true
)
$config
[
'ifgroups'
][
'ifgroupentry'
][
$gid
][
'members'
]
.=
"
{
$additions
}
"
;
else
{
$gentry
=
array
();
$gentry
[
'ifname'
]
=
"QinQ"
;
$gentry
[
'members'
]
=
"
{
$additions
}
"
;
$gentry
[
'descr'
]
=
gettext
(
"QinQ VLANs group"
);
$config
[
'ifgroups'
][
'ifgroupentry'
][]
=
$gentry
;
}
}
write_config
();
if
(
count
(
$input_errors
)
==
0
)
{
$qinqentry
=
array
();
$qinqentry
[
'if'
]
=
$pconfig
[
'if'
];
$qinqentry
[
'tag'
]
=
$pconfig
[
'tag'
];
$qinqentry
[
'members'
]
=
implode
(
" "
,
$pconfig
[
'members'
]);
$qinqentry
[
'descr'
]
=
$pconfig
[
'descr'
];
$qinqentry
[
'vlanif'
]
=
"
{
$pconfig
[
'if'
]
}
_
{
$pconfig
[
'tag'
]
}
"
;
if
(
isset
(
$id
))
{
$omembers
=
explode
(
" "
,
$a_qinqs
[
$id
][
'members'
]);
$delmembers
=
array_diff
(
$omembers
,
$pconfig
[
'members'
]);
$addmembers
=
array_diff
(
$pconfig
[
'members'
],
$omembers
);
if
((
count
(
$delmembers
)
>
0
)
||
(
count
(
$addmembers
)
>
0
))
{
// XXX needs improvement
$fd
=
fopen
(
'/tmp/netgraphcmd'
,
'w'
);
foreach
(
$delmembers
as
$tag
)
{
fwrite
(
$fd
,
"shutdown
{
$qinqentry
[
'vlanif'
]
}
h
{
$tag
}
:
\n
"
);
fwrite
(
$fd
,
"msg
{
$qinqentry
[
'vlanif'
]
}
qinq: delfilter
\\\"
{
$qinqentry
[
'vlanif'
]
}{
$tag
}
\\\"\n
"
);
}
foreach
(
$addmembers
as
$member
)
{
$qinq
=
array
();
$qinq
[
'if'
]
=
$qinqentry
[
'vlanif'
];
$qinq
[
'tag'
]
=
$member
;
$macaddr
=
get_interface_mac
(
$qinqentry
[
'vlanif'
]);
interface_qinq2_configure
(
$qinq
,
$fd
,
$macaddr
);
}
fclose
(
$fd
);
mwexec
(
'/usr/sbin/ngctl -f /tmp/netgraphcmd'
);
}
$a_qinqs
[
$id
]
=
$qinqentry
;
}
else
{
interface_qinq_configure
(
$qinqentry
);
$a_qinqs
[]
=
$qinqentry
;
}
header
(
"Location: interfaces_qinq.php"
);
write_config
();
exit
;
header
(
"Location: interfaces_qinq.php"
);
}
else
{
exit
;
$pconfig
[
'descr'
]
=
$_POST
[
'descr'
];
}
$pconfig
[
'tag'
]
=
$_POST
[
'tag'
];
$pconfig
[
'members'
]
=
$members
;
}
}
}
include
(
"head.inc"
);
include
(
"head.inc"
);
?>
?>
<body>
<body>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
// Global Variables
var
rowname
=
new
Array
(
9999
);
var
rowtype
=
new
Array
(
9999
);
var
newrow
=
new
Array
(
9999
);
var
rowsize
=
new
Array
(
9999
);
for
(
i
=
0
;
i
<
9999
;
i
++
)
{
rowname
[
i
]
=
'
members
'
;
rowtype
[
i
]
=
'
select
'
;
newrow
[
i
]
=
''
;
rowsize
[
i
]
=
'
30
'
;
}
var
field_counter_js
=
0
;
var
loaded
=
0
;
var
is_streaming_progress_bar
=
0
;
var
temp_streaming_text
=
""
;
var
addRowTo
=
(
function
()
{
return
(
function
(
tableId
)
{
var
d
,
tbody
,
tr
,
td
,
bgc
,
i
,
ii
,
j
;
d
=
document
;
tbody
=
d
.
getElementById
(
tableId
).
getElementsByTagName
(
"
tbody
"
).
item
(
0
);
tr
=
d
.
createElement
(
"
tr
"
);
for
(
i
=
0
;
i
<
field_counter_js
;
i
++
)
{
td
=
d
.
createElement
(
"
td
"
);
td
.
innerHTML
=
"
<input type='hidden' value='
"
+
totalrows
+
"
' name='
"
+
rowname
[
i
]
+
"
_row-
"
+
totalrows
+
"
' /><input size='
"
+
rowsize
[
i
]
+
"
' class='formfld unknown' name='
"
+
rowname
[
i
]
+
totalrows
+
"
' />
"
;
tr
.
appendChild
(
td
);
}
td
=
d
.
createElement
(
"
td
"
);
td
.
rowSpan
=
"
1
"
;
td
.
innerHTML
=
'
<a onclick="removeRow(this);return false;" href="#"><span class="glyphicon glyphicon-remove" alt="remove"><
\
/span><
\
/a>
'
;
tr
.
appendChild
(
td
);
tbody
.
appendChild
(
tr
);
totalrows
++
;
});
})();
function
removeRow
(
el
)
{
var
cel
;
while
(
el
&&
el
.
nodeName
.
toLowerCase
()
!=
"
tr
"
)
el
=
el
.
parentNode
;
if
(
el
&&
el
.
parentNode
)
{
cel
=
el
.
getElementsByTagName
(
"
td
"
).
item
(
0
);
el
.
parentNode
.
removeChild
(
el
);
}
}
rowname
[
0
]
=
<?=
gettext
(
"members"
);
?>
;
rowtype
[
0
]
=
"
textbox
"
;
rowsize
[
0
]
=
"
30
"
;
rowname
[
2
]
=
<?=
gettext
(
"detail"
);
?>
;
rowtype
[
2
]
=
"
textbox
"
;
rowsize
[
2
]
=
"
50
"
;
//]]>
</script>
<input
type=
'hidden'
name=
'members_type'
value=
'textbox'
class=
"formfld unknown"
/>
<?php
include
(
"fbegin.inc"
);
?>
<?php
include
(
"fbegin.inc"
);
?>
<section
class=
"page-content-main"
>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"row"
>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<section
class=
"col-xs-12"
>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<div
class=
"content-box"
>
<div
id=
"inputerrors"
></div>
<div
class=
"table-responsive"
>
<form
method=
"post"
name=
"iform"
id=
"iform"
>
<table
class=
"table table-striped"
>
<section
class=
"col-xs-12"
>
<thead>
<tr>
<div
class=
"content-box"
>
<td
width=
"22%"
><strong>
<?=
gettext
(
"Interface QinQ Edit"
);
?>
</strong></td>
<td
width=
"78%"
align=
"right"
>
<header
class=
"content-box-head container-fluid"
>
<small>
<?=
gettext
(
"full help"
);
?>
</small>
<h3>
<?=
gettext
(
"Interface QinQ Edit"
);
?>
</h3>
<i
class=
"fa fa-toggle-off text-danger"
style=
"cursor: pointer;"
id=
"show_all_help_page"
type=
"button"
></i></a>
</header>
</td>
<div
class=
"content-box-main"
>
</tr>
</thead>
<form
action=
"interfaces_qinq_edit.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<tbody>
<table
class=
"table table-striped table-sort"
>
<tr>
<tr>
<td><a
id=
"help_for_if"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Parent interface"
);
?>
</td>
<td
width=
"22%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Parent interface"
);
?>
</td>
<td>
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"if"
class=
"selectpicker"
>
<select
name=
"if"
id=
"if"
class=
"selectpicker"
>
<?php
<?php
$portlist
=
get_interface_list
();
foreach
(
$portlist
as
$ifn
=>
$ifinfo
)
{
/* add LAGG interfaces */
if
(
is_jumbo_capable
(
$ifn
))
{
if
(
isset
(
$config
[
'laggs'
][
'lagg'
]))
{
echo
"<option value=
\"
{
$ifn
}
\"
"
;
foreach
(
$config
[
'laggs'
][
'lagg'
]
as
$lagg
)
{
if
(
$ifn
==
$pconfig
[
'if'
])
$portlist
[
$lagg
[
'laggif'
]]
=
$lagg
;
echo
" selected=
\"
selected
\"
"
;
}
echo
">"
;
}
echo
htmlspecialchars
(
$ifn
.
" ("
.
$ifinfo
[
'mac'
]
.
")"
);
foreach
(
$portlist
as
$ifn
=>
$ifinfo
)
:
echo
"</option>"
;
if
(
!
is_jumbo_capable
(
$ifn
))
{
}
continue
;
}
}
?>
?>
<option
value=
"
<?=
$ifn
;
?>
"
<?=
$ifn
==
$pconfig
[
'if'
]
?
" selected=
\"
selected
\"
"
:
""
;
?>
>
</select>
<?=
htmlspecialchars
(
$ifn
);
?>
(
<?=
!
empty
(
$ifinfo
[
'mac'
])
?
$ifinfo
[
'mac'
]
:
""
;
?>
)
<br
/>
</option>
<span
class=
"vexpl"
>
<?=
gettext
(
"Only QinQ capable interfaces will be shown."
);
?>
</span></td>
<?php
</tr>
endforeach
;
?>
<tr>
</select>
<td
width=
"22%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"First level tag"
);
?>
</td>
<div
class=
"hidden"
for=
"help_for_if"
>
<td
width=
"78%"
class=
"vtable"
>
<?=
gettext
(
"Only QinQ capable interfaces will be shown."
);
?>
<input
name=
"tag"
type=
"text"
class=
"formfld unknown"
id=
"tag"
size=
"10"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'tag'
]);
?>
"
/>
</div>
<br
/>
</td>
<span
class=
"vexpl"
>
</tr>
<?=
gettext
(
"This is the first level VLAN tag. On top of this are stacked the member VLANs defined below."
);
?>
<tr>
</span>
<td><a
id=
"help_for_tag"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"First level tag"
);
?>
</td>
</td>
<td>
</tr>
<input
name=
"tag"
type=
"text"
value=
"
<?=
$pconfig
[
'tag'
];
?>
"
/>
<tr>
<div
class=
"hidden"
for=
"help_for_tag"
>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Options"
);
?>
</td>
<?=
gettext
(
"This is the first level VLAN tag. On top of this are stacked the member VLANs defined below."
);
?>
<td
width=
"78%"
class=
"vtable"
>
</div>
<input
name=
"autogroup"
type=
"checkbox"
value=
"yes"
id=
"autogroup"
<?php
if
(
$pconfig
[
'autogroup'
])
echo
"checked=
\"
checked
\"
"
;
?>
/>
</td>
<span
class=
"vexpl"
>
<?=
gettext
(
"Adds interface to QinQ interface groups so you can write filter rules easily."
);
?>
</span>
</tr>
</td>
<tr>
</tr>
<td><a
id=
"help_for_descr"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Description"
);
?>
</td>
<tr>
<td>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Description"
);
?>
</td>
<input
name=
"descr"
type=
"text"
value=
"
<?=
$pconfig
[
'descr'
];
?>
"
/>
<td
width=
"78%"
class=
"vtable"
>
<div
class=
"hidden"
for=
"help_for_descr"
>
<input
name=
"descr"
type=
"text"
class=
"formfld unknown"
id=
"descr"
size=
"40"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'descr'
]);
?>
"
/>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
<br
/>
</div>
<span
class=
"vexpl"
>
</td>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
</tr>
</span>
<tr>
</td>
<td><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Member (s)"
);
?>
</div></td>
</tr>
<td>
<tr>
<select
name=
"members[]"
multiple=
"multiple"
data-size=
"10"
class=
"selectpicker"
data-live-search=
"true"
>
<td
width=
"22%"
valign=
"top"
class=
"vncellreq"
><div
id=
"membersnetworkport"
>
<?=
gettext
(
"Member (s)"
);
?>
</div></td>
<?php
<td
width=
"78%"
class=
"vtable"
>
for
(
$vlanid
=
1
;
$vlanid
<=
4094
;
$vlanid
++
)
:?>
<span
class=
"vexpl"
>
<
option
value
=
"<?=
$vlanid
;?>"
<?=
in_array
(
$vlanid
,
$pconfig
[
'members'
])
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"You can specify ranges in the input below. The format is pretty simple i.e 9-100 or 10 20..."
);
?>
<?=
$vlanid
;
?>
</span>
</option>
<br
/>
<?php
<table
id=
"maintable"
summary=
"main table"
>
endfor
;
?>
<tbody>
</select>
<tr>
</td>
<td><div
id=
"onecolumn"
>
<?=
gettext
(
"Tag"
);
?>
</div></td>
</tr>
</tr>
<tr>
<td>
</td>
<?php
<td>
$counter
=
0
;
<input
name=
"submit"
type=
"submit"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
$members
=
$pconfig
[
'members'
];
<input
type=
"button"
class=
"btn btn-default"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
onclick=
"window.location.href='
<?=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/interfaces_qinq.php'
);
?>
'"
/>
if
(
$members
<>
""
)
{
<?php
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
])
:
?>
$item
=
explode
(
" "
,
$members
);
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$id
;
?>
"
/>
foreach
(
$item
as
$ww
)
{
<?php
endif
;
?>
$member
=
$item
[
$counter
];
</td>
?>
</tr>
<tr>
</tbody>
<td
class=
"vtable"
>
</table>
<input
type=
"text"
name=
"members
<?php
echo
$counter
;
?>
"
class=
"formselect"
id=
"members
<?php
echo
$counter
;
?>
"
value=
"
<?php
echo
$member
;
?>
"
/>
</form>
</td>
</div>
<td>
</div>
<a
onclick=
"removeRow(this); return false;"
href=
"#"
><span
class=
"glyphicon glyphicon-remove"
alt=
"remove"
></span></a>
</section>
</td>
</div>
</tr>
</div>
<?php
</section>
$counter
++
;
}
// end foreach
}
// end if
?>
</tbody>
</table>
<a
onclick=
"javascript:addRowTo('maintable'); return false;"
href=
"#"
title=
"
<?=
gettext
(
"add another entry"
);
?>
"
class=
"btn btn-default btn-xs"
/><span
class=
"glyphicon glyphicon-plus"
></span>
</a>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
>
</td>
<td
width=
"78%"
>
<input
id=
"submit"
name=
"submit"
type=
"submit"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<a
href=
"interfaces_qinq.php"
><input
id=
"cancelbutton"
name=
"cancelbutton"
type=
"button"
class=
"btn btn-default"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
/></a>
<?php
if
(
isset
(
$id
)
&&
$a_qinqs
[
$id
])
:
?>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
htmlspecialchars
(
$id
);
?>
"
/>
<?php
endif
;
?>
</td>
</tr>
</table>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
field_counter_js
=
1
;
rows
=
1
;
totalrows
=
<?php
echo
$counter
;
?>
;
loaded
=
<?php
echo
$counter
;
?>
;
//]]>
</script>
<?php
include
(
"foot.inc"
);
?>
<?php
include
(
"foot.inc"
);
?>
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