VirtualBox

Changeset 6868 in vbox


Ignore:
Timestamp:
Feb 8, 2008 3:18:18 PM (17 years ago)
Author:
vboxsync
Message:

Implement associating a tap interface with a group (linux 2.6.23+)

Location:
trunk/src/VBox/Installer/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/VBoxAddIF.sh

    r5999 r6868  
    2424interface=$1
    2525user=$2
     26if [ "$user" = "-g" ]; then
     27  shift;
     28  group=$2
     29  user=+$group
     30fi
    2631bridge=$3
    2732
     
    3843  then
    3944    echo 1>&2 ""
    40     echo 1>&2 "Usage: $appname <interface name> <user name> [<bridge name>]"
     45    echo 1>&2 "Usage: $appname <interface name>"
     46    echo 1>&2 "                [<user name>| -g <group name>] [<bridge name>]"
    4147    echo 1>&2 "Create and register the permanent interface <interface name> for use by user"
    42     echo 1>&2 "<user name> on the host system.  Optionally attach the interface to the network"
     48    echo 1>&2 "<user name> (or group <group name> for linux kernels which support this)"
     49    echo 1>&2 "on the host system.  Optionally attach the interface to the network"
    4350    echo 1>&2 "bridge <bridge name>.  <interface name> should take the form vbox<0-99>."
    4451  elif [ "$appname" = "$appdel" ]
     
    174181  echo "$interface" "$user" "$bridge" >> /etc/vbox/interfaces
    175182  echo ""
    176   echo "Creating the permanent host networking interface \"$interface\" for user $user."
     183  if [ -n "$group" ]; then
     184      echo "Creating the permanent host networking interface \"$interface\" for group $group."
     185  else
     186      echo "Creating the permanent host networking interface \"$interface\" for user $user."
     187  fi
    177188fi
    178189
     
    199210  if [ "$appname" = "$appadd" ]
    200211  then
    201     if ! VBoxTunctl -t "$interface" -u "$user" > /dev/null 2>&1
    202     then
    203       echo 1>&2 ""
    204       echo 1>&2 "Failed to create the interface \"$interface\" for user $user.  Please check"
    205       echo 1>&2 "that you currently have sufficient permissions to do this."
    206       exit 1
     212    if [ -n "$group" ]; then
     213      if ! VBoxTunctl -t "$interface" -g "$group" > /dev/null 2>&1
     214      then
     215        echo 1>&2 ""
     216        echo 1>&2 "Failed to create the interface \"$interface\" for group $group.  Please check"
     217        echo 1>&2 "that you currently have sufficient permissions to do this."
     218        exit 1
     219      fi
     220    else
     221      if ! VBoxTunctl -t "$interface" -u "$user" > /dev/null 2>&1
     222      then
     223        echo 1>&2 ""
     224        echo 1>&2 "Failed to create the interface \"$interface\" for user $user.  Please check"
     225        echo 1>&2 "that you currently have sufficient permissions to do this."
     226        exit 1
     227      fi
    207228    fi
    208229    # On SUSE Linux Enterprise Server, the tunctl command does not take
  • trunk/src/VBox/Installer/linux/vboxnet.sh

    r5999 r6868  
    201201            (valid_ifname "$1"))
    202202        then
     203          case $user in
     204            +*)
     205                group=`echo $2 | cut -c2-`
     206                cmd="VBoxTunctl -t $1 -g $group"
     207                ;;
     208            *)
     209                cmd="VBoxTunctl -t $1 -u $2"
     210                ;;
     211          esac
    203212          # Try to create the interface
    204           if VBoxTunctl -t "$1" -u "$2" > /dev/null 2>&1
     213          if $cmd > /dev/null 2>&1
    205214          then
    206215            # On SUSE Linux Enterprise Server, the interface does not
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