Project

General

Profile

« Previous | Next » 

Revision d5dfcb52

Added by Marcus Brown over 14 years ago

Change name of function "interface_translate_type_to_real" to match what it's doing (or should be doing.)

Next commits will change functionality of this function because before now
it's identical to "get_real_interface" function (because of bug mentioned below.)
Also, replace interface_translate_type_to_real with get_real_interface in two places
for wireless functionality. I don't think they expect the result produced by interface_translate_type_to_real.
Change from "type" it "ipaddr" in switch statement. "type" isn't a valid field in $config['interfaces']

View differences:

etc/inc/interfaces.inc
2468 2468
	$wancfg = $config['interfaces'][$interface];
2469 2469

  
2470 2470
	$realif = get_real_interface($interface);
2471
	$realhwif = interface_translate_type_to_real($interface);
2471
	$realhwif = get_parent_interface($interface);
2472 2472

  
2473 2473
	if (!$g['booting']) {
2474 2474
		/* remove all IPv4 addresses */
......
2831 2831
                if (stristr($interface, "_wlan0") && $config['interfaces'][$if]['if'] == interface_get_wireless_base($interface))
2832 2832
                        return $if;
2833 2833

  
2834
                $int = interface_translate_type_to_real($if);
2834
                $int = get_parent_interface($if);
2835 2835
                if ($int == $interface)
2836 2836
                        return $ifname;
2837 2837
        }
......
2903 2903
}
2904 2904

  
2905 2905
/*
2906
 *  interface_translate_type_to_real($interface):
2907
 *              returns the real hardware interface name for a friendly interface.  ie: wan
2906
 *  get_parent_interface($interface):
2907
 *			returns the real parent interface for a given interface description (i.e. wan)
2908
 *			or a virtual interface (i.e. vlan1 or pppoe0 etc.)
2908 2909
 */
2909
function interface_translate_type_to_real($interface) {
2910
        global $config;
2910
function get_parent_interface($interface) {
2911
	global $config;
2911 2912

  
2912 2913
	if (empty($config['interfaces'][$interface]))
2913 2914
		return $interface;
2915

  
2914 2916
	$tmpif = $config['interfaces'][$interface];
2915
	switch ($tmpif['type']) {
2917
	switch ($tmpif['ipaddr']) {
2916 2918
	case "ppp":
2917 2919
	case "pppoe":
2918 2920
	case "pptp":
......
3478 3480
	/* return wireless modes and channels */
3479 3481
	$wireless_modes = array();
3480 3482

  
3481
	$wlif = interface_translate_type_to_real($interface);
3483
	$wlif = get_real_interface($interface);
3482 3484

  
3483 3485
	if(is_interface_wireless($wlif)) {
3484 3486
		$cloned_interface = get_real_interface($interface);
......
3524 3526
function get_wireless_channel_info($interface) {
3525 3527
	$wireless_channels = array();
3526 3528

  
3527
	$wlif = interface_translate_type_to_real($interface);
3529
	$wlif = get_real_interface($interface);
3528 3530

  
3529 3531
	if(is_interface_wireless($wlif)) {
3530 3532
		$cloned_interface = get_real_interface($interface);

Also available in: Unified diff