VirtualBox

Changeset 9598 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 11, 2008 10:30:03 AM (17 years ago)
Author:
vboxsync
Message:

Fixed hostif vnic script to work on newer and older nevada builds.
Tested on 82 and 86. 83 is where the format change happened.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/solaris/vnicinit_solaris.sh

    r9577 r9598  
    2929# Create the VNIC if required
    3030if [ -z "$2" ]; then
    31     # Try obtain a physical NIC that is currently active
    32     phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==7 && $3=="up" { print $1 }'`
     31    # snv <= 82 is to handled differently (dladm format changes at 83+)
     32    snv_str=`uname -v`
     33    snv_num=${snv_str##*[a-z][_]}
     34
     35    # Try obtain one that's currently active (82 dladm show-link doesn't indicate status; just use show-dev atm)
     36    if [ $snv_num -le 82 ]; then
     37        phys_nic=`/usr/sbin/dladm show-dev -p | /usr/bin/awk 'NF==4 && $2=="link=up" { print $1 }'`
     38    else
     39        phys_field=`/usr/sbin/dladm show-link -p | /usr/bin/awk 'NF==5 && $4=="STATE=\"up\"" { print $1 }'`
     40        eval $phys_field
     41        phys_nic="$LINK"
     42    fi
     43
    3344    if [ -z "$phys_nic" ]; then
    34         # Try obtain a physical NIC that is currently active
    35         phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'`
     45        # Failed to get a currently active NIC, get the first available link.
     46        if [ $snv_num -le 82 ]; then
     47            phys_nic=`/usr/sbin/dladm show-link -p | /usr/bin/nawk '/legacy/ {next} {print $1; exit}'`
     48        else
     49            phys_field=`/usr/sbin/dladm show-link -p | /usr/bin/awk 'NF==5 && $2=="CLASS=\"phys\"" { print $1 }'`
     50            eval $phys_field
     51            phys_nic="$LINK"
     52        fi
    3653        if [ -z "$phys_nic" ]; then
    37             # Failed to get a currently active NIC, get the first available NIC.
    38             phys_nic=`/usr/sbin/dladm show-link | /usr/bin/nawk '/legacy/ {next} {print $1; exit}'`
    39             if [ -z "$phys_nic" ]; then
    40                 # Failed to get any NICs!
    41                 echo "Failed to get a physical NIC to bind to."
    42                 exit 1
    43             fi
     54            # Failed to get any NICs!
     55            echo "Failed to get a physical NIC to bind to."
     56            exit 1
    4457        fi
    4558    fi
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette