Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | package android.net; |
| 17 | |
| 18 | import android.os.Parcel; |
| 19 | import android.os.Parcelable; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 20 | |
| 21 | import com.android.internal.annotations.VisibleForTesting; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 22 | |
Jonathan Basseri | c61b70d | 2017-04-21 15:53:51 -0700 | [diff] [blame] | 23 | /** |
| 24 | * This class encapsulates all the configuration parameters needed to create IPsec transforms and |
| 25 | * policies. |
| 26 | * |
| 27 | * @hide |
| 28 | */ |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 29 | public final class IpSecConfig implements Parcelable { |
Nathan Harold | 93962f3 | 2017-03-07 13:23:36 -0800 | [diff] [blame] | 30 | private static final String TAG = "IpSecConfig"; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 31 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 32 | // MODE_TRANSPORT or MODE_TUNNEL |
| 33 | private int mMode = IpSecTransform.MODE_TRANSPORT; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 34 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 35 | // Preventing this from being null simplifies Java->Native binder |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 36 | private String mSourceAddress = ""; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 37 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 38 | // Preventing this from being null simplifies Java->Native binder |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 39 | private String mDestinationAddress = ""; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 40 | |
Nathan Harold | d6f50b2 | 2017-10-04 12:58:55 -0700 | [diff] [blame] | 41 | // The underlying Network that represents the "gateway" Network |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 42 | // for outbound packets. It may also be used to select packets. |
| 43 | private Network mNetwork; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 44 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 45 | // Minimum requirements for identifying a transform |
| 46 | // SPI identifying the IPsec SA in packet processing |
| 47 | // and a destination IP address |
| 48 | private int mSpiResourceId = IpSecManager.INVALID_RESOURCE_ID; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 49 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 50 | // Encryption Algorithm |
| 51 | private IpSecAlgorithm mEncryption; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 52 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 53 | // Authentication Algorithm |
| 54 | private IpSecAlgorithm mAuthentication; |
ludi | b0c95b1 | 2017-05-22 10:52:23 -0700 | [diff] [blame] | 55 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 56 | // Authenticated Encryption Algorithm |
| 57 | private IpSecAlgorithm mAuthenticatedEncryption; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 58 | |
| 59 | // For tunnel mode IPv4 UDP Encapsulation |
| 60 | // IpSecTransform#ENCAP_ESP_*, such as ENCAP_ESP_OVER_UDP_IKE |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 61 | private int mEncapType = IpSecTransform.ENCAP_NONE; |
| 62 | private int mEncapSocketResourceId = IpSecManager.INVALID_RESOURCE_ID; |
| 63 | private int mEncapRemotePort; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 64 | |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 65 | // An interval, in seconds between the NattKeepalive packets |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 66 | private int mNattKeepaliveInterval; |
| 67 | |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 68 | // XFRM mark and mask |
| 69 | private int mMarkValue; |
| 70 | private int mMarkMask; |
| 71 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 72 | /** Set the mode for this IPsec transform */ |
| 73 | public void setMode(int mode) { |
| 74 | mMode = mode; |
| 75 | } |
| 76 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 77 | /** Set the source IP addres for this IPsec transform */ |
| 78 | public void setSourceAddress(String sourceAddress) { |
| 79 | mSourceAddress = sourceAddress; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 82 | /** Set the destination IP address for this IPsec transform */ |
| 83 | public void setDestinationAddress(String destinationAddress) { |
| 84 | mDestinationAddress = destinationAddress; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 87 | /** Set the SPI by resource ID */ |
| 88 | public void setSpiResourceId(int resourceId) { |
| 89 | mSpiResourceId = resourceId; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 90 | } |
| 91 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 92 | /** Set the encryption algorithm */ |
| 93 | public void setEncryption(IpSecAlgorithm encryption) { |
| 94 | mEncryption = encryption; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 97 | /** Set the authentication algorithm */ |
| 98 | public void setAuthentication(IpSecAlgorithm authentication) { |
| 99 | mAuthentication = authentication; |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 102 | /** Set the authenticated encryption algorithm */ |
| 103 | public void setAuthenticatedEncryption(IpSecAlgorithm authenticatedEncryption) { |
| 104 | mAuthenticatedEncryption = authenticatedEncryption; |
Benedict Wong | 0febe5e | 2017-08-22 21:42:33 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 107 | /** Set the underlying network that will carry traffic for this transform */ |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 108 | public void setNetwork(Network network) { |
| 109 | mNetwork = network; |
| 110 | } |
| 111 | |
| 112 | public void setEncapType(int encapType) { |
| 113 | mEncapType = encapType; |
| 114 | } |
| 115 | |
| 116 | public void setEncapSocketResourceId(int resourceId) { |
| 117 | mEncapSocketResourceId = resourceId; |
| 118 | } |
| 119 | |
| 120 | public void setEncapRemotePort(int port) { |
| 121 | mEncapRemotePort = port; |
| 122 | } |
| 123 | |
| 124 | public void setNattKeepaliveInterval(int interval) { |
| 125 | mNattKeepaliveInterval = interval; |
| 126 | } |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 127 | |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 128 | public void setMarkValue(int mark) { |
| 129 | mMarkValue = mark; |
| 130 | } |
| 131 | |
| 132 | public void setMarkMask(int mask) { |
| 133 | mMarkMask = mask; |
| 134 | } |
| 135 | |
Nathan Harold | 93962f3 | 2017-03-07 13:23:36 -0800 | [diff] [blame] | 136 | // Transport or Tunnel |
| 137 | public int getMode() { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 138 | return mMode; |
Nathan Harold | 93962f3 | 2017-03-07 13:23:36 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 141 | public String getSourceAddress() { |
| 142 | return mSourceAddress; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 143 | } |
| 144 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 145 | public int getSpiResourceId() { |
| 146 | return mSpiResourceId; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 147 | } |
| 148 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 149 | public String getDestinationAddress() { |
| 150 | return mDestinationAddress; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 151 | } |
| 152 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 153 | public IpSecAlgorithm getEncryption() { |
| 154 | return mEncryption; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 155 | } |
| 156 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 157 | public IpSecAlgorithm getAuthentication() { |
| 158 | return mAuthentication; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 159 | } |
| 160 | |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 161 | public IpSecAlgorithm getAuthenticatedEncryption() { |
| 162 | return mAuthenticatedEncryption; |
Benedict Wong | 0febe5e | 2017-08-22 21:42:33 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Nathan Harold | 93962f3 | 2017-03-07 13:23:36 -0800 | [diff] [blame] | 165 | public Network getNetwork() { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 166 | return mNetwork; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | public int getEncapType() { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 170 | return mEncapType; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 171 | } |
| 172 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 173 | public int getEncapSocketResourceId() { |
| 174 | return mEncapSocketResourceId; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | public int getEncapRemotePort() { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 178 | return mEncapRemotePort; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 179 | } |
| 180 | |
Nathan Harold | 93962f3 | 2017-03-07 13:23:36 -0800 | [diff] [blame] | 181 | public int getNattKeepaliveInterval() { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 182 | return mNattKeepaliveInterval; |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 183 | } |
| 184 | |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 185 | public int getMarkValue() { |
| 186 | return mMarkValue; |
| 187 | } |
| 188 | |
| 189 | public int getMarkMask() { |
| 190 | return mMarkMask; |
| 191 | } |
| 192 | |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 193 | // Parcelable Methods |
| 194 | |
| 195 | @Override |
| 196 | public int describeContents() { |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | @Override |
| 201 | public void writeToParcel(Parcel out, int flags) { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 202 | out.writeInt(mMode); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 203 | out.writeString(mSourceAddress); |
| 204 | out.writeString(mDestinationAddress); |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 205 | out.writeParcelable(mNetwork, flags); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 206 | out.writeInt(mSpiResourceId); |
| 207 | out.writeParcelable(mEncryption, flags); |
| 208 | out.writeParcelable(mAuthentication, flags); |
| 209 | out.writeParcelable(mAuthenticatedEncryption, flags); |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 210 | out.writeInt(mEncapType); |
| 211 | out.writeInt(mEncapSocketResourceId); |
| 212 | out.writeInt(mEncapRemotePort); |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 213 | out.writeInt(mNattKeepaliveInterval); |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 214 | out.writeInt(mMarkValue); |
| 215 | out.writeInt(mMarkMask); |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 216 | } |
| 217 | |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 218 | @VisibleForTesting |
| 219 | public IpSecConfig() {} |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 220 | |
Benedict Wong | 9dd3a38 | 2018-02-06 20:43:21 -0800 | [diff] [blame] | 221 | /** Copy constructor */ |
| 222 | @VisibleForTesting |
| 223 | public IpSecConfig(IpSecConfig c) { |
| 224 | mMode = c.mMode; |
| 225 | mSourceAddress = c.mSourceAddress; |
| 226 | mDestinationAddress = c.mDestinationAddress; |
| 227 | mNetwork = c.mNetwork; |
| 228 | mSpiResourceId = c.mSpiResourceId; |
| 229 | mEncryption = c.mEncryption; |
| 230 | mAuthentication = c.mAuthentication; |
| 231 | mAuthenticatedEncryption = c.mAuthenticatedEncryption; |
| 232 | mEncapType = c.mEncapType; |
| 233 | mEncapSocketResourceId = c.mEncapSocketResourceId; |
| 234 | mEncapRemotePort = c.mEncapRemotePort; |
| 235 | mNattKeepaliveInterval = c.mNattKeepaliveInterval; |
| 236 | mMarkValue = c.mMarkValue; |
| 237 | mMarkMask = c.mMarkMask; |
| 238 | } |
| 239 | |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 240 | private IpSecConfig(Parcel in) { |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 241 | mMode = in.readInt(); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 242 | mSourceAddress = in.readString(); |
| 243 | mDestinationAddress = in.readString(); |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 244 | mNetwork = (Network) in.readParcelable(Network.class.getClassLoader()); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 245 | mSpiResourceId = in.readInt(); |
| 246 | mEncryption = |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 247 | (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader()); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 248 | mAuthentication = |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 249 | (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader()); |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 250 | mAuthenticatedEncryption = |
Benedict Wong | 0febe5e | 2017-08-22 21:42:33 -0700 | [diff] [blame] | 251 | (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader()); |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 252 | mEncapType = in.readInt(); |
| 253 | mEncapSocketResourceId = in.readInt(); |
| 254 | mEncapRemotePort = in.readInt(); |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 255 | mNattKeepaliveInterval = in.readInt(); |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 256 | mMarkValue = in.readInt(); |
| 257 | mMarkMask = in.readInt(); |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 258 | } |
| 259 | |
ludi | b0c95b1 | 2017-05-22 10:52:23 -0700 | [diff] [blame] | 260 | @Override |
| 261 | public String toString() { |
| 262 | StringBuilder strBuilder = new StringBuilder(); |
| 263 | strBuilder |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 264 | .append("{mMode=") |
| 265 | .append(mMode == IpSecTransform.MODE_TUNNEL ? "TUNNEL" : "TRANSPORT") |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 266 | .append(", mSourceAddress=") |
| 267 | .append(mSourceAddress) |
| 268 | .append(", mDestinationAddress=") |
| 269 | .append(mDestinationAddress) |
Nathan Harold | a10003d | 2017-08-23 13:46:33 -0700 | [diff] [blame] | 270 | .append(", mNetwork=") |
| 271 | .append(mNetwork) |
| 272 | .append(", mEncapType=") |
| 273 | .append(mEncapType) |
| 274 | .append(", mEncapSocketResourceId=") |
| 275 | .append(mEncapSocketResourceId) |
| 276 | .append(", mEncapRemotePort=") |
| 277 | .append(mEncapRemotePort) |
| 278 | .append(", mNattKeepaliveInterval=") |
| 279 | .append(mNattKeepaliveInterval) |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 280 | .append("{mSpiResourceId=") |
| 281 | .append(mSpiResourceId) |
| 282 | .append(", mEncryption=") |
| 283 | .append(mEncryption) |
| 284 | .append(", mAuthentication=") |
| 285 | .append(mAuthentication) |
| 286 | .append(", mAuthenticatedEncryption=") |
| 287 | .append(mAuthenticatedEncryption) |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 288 | .append(", mMarkValue=") |
| 289 | .append(mMarkValue) |
| 290 | .append(", mMarkMask=") |
| 291 | .append(mMarkMask) |
ludi | b0c95b1 | 2017-05-22 10:52:23 -0700 | [diff] [blame] | 292 | .append("}"); |
| 293 | |
| 294 | return strBuilder.toString(); |
| 295 | } |
| 296 | |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 297 | public static final Parcelable.Creator<IpSecConfig> CREATOR = |
| 298 | new Parcelable.Creator<IpSecConfig>() { |
| 299 | public IpSecConfig createFromParcel(Parcel in) { |
| 300 | return new IpSecConfig(in); |
| 301 | } |
| 302 | |
| 303 | public IpSecConfig[] newArray(int size) { |
| 304 | return new IpSecConfig[size]; |
| 305 | } |
| 306 | }; |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 307 | |
| 308 | @VisibleForTesting |
Nathan Harold | d6f50b2 | 2017-10-04 12:58:55 -0700 | [diff] [blame] | 309 | /** Equals method used for testing */ |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 310 | public static boolean equals(IpSecConfig lhs, IpSecConfig rhs) { |
| 311 | if (lhs == null || rhs == null) return (lhs == rhs); |
| 312 | return (lhs.mMode == rhs.mMode |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 313 | && lhs.mSourceAddress.equals(rhs.mSourceAddress) |
| 314 | && lhs.mDestinationAddress.equals(rhs.mDestinationAddress) |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 315 | && ((lhs.mNetwork != null && lhs.mNetwork.equals(rhs.mNetwork)) |
| 316 | || (lhs.mNetwork == rhs.mNetwork)) |
| 317 | && lhs.mEncapType == rhs.mEncapType |
| 318 | && lhs.mEncapSocketResourceId == rhs.mEncapSocketResourceId |
| 319 | && lhs.mEncapRemotePort == rhs.mEncapRemotePort |
| 320 | && lhs.mNattKeepaliveInterval == rhs.mNattKeepaliveInterval |
Nathan Harold | a252331 | 2018-01-05 19:25:13 -0800 | [diff] [blame] | 321 | && lhs.mSpiResourceId == rhs.mSpiResourceId |
| 322 | && IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption) |
| 323 | && IpSecAlgorithm.equals( |
| 324 | lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption) |
Di Lu | 0b611f4 | 2018-01-11 11:35:25 -0800 | [diff] [blame] | 325 | && IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication) |
| 326 | && lhs.mMarkValue == rhs.mMarkValue |
| 327 | && lhs.mMarkMask == rhs.mMarkMask); |
Nathan Harold | 19ce70b | 2017-09-25 19:33:13 -0700 | [diff] [blame] | 328 | } |
Nathan Harold | 330e108 | 2017-01-12 18:38:57 -0800 | [diff] [blame] | 329 | } |