Revision 922bf65c
Added by sbeaver about 10 years ago
usr/local/www/interfaces_lagg_edit.php | ||
---|---|---|
29 | 29 |
POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
*/ |
31 | 31 |
/* |
32 |
pfSense_MODULE: interfaces
|
|
32 |
pfSense_MODULE: interfaces
|
|
33 | 33 |
*/ |
34 | 34 |
|
35 | 35 |
##|+PRIV |
... | ... | |
49 | 49 |
$a_laggs = &$config['laggs']['lagg']; |
50 | 50 |
|
51 | 51 |
$portlist = get_interface_list(); |
52 |
$laggprotos = array("none", "lacp", "failover", "fec", "loadbalance", "roundrobin"); |
|
53 |
$laggprotosuc = array("NONE", "LACP", "FAILOVER", "FEC", "LOADBALANCE", "ROUNDROBIN"); |
|
54 |
|
|
55 |
$protohelp = |
|
56 |
'<ul>' . |
|
57 |
'<li>' . |
|
58 |
'<strong>' . gettext($laggprotos[0]) . '</strong><br />' . |
|
59 |
gettext('This protocol is intended to do nothing: it disables any ' . |
|
60 |
'traffic without disabling the lagg interface itself') . |
|
61 |
'</li>' . |
|
62 |
'<li>' . |
|
63 |
'<strong>' . gettext($laggprotos[1]) . '</strong><br />' . |
|
64 |
gettext('Supports the IEEE 802.3ad Link Aggregation Control Protocol ' . |
|
65 |
'(LACP) and the Marker Protocol. LACP will negotiate a set ' . |
|
66 |
'of aggregable links with the peer in to one or more Link ' . |
|
67 |
'Aggregated Groups. Each LAG is composed of ports of the ' . |
|
68 |
'same speed, set to full-duplex operation. The traffic will ' . |
|
69 |
'be balanced across the ports in the LAG with the greatest ' . |
|
70 |
'total speed, in most cases there will only be one LAG which ' . |
|
71 |
'contains all ports. In the event of changes in physical ' . |
|
72 |
'connectivity, Link Aggregation will quickly converge to a ' . |
|
73 |
'new configuration.') . |
|
74 |
'</li>' . |
|
75 |
'<li>' . |
|
76 |
'<strong>' . gettext($laggprotos[2]) . '</strong><br />' . |
|
77 |
gettext('Sends and receives traffic only through the master port. If ' . |
|
78 |
'the master port becomes unavailable, the next active port is ' . |
|
79 |
'used. The first interface added is the master port; any ' . |
|
80 |
'interfaces added after that are used as failover devices.') . |
|
81 |
'</li>' . |
|
82 |
'<li>' . |
|
83 |
'<strong>' . gettext($laggprotos[3]) . '</strong><br />' . |
|
84 |
gettext('Supports Cisco EtherChannel. This is a static setup and ' . |
|
85 |
'does not negotiate aggregation with the peer or exchange ' . |
|
86 |
'frames to monitor the link.') . |
|
87 |
'</li>' . |
|
88 |
'<li>' . |
|
89 |
'<strong>' . gettext($laggprotos[4]) . '</strong><br />' . |
|
90 |
gettext('Balances outgoing traffic across the active ports based on ' . |
|
91 |
'hashed protocol header information and accepts incoming ' . |
|
92 |
'traffic from any active port. This is a static setup and ' . |
|
93 |
'does not negotiate aggregation with the peer or exchange ' . |
|
94 |
'frames to monitor the link. The hash includes the Ethernet ' . |
|
95 |
'source and destination address, and, if available, the VLAN ' . |
|
96 |
'tag, and the IP source and destination address') . |
|
97 |
'</li>' . |
|
98 |
'<li>' . |
|
99 |
'<strong>' . gettext($laggprotos[5]) . '</strong><br />' . |
|
100 |
gettext('Distributes outgoing traffic using a round-robin scheduler ' . |
|
101 |
'through all active ports and accepts incoming traffic from ' . |
|
102 |
'any active port') . |
|
103 |
'</li>' . |
|
104 |
'</ul>'; |
|
52 | 105 |
|
53 | 106 |
$realifchecklist = array(); |
54 | 107 |
/* add LAGG interfaces */ |
... | ... | |
65 | 118 |
foreach ($checklist as $tmpif) |
66 | 119 |
$realifchecklist[get_real_interface($tmpif)] = $tmpif; |
67 | 120 |
|
68 |
$laggprotos = array("none", "lacp", "failover", "fec", "loadbalance", "roundrobin"); |
|
69 |
|
|
70 | 121 |
if (is_numericint($_GET['id'])) |
71 | 122 |
$id = $_GET['id']; |
72 | 123 |
if (isset($_POST['id']) && is_numericint($_POST['id'])) |
... | ... | |
78 | 129 |
$laggiflist = explode(",", $a_laggs[$id]['members']); |
79 | 130 |
foreach ($laggiflist as $tmpif) |
80 | 131 |
unset($realifchecklist[get_real_interface($tmpif)]); |
132 |
|
|
81 | 133 |
$pconfig['proto'] = $a_laggs[$id]['proto']; |
82 | 134 |
$pconfig['descr'] = $a_laggs[$id]['descr']; |
83 | 135 |
} |
... | ... | |
125 | 177 |
write_config(); |
126 | 178 |
|
127 | 179 |
$confif = convert_real_interface_to_friendly_interface_name($lagg['laggif']); |
128 |
if ($confif <> "")
|
|
180 |
if ($confif != "")
|
|
129 | 181 |
interface_configure($confif); |
130 | 182 |
|
131 | 183 |
header("Location: interfaces_lagg.php"); |
... | ... | |
134 | 186 |
} |
135 | 187 |
} |
136 | 188 |
|
189 |
function build_member_list() { |
|
190 |
global $pconfig, $portlist, $realifchecklist; |
|
191 |
|
|
192 |
$memberlist = array('list' => array(), |
|
193 |
'selected' => array()); |
|
194 |
|
|
195 |
$members_array = explode(',', $pconfig['members']); |
|
196 |
foreach ($portlist as $ifn => $ifinfo) { |
|
197 |
if (array_key_exists($ifn, $realifchecklist)) |
|
198 |
continue; |
|
199 |
|
|
200 |
$memberlist['list'][$ifn] = $ifn . '(' . $ifinfo['mac'] . ')'; |
|
201 |
|
|
202 |
if (stristr($pconfig['members'], $ifn)) |
|
203 |
array_push($memberlist['selected'], $ifn); |
|
204 |
} |
|
205 |
|
|
206 |
return($memberlist); |
|
207 |
} |
|
208 |
|
|
137 | 209 |
$pgtitle = array(gettext("Interfaces"),gettext("LAGG"),gettext("Edit")); |
138 | 210 |
$shortcut_section = "interfaces"; |
139 | 211 |
include("head.inc"); |
212 |
require('classes/Form.class.php'); |
|
140 | 213 |
|
141 |
?> |
|
142 |
|
|
143 |
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> |
|
144 |
<?php include("fbegin.inc"); ?> |
|
145 |
<?php if ($input_errors) print_input_errors($input_errors); ?> |
|
146 |
<form action="interfaces_lagg_edit.php" method="post" name="iform" id="iform"> |
|
147 |
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces lagg edit"> |
|
148 |
<tr> |
|
149 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("LAGG configuration"); ?></td> |
|
150 |
</tr> |
|
151 |
<tr> |
|
152 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Parent interface"); ?></td> |
|
153 |
<td width="78%" class="vtable"> |
|
154 |
<select name="members[]" multiple="multiple" size="4" class="formselect"> |
|
155 |
<?php |
|
156 |
foreach ($portlist as $ifn => $ifinfo) { |
|
157 |
if (array_key_exists($ifn, $realifchecklist)) |
|
158 |
continue; |
|
159 |
echo "<option value=\"{$ifn}\""; |
|
160 |
if (stristr($pconfig['members'], $ifn)) |
|
161 |
echo " selected=\"selected\""; |
|
162 |
echo ">". $ifn ."(".$ifinfo['mac'] .")</option>"; |
|
163 |
} |
|
164 |
?> |
|
165 |
</select> |
|
166 |
<br /> |
|
167 |
<span class="vexpl"><?=gettext("Choose the members that will be used for the link aggregation"); ?>.</span></td> |
|
168 |
</tr> |
|
169 |
<tr> |
|
170 |
<td valign="top" class="vncellreq"><?=gettext("Lag proto"); ?></td> |
|
171 |
<td class="vtable"> |
|
172 |
<select name="proto" class="formselect" id="proto"> |
|
173 |
<?php |
|
174 |
foreach ($laggprotos as $proto) { |
|
175 |
echo "<option value=\"{$proto}\""; |
|
176 |
if ($proto == $pconfig['proto']) |
|
177 |
echo " selected=\"selected\""; |
|
178 |
echo ">".strtoupper($proto)."</option>"; |
|
179 |
} |
|
180 |
?> |
|
181 |
</select> |
|
182 |
<br /> |
|
183 |
<ul class="vexpl"> |
|
184 |
<li> |
|
185 |
<b><?=gettext("failover"); ?></b><br /> |
|
186 |
<?=gettext("Sends and receives traffic only through the master port. If " . |
|
187 |
"the master port becomes unavailable, the next active port is " . |
|
188 |
"used. The first interface added is the master port; any " . |
|
189 |
"interfaces added after that are used as failover devices."); ?> |
|
190 |
</li><li> |
|
191 |
<b><?=gettext("fec"); ?></b><br /> <?=gettext("Supports Cisco EtherChannel. This is a static setup and " . |
|
192 |
"does not negotiate aggregation with the peer or exchange " . |
|
193 |
"frames to monitor the link."); ?> |
|
194 |
</li><li> |
|
195 |
<b><?=gettext("lacp"); ?></b><br /> <?=gettext("Supports the IEEE 802.3ad Link Aggregation Control Protocol " . |
|
196 |
"(LACP) and the Marker Protocol. LACP will negotiate a set " . |
|
197 |
"of aggregable links with the peer in to one or more Link " . |
|
198 |
"Aggregated Groups. Each LAG is composed of ports of the " . |
|
199 |
"same speed, set to full-duplex operation. The traffic will " . |
|
200 |
"be balanced across the ports in the LAG with the greatest " . |
|
201 |
"total speed, in most cases there will only be one LAG which " . |
|
202 |
"contains all ports. In the event of changes in physical " . |
|
203 |
"connectivity, Link Aggregation will quickly converge to a " . |
|
204 |
"new configuration."); ?> |
|
205 |
</li><li> |
|
206 |
<b><?=gettext("loadbalance"); ?></b><br /> <?=gettext("Balances outgoing traffic across the active ports based on " . |
|
207 |
"hashed protocol header information and accepts incoming " . |
|
208 |
"traffic from any active port. This is a static setup and " . |
|
209 |
"does not negotiate aggregation with the peer or exchange " . |
|
210 |
"frames to monitor the link. The hash includes the Ethernet " . |
|
211 |
"source and destination address, and, if available, the VLAN " . |
|
212 |
"tag, and the IP source and destination address") ?>. |
|
213 |
</li><li> |
|
214 |
<b><?=gettext("roundrobin"); ?></b><br /> <?=gettext("Distributes outgoing traffic using a round-robin scheduler " . |
|
215 |
"through all active ports and accepts incoming traffic from " . |
|
216 |
"any active port"); ?>. |
|
217 |
</li><li> |
|
218 |
<b><?=gettext("none"); ?></b><br /> <?=gettext("This protocol is intended to do nothing: it disables any " . |
|
219 |
"traffic without disabling the lagg interface itself"); ?>. |
|
220 |
</li> |
|
221 |
</ul> |
|
222 |
</td> |
|
223 |
</tr> |
|
224 |
<tr> |
|
225 |
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> |
|
226 |
<td width="78%" class="vtable"> |
|
227 |
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" /> |
|
228 |
<br /> <span class="vexpl"><?=gettext("You may enter a description here " . |
|
229 |
"for your reference (not parsed)"); ?>.</span></td> |
|
230 |
</tr> |
|
231 |
<tr> |
|
232 |
<td width="22%" valign="top"> </td> |
|
233 |
<td width="78%"> |
|
234 |
<input type="hidden" name="laggif" value="<?=htmlspecialchars($pconfig['laggif']); ?>" /> |
|
235 |
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> |
|
236 |
<input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> |
|
237 |
<?php if (isset($id) && $a_laggs[$id]): ?> |
|
238 |
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> |
|
239 |
<?php endif; ?> |
|
240 |
</td> |
|
241 |
</tr> |
|
242 |
</table> |
|
243 |
</form> |
|
244 |
<?php include("fend.inc"); ?> |
|
245 |
</body> |
|
246 |
</html> |
|
214 |
$form = new Form(); |
|
215 |
|
|
216 |
$form->addGlobal(new Form_Button( |
|
217 |
'cancel', |
|
218 |
'Cancel', |
|
219 |
$referer |
|
220 |
)); |
|
221 |
|
|
222 |
$section = new Form_Section('LAGG Configuration'); |
|
223 |
|
|
224 |
$memberslist = build_member_list(); |
|
225 |
|
|
226 |
$section->addInput(new Form_Select( |
|
227 |
'members[]', |
|
228 |
'Parent Interfaces', |
|
229 |
$memberslist['selected'], |
|
230 |
$memberslist['list'], |
|
231 |
true // Allow multiples |
|
232 |
))->setHelp('Choose the members that will be used for the link aggregation.'); |
|
233 |
|
|
234 |
$section->addInput(new Form_Select( |
|
235 |
'proto', |
|
236 |
'LAGG Protocol', |
|
237 |
$pconfig['proto'], |
|
238 |
array_combine($laggprotos, $laggprotosuc) |
|
239 |
))->setHelp($protohelp); |
|
240 |
|
|
241 |
$section->addInput(new Form_Input( |
|
242 |
'laggif', |
|
243 |
null, |
|
244 |
'hidden', |
|
245 |
$pconfig['laggif'] |
|
246 |
)); |
|
247 |
|
|
248 |
if (isset($id) && $a_laggs[$id]) { |
|
249 |
$section->addInput(new Form_Input( |
|
250 |
'id', |
|
251 |
null, |
|
252 |
'hidden', |
|
253 |
htmlspecialchars($id) |
|
254 |
)); |
|
255 |
} |
|
256 |
|
|
257 |
$form->add($section); |
|
258 |
print($form); |
|
259 |
|
|
260 |
include("foot.inc"); |
Also available in: Unified diff
interfaces_lagg_edit Conversion complete
Ready for review