Revision fa71a9b6
Added by Erik Fonnesbeck over 15 years ago
etc/inc/interfaces.inc | ||
---|---|---|
1353 | 1353 |
$mode = ""; |
1354 | 1354 |
break; |
1355 | 1355 |
} |
1356 |
if(!stristr($wlcfg['if'], "_wlan")) { |
|
1357 |
$baseif = $wlcfg['if']; |
|
1358 |
$bssid = ""; |
|
1359 |
} else { |
|
1360 |
$baseif = substr($wlcfg['if'], 0, stripos($wlcfg['if'], "_wlan")); |
|
1361 |
$bssid = "bssid"; |
|
1362 |
} |
|
1356 | 1363 |
if(does_interface_exist($realif)) { |
1357 | 1364 |
exec("/sbin/ifconfig {$realif}", $output, $ret); |
1358 | 1365 |
$ifconfig_str = implode($output); |
1359 | 1366 |
if(($wlcfg['wireless']['mode'] == "hostap") && (! preg_match("/hostap/si", $ifconfig_str))) { |
1360 |
log_error("Interface {$wlcfg['if']}_wlan{$interface_num} changed to hostap mode");
|
|
1367 |
log_error("Interface {$realif} changed to hostap mode");
|
|
1361 | 1368 |
$needs_clone = true; |
1362 | 1369 |
} |
1363 | 1370 |
if(($wlcfg['wireless']['mode'] == "adhoc") && (! preg_match("/adhoc/si", $ifconfig_str))) { |
1364 |
log_error("Interface {$wlcfg['if']}_wlan{$interface_num} changed to adhoc mode");
|
|
1371 |
log_error("Interface {$realif} changed to adhoc mode");
|
|
1365 | 1372 |
$needs_clone = true; |
1366 | 1373 |
} |
1367 | 1374 |
if(($wlcfg['wireless']['mode'] == "bss") && (preg_match("/hostap|adhoc/si", $ifconfig_str))) { |
1368 |
log_error("Interface {$wlcfg['if']}_wlan{$interface_num} changed to infrastructure mode");
|
|
1375 |
log_error("Interface {$realif} changed to infrastructure mode");
|
|
1369 | 1376 |
$needs_clone = true; |
1370 | 1377 |
} |
1371 | 1378 |
} else { |
... | ... | |
1380 | 1387 |
log_error("Cloning new wireless interface {$realif}"); |
1381 | 1388 |
// Create the new wlan interface. FreeBSD returns the new interface name. |
1382 | 1389 |
// example: wlan2 |
1383 |
exec("/sbin/ifconfig wlan create wlandev {$wlcfg['if']} {$mode} 2>&1", $out, $ret);
|
|
1390 |
exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} {$bssid} 2>&1", $out, $ret);
|
|
1384 | 1391 |
if($ret <> 0) { |
1385 |
log_error("Failed to clone interface {$wlcfg['if']} with error code {$ret}, output {$out[0]}");
|
|
1392 |
log_error("Failed to clone interface {$baseif} with error code {$ret}, output {$out[0]}");
|
|
1386 | 1393 |
} |
1387 | 1394 |
$newif = trim($out[0]); |
1388 | 1395 |
// Rename the interface to {$parentnic}_wlan{$number}#: EX: ath0_wlan0 |
1389 | 1396 |
mwexec("/sbin/ifconfig {$newif} name {$realif} 2>&1", false); |
1390 | 1397 |
// FIXME: not sure what ngctl is for. Doesn't work. |
1391 |
// mwexec("/usr/sbin/ngctl name {$newif}: {$wlcfg['if']}_wlan{$interface_num}", false);
|
|
1398 |
// mwexec("/usr/sbin/ngctl name {$newif}: {$realif}", false);
|
|
1392 | 1399 |
} |
1393 | 1400 |
} |
1394 | 1401 |
|
... | ... | |
2381 | 2388 |
// interface name format: $parentnic_wlanparentnic# |
2382 | 2389 |
// example: ath0_wlan0 |
2383 | 2390 |
if(is_interface_wireless($cfg['if'])) { |
2384 |
if ($interface == "wan")
|
|
2385 |
$interface_num = 0;
|
|
2386 |
else
|
|
2387 |
$interface_num = substr($interface, 3);
|
|
2388 |
$wanif = $cfg['if'] . "_wlan" . $interface_num;
|
|
2391 |
if(!stristr($cfg['if'], "_wlan")) {
|
|
2392 |
$wanif = $cfg['if'] . "_wlan0";
|
|
2393 |
} else {
|
|
2394 |
$wanif = $cfg['if'];
|
|
2395 |
}
|
|
2389 | 2396 |
break; |
2390 | 2397 |
} |
2391 | 2398 |
|
Also available in: Unified diff
Use different interface names and BSSID's for wireless clones.