home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / base / root.16 / etc / rc2.d / S70pf / S70pf~
Text File  |  1998-08-19  |  1KB  |  66 lines

  1. #!/sbin/sh
  2. #
  3. #ident "@(#)S70pf    1.5"
  4. #
  5. # Push filters that were loaded before reboot.
  6. #
  7. umask 022
  8.  
  9. if [ -z "$LC_ALL" -a -z "$LC_MESSAGES" ]
  10. then
  11.     if [ -z "$LANG" ]
  12.     then
  13.         LNG=`defadm locale LANG 2>/dev/null`
  14.         if [ "$?" != 0 ]
  15.         then LANG=C
  16.         else eval $LNG
  17.         fi
  18.     fi
  19.     export LANG
  20. fi
  21.  
  22. LABEL="UX:$0"
  23. CAT=uxrc
  24. PF_DEFS=/etc/pf.d/IP
  25. PF=/usr/sbin/pushfilter
  26. NF="NULL_FILTER"
  27.  
  28. pfmt -l $LABEL -s nostd -g $CAT:197 "Loading filters...\n"
  29.  
  30. if [ ! -x $PF ]
  31.     then
  32.         pfmt -l $LABEL -s error -g $CAT:198 "%s doesn't exist or is not executable.\n" $PF ;
  33.         exit 1 ;
  34. fi
  35.  
  36. for f in $PF_DEFS/net*
  37.     do
  38.         INTRFS=`basename $f`
  39.         LAST=."$INTRFS"
  40.         STATEF=$PF_DEFS/$LAST
  41.         if [ -f $STATEF ]
  42.             then
  43.                 read IN OUT < $STATEF
  44.                 if [ "$IN" != "$NF" ]
  45.                     then
  46.                         IF="-I $IN"
  47.                     fi
  48.                 if [ "$OUT" != "$NF" ]
  49.                     then
  50.                         OF="-O $OUT"
  51.                     fi
  52.                 if [ ! -z "$IF" ] || [ ! -z "$OF" ] 
  53.                     then
  54.                     $PF  -i $INTRFS $IF $OF > /dev/null 2>&1
  55.                     if [ "$?" != 0 ]
  56.                         then
  57.                             pfmt -l $LABEL -s error -g $CAT:199 "Error in loading filters for interface %s.\n" $INTRFS
  58.                         else
  59.                         pfmt -l $LABEL -s nostd -g $CAT:200 "Done for interface %s.\n" $INTRFS
  60.                     fi
  61.                     else
  62.                         pfmt -l $LABEL -s nostd -g $CAT:201 "No filters for interface %s.\n" $INTRFS
  63.                 fi
  64.         fi
  65. done
  66.