[BACK]Return to netstart CVS log [TXT][DIR] Up to [local] / src / etc

Diff for /src/etc/netstart between version 1.44 and 1.45

version 1.44, 1998/10/06 23:25:21 version 1.45, 1998/10/28 19:17:10
Line 2 
Line 2 
 #  #
 #       $OpenBSD$  #       $OpenBSD$
   
   # Returns true if $1 contains only alphanumerics
   isalphanumeric() {
           local _n
           _n=$1
           while [ ${#_n} != 0 ]; do
                   case $_n in
                           [A-Za-z0-9]*)   ;;
                           *)              return 1;;
                   esac
                   _n=${_n#?}
           done
           return 0
   }
   
 # /etc/myname contains my symbolic name  # /etc/myname contains my symbolic name
 #  #
 hostname=`cat /etc/myname`  hostname=`cat /etc/myname`
Line 60 
Line 74 
 # and the hostname.  # and the hostname.
   
 (  (
     tmp="$IFS"      for hn in /etc/hostname.*; do
     IFS="$IFS."          # Strip off /etc/hostname. prefix
     set -- `echo /etc/hostname*`          if=${hn#/etc/hostname.}
     IFS=$tmp  
     unset tmp  
   
     while [ $# -ge 2 ] ; do          # Interface names must be alphanumeric only.  We check to avoid
         shift            # get rid of "hostname"          # configuring backup or temp files, and to catch the "*" case.
           if ! isalphanumeric "$if"; then
               continue
           fi
   
           # Now parse the hostname.* file
         (          (
             read af name mask bcaddr extras              read af name mask bcaddr extras
             read dt dtaddr              read dt dtaddr
   
             # check to see if device should be configure by dhcp              # check to see if device should be configure by dhcp
             if [ "$af" = "dhcp" ]; then              if [ "$af" = "dhcp" ]; then
                 ifconfig $1 $extras down                  ifconfig $if $extras down
                 cmd="/sbin/dhclient $1";                  cmd="/sbin/dhclient $if";
             else              else
                 if [ ! -n "$name" ]; then                  if [ ! -n "$name" ]; then
                     echo "/etc/hostname.$1: invalid network configuration file"                      echo "/etc/hostname.$if: invalid network configuration file"
                     exit                      exit
                 fi                  fi
   
                 cmd="ifconfig $1 $af $name "                  cmd="ifconfig $if $af $name "
                 if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi                  if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
                 if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi                  if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
                 if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then                  if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
Line 92 
Line 109 
             fi              fi
   
             $cmd              $cmd
         ) < /etc/hostname.$1          ) < /etc/hostname.$if
         shift  
     done      done
 )  )
   
Line 116 
Line 132 
 else  else
         ipnat=NO          ipnat=NO
 fi  fi
   

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45