Print this page
    
8927 sadb_x_kmc_t's KM cookie should be 64-bits (fix improper upstream)
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/test/os-tests/tests/pf_key/kmc-update.sh
          +++ new/usr/src/test/os-tests/tests/pf_key/kmc-update.sh
   1    1  #!/usr/bin/ksh
   2    2  
   3    3  #
   4    4  # This file and its contents are supplied under the terms of the
   5    5  # Common Development and Distribution License ("CDDL"), version 1.0.
   6    6  # You may only use this file in accordance with the terms of version
   7    7  # 1.0 of the CDDL.
  
    | 
      ↓ open down ↓ | 
    7 lines elided | 
    
      ↑ open up ↑ | 
  
   8    8  #
   9    9  # A full copy of the text of the CDDL should have accompanied this
  10   10  # source.  A copy of the CDDL is also available via the Internet at
  11   11  # http://www.illumos.org/license/CDDL.
  12   12  #
  13   13  
  14   14  #
  15   15  # Copyright (c) 2017 Joyent, Inc.
  16   16  #
  17   17  
  18      -if [ `id -u` -ne 0 ]; then
       18 +if [[ `id -u` -ne 0 ]]; then
  19   19          echo "Need to be root or have effective UID of root."
  20   20          exit 255
  21   21  fi
  22   22  
  23   23  #
  24   24  # Two birds with one stone.
  25   25  #
  26   26  # 1.) Add some simple SAs.
  27   27  # 2.) Run C programs that use SADB_UPDATE to alter the SAs' KM cookies.
  28   28  #
  29   29  # This tests both SADB_UPDATE of an SA's KM cookie, and the C programs can
  30   30  # test (or not) cookie/cookie64 and the IKEv1 exception.
  31   31  #
  32   32  
  33   33  # Add two simple SAs.  Will delete them first, out of paranoia.
  34   34  
  35   35  ipseckey 2>&1 >/dev/null <<EOF
  36   36  delete ah spi 0x2112 dst 127.0.0.1
  37   37  delete ah spi 0x5150 dst 127.0.0.1
  38   38  add ah spi 0x2112 dst 127.0.0.1 authalg md5 authkey \
  39   39          1234567890abcdeffedcba0987654321
  40   40  add ah spi 0x5150 dst 127.0.0.1 authalg md5 authkey \
  41   41          abcdef01234567890123456789abcdef
  42   42  EOF
  43   43  
  44   44  # Run programs to see if UPDATE on their KM cookies works.  Both test
  45   45  # programs take an SPI value, and assume dst=127.0.0.1.
  46   46  
  47   47  TESTPATH=/opt/os-tests/tests/pf_key
  48   48  
  49   49  # Test IKEv1, including masking of the reserved 32-bits.
  50   50  $TESTPATH/kmc-updater 0x2112
  51   51  if [[ $? != 0 ]]; then
  52   52      echo "IKEv1 32-bit KMC test failed."
  53   53      exit 1
  54   54  fi
  55   55  echo "Passed IKEv1 32-bit KMC test."
  56   56  
  57   57  # Test a different one, using all 64-bits.
  58   58  $TESTPATH/kmc-updater 0x5150 64
  59   59  if [[ $? != 0 ]]; then
  60   60      echo "64-bit KMC test failed."
  61   61      exit 1
  62   62  fi
  63   63  echo "Passed 64-bit KMC test."
  64   64  
  65   65  ipseckey delete ah spi 0x2112 dst 127.0.0.1
  66   66  ipseckey delete ah spi 0x5150 dst 127.0.0.1
  67   67  
  68   68  exit 0
  
    | 
      ↓ open down ↓ | 
    40 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX