Changeset a68c384


Ignore:
Timestamp:
May 10, 2013 10:56:32 AM (11 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
43c8ecf
Parents:
7ca5cb8
Message:

Add some extra checks when we import old jails -> new format

Make sure IPV4 ends up with a /24 at the end

Also check at jail startup, in case somehow user imported jail with wrong config

Location:
src-sh/warden/scripts/backend
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-sh/warden/scripts/backend/listjails.sh

    r1620346 ra68c384  
    6262     # This is an old style jail, lets convert it 
    6363     cp ${i}/ip ${i}/ipv4 
     64     oIP=`cat ${i}/ipv4` 
     65     echo "${oIP}/24" > ${i}/ipv4 
    6466 
    6567     # Get next unique ID 
  • src-sh/warden/scripts/backend/startjail.sh

    r738f740 ra68c384  
    154154if [ -e "${JMETADIR}/ipv4" ] ; then 
    155155  IP4=`cat "${JMETADIR}/ipv4"` 
     156 
     157  # Check if somebody snuck in a IP without / on it 
     158  echo $IPV4 | grep -q '/'  
     159  if [ $? -ne 0 ] ; then 
     160     IPV4="${IPV4}/24" 
     161  fi 
    156162fi 
    157163 
     
    167173if [ -e "${JMETADIR}/ipv6" ] ; then 
    168174  IP6=`cat "${JMETADIR}/ipv6"` 
     175  # Check if somebody snuck in a IP without / on it 
     176  echo $IPV6 | grep -q '/'  
     177  if [ $? -ne 0 ] ; then 
     178     IPV6="${IPV6}/64" 
     179  fi 
    169180fi 
    170181 
Note: See TracChangeset for help on using the changeset viewer.