Enable SO_REUSEADDR option for radius server Datagram Sockets.
This helps in fixing "address in use" exceptions while creating the datagram sockets.
This was hit while triggering repeated radius server reconfigurations.
Change-Id: I084c1d83499c010036fcfbca0ad86d40f4e4db88
diff --git a/src/main/java/org/onosproject/aaa/AaaManager.java b/src/main/java/org/onosproject/aaa/AaaManager.java
index 9bd65a0..1bf629b 100755
--- a/src/main/java/org/onosproject/aaa/AaaManager.java
+++ b/src/main/java/org/onosproject/aaa/AaaManager.java
@@ -19,6 +19,7 @@
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -165,7 +166,9 @@
private void initializeLocalState() {
try {
- radiusSocket = new DatagramSocket(radiusServerPort);
+ radiusSocket = new DatagramSocket(null);
+ radiusSocket.setReuseAddress(true);
+ radiusSocket.bind(new InetSocketAddress(radiusServerPort));
} catch (Exception ex) {
log.error("Can't open RADIUS socket", ex);
}