1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.net.cts; 18 19 import android.system.ErrnoException; 20 import android.system.Os; 21 import android.system.OsConstants; 22 import android.system.StructStat; 23 import android.test.AndroidTestCase; 24 25 import java.io.File; 26 import java.io.FileDescriptor; 27 import java.io.IOException; 28 29 /** 30 * Tests for multinetwork sysctl functionality. 31 */ 32 public class IpSecSysctlTest extends SysctlBaseTest { 33 34 // SPI expiration sysctls. Must be present and set greater than 1h. 35 private static final String SPI_TIMEOUT_SYSCTL = "/proc/sys/net/core/xfrm_acq_expires"; 36 private static final int MIN_ACQ_EXPIRES = 3600; 37 38 /** 39 * Checks that SPI default timeouts are overridden, and set to a reasonable length of time 40 */ 41 public void testProcFiles() throws ErrnoException, IOException, NumberFormatException { 42 int value = getIntValue(SPI_TIMEOUT_SYSCTL); 43 assertAtLeast(SPI_TIMEOUT_SYSCTL, value, MIN_ACQ_EXPIRES); 44 } 45 } 46