From: rtrimana Date: Thu, 1 Feb 2018 18:23:20 +0000 (-0800) Subject: Adjusting runtime system back after paper evaluation - putting back RMI port and... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=f7ff6050110f71874879912c9b1f6a01745d2d76;hp=325bdddf294e581e97dcf23bbbcaed7df7efaea8 Adjusting runtime system back after paper evaluation - putting back RMI port and other port assignments to random number generator --- diff --git a/iotjava/iotruntime/master/CommunicationHandler.java b/iotjava/iotruntime/master/CommunicationHandler.java index fd43408..5d25772 100644 --- a/iotjava/iotruntime/master/CommunicationHandler.java +++ b/iotjava/iotruntime/master/CommunicationHandler.java @@ -73,6 +73,13 @@ public final class CommunicationHandler { private int iNumOfHosts; private boolean bVerbose; + // TODO: THIS IS HACKING FOR IOTSEC + // Replace random + private int comPortCount = 10000; + private int rmiRegCount = 20000; + private int rmiStubCount = 30000; + private int additionalCount = 40000; + /** * CommunicationHandler class constants */ @@ -165,6 +172,8 @@ public final class CommunicationHandler { int iComPort = 0; do { iComPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT; + //System.out.println("DEBUG: Assigning comPort: " + comPortCount); + //iComPort = comPortCount++; // Check port existence in HashMap } while (portIsAvailable(iComPort) == false); hmComPort.put(iNumOfObjects, iComPort); @@ -174,6 +183,8 @@ public final class CommunicationHandler { int iRMIRegPort = 0; do { iRMIRegPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT; + //System.out.println("DEBUG: Assigning regPort: " + rmiRegCount); + //iRMIRegPort = rmiRegCount++; // Check port existence in HashMap } while (portIsAvailable(iRMIRegPort) == false); hmRMIRegPort.put(iNumOfObjects, iRMIRegPort); @@ -182,6 +193,8 @@ public final class CommunicationHandler { int iRMIStubPort = 0; do { iRMIStubPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT; + //System.out.println("DEBUG: Assigning stubPort: " + rmiStubCount); + //iRMIStubPort = rmiStubCount++; // Check port existence in HashMap } while (portIsAvailable(iRMIStubPort) == false); hmRMIStubPort.put(iNumOfObjects, iRMIStubPort); @@ -246,6 +259,8 @@ public final class CommunicationHandler { int iAdditionalPort = 0; do { iAdditionalPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT; + //System.out.println("DEBUG: Assigning additionalPort: " + additionalCount); + //iAdditionalPort = additionalCount++; // Check port existence in HashMap } while (portIsAvailable(iAdditionalPort) == false); hmAdditionalPort.put(iNumOfObjects, iAdditionalPort); @@ -269,7 +284,7 @@ public final class CommunicationHandler { */ public boolean portIsAvailable(int iPortNumber) { - /*if (hmComPort.containsValue(iPortNumber) == true) { + if (hmComPort.containsValue(iPortNumber) == true) { return false; } else if (hmRMIRegPort.containsValue(iPortNumber) == true) { return false; @@ -281,12 +296,12 @@ public final class CommunicationHandler { return false; } else { return true; - }*/ - if (hsAllPorts.contains(iPortNumber)) { - return false; - } else { - return true; } + //if (hsAllPorts.contains(iPortNumber)) { + // return false; + //} else { + // return true; + //} } /** diff --git a/iotjava/iotruntime/master/RouterConfig.java b/iotjava/iotruntime/master/RouterConfig.java index ace0ea0..3c5c2a9 100644 --- a/iotjava/iotruntime/master/RouterConfig.java +++ b/iotjava/iotruntime/master/RouterConfig.java @@ -322,7 +322,7 @@ public final class RouterConfig { try { // We replace with "cat /usr/sbin/arp" String cmd = "ssh " + STR_SSH_USERNAME_RASPBERRYPI + "@" + strRouterAddress + - " /usr/sbin/arp"; + " /usr/sbin/arp -n"; Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(cmd);