Fix IkeUdpSocket by using closeAndSignalBlockedThreads

This commit uses IoUtils.close(eventually call
closeAndSignalBlockedThreads) to close the FileDescriptor in
IkeUdpSocket instead of using Os.close. This changes make sure
the Fd will stop waiting for the incoming packets and be closed
immediately.

Previously after calling Os.close, the Fd will still be waiting for
packets because it is a blocking socket. The sympton is after
IKE Session switches from IkeUdpSocket to IkeUdpEncapSocket
the IkeUdpSocket is still able to receive packets, and may
receive packets that are expected to be received on
IkeUdpEncapSocket. When IkeUdpSocket receives such packet,
it will drop the packet because IkeUdpSocket has cleared all the
IkeSessions information and is not able to re-direct this packet.
Eventually the IKE Session will hit retransmission error and be
terminated.

Bug: 189281560
Test: manually tested
Change-Id: I109113b89c1d0e14362b807471d25cdbebbd2bf0
(cherry picked from commit 589cc5d91dbbe677562c869dae7eb094b195a691)
2 files changed
tree: 8e47eef460983c593850fb3bf871f3ed1bf73df5
  1. apex/
  2. api/
  3. src/
  4. tests/
  5. Android.bp
  6. jarjar-rules-shared.txt
  7. jarjar-rules-test.txt
  8. lint-baseline.xml
  9. OWNERS
  10. PREUPLOAD.cfg
  11. README.md
  12. TEST_MAPPING
README.md

IKEv2 Library for Android

Introduction

This IKEv2 library is an in-process client library implementing the IKEv2 protocol as well as extensions necessary for the support of IWLAN. It is designed to work in a non-privileged fashion on top of the Android IPsec API surface.