more debugging output

This commit is contained in:
fros4943 2009-06-26 09:28:45 +00:00
parent 4525bcb8f0
commit 964f63645b

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: NativeIPGateway.java,v 1.5 2009/06/25 17:43:13 fros4943 Exp $ * $Id: NativeIPGateway.java,v 1.6 2009/06/26 09:28:45 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -175,7 +175,7 @@ public class NativeIPGateway implements Plugin {
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.fatal("Error when updating native route: " + e.getMessage(), e);
} }
} }
}); });
@ -321,7 +321,7 @@ public class NativeIPGateway implements Plugin {
try { try {
captureThread.join(); captureThread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.fatal("Error while capturing packets: " + e.getMessage(), e);
} }
} }
captureThread = null; captureThread = null;
@ -345,7 +345,7 @@ public class NativeIPGateway implements Plugin {
String filter = "ip and dst net " + ipSplit[0] + "." + ipSplit[1]; String filter = "ip and dst net " + ipSplit[0] + "." + ipSplit[1];
captor.setFilter(filter, true); captor.setFilter(filter, true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.fatal("Error when creating captor instance: " + e.getMessage(), e);
return; return;
} }
@ -464,10 +464,8 @@ public class NativeIPGateway implements Plugin {
logger.info("Enabled forwarding on loopback interface."); logger.info("Enabled forwarding on loopback interface.");
shouldDisableLoopbackForwarding = true; shouldDisableLoopbackForwarding = true;
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when enabling forwarding: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -482,10 +480,8 @@ public class NativeIPGateway implements Plugin {
Process process = Runtime.getRuntime().exec(new String[] { "bash", "-c", "echo 0 > " + forwardingFile.getPath() }); Process process = Runtime.getRuntime().exec(new String[] { "bash", "-c", "echo 0 > " + forwardingFile.getPath() });
process.waitFor(); process.waitFor();
logger.info("Disabled forwarding on loopback interface."); logger.info("Disabled forwarding on loopback interface.");
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when disabling forwarding: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -516,10 +512,8 @@ public class NativeIPGateway implements Plugin {
logger.info("Disabled RP filter on loopback interface."); logger.info("Disabled RP filter on loopback interface.");
shouldEnableRPFilter = true; shouldEnableRPFilter = true;
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when disabling loopback RP filter: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -534,10 +528,8 @@ public class NativeIPGateway implements Plugin {
Process process = Runtime.getRuntime().exec(new String[] { "bash", "-c", "echo 1 > " + filterFile.getPath() }); Process process = Runtime.getRuntime().exec(new String[] { "bash", "-c", "echo 1 > " + filterFile.getPath() });
process.waitFor(); process.waitFor();
logger.info("Enabled RP filter on loopback interface."); logger.info("Enabled RP filter on loopback interface.");
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when enabling loopback RP filter: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -647,10 +639,8 @@ public class NativeIPGateway implements Plugin {
logger.info("> " + restoreRoutesCmd); logger.info("> " + restoreRoutesCmd);
Process routeProcess = Runtime.getRuntime().exec(restoreRoutesCmd); Process routeProcess = Runtime.getRuntime().exec(restoreRoutesCmd);
routeProcess.waitFor(); routeProcess.waitFor();
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when updating native route: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
restoreRoutesCmd = null; restoreRoutesCmd = null;
} }
@ -678,10 +668,8 @@ public class NativeIPGateway implements Plugin {
Process routeProcess = Runtime.getRuntime().exec(cmd); Process routeProcess = Runtime.getRuntime().exec(cmd);
routeProcess.waitFor(); routeProcess.waitFor();
restoreRoutesCmd = "route delete " + moteNetIP; restoreRoutesCmd = "route delete " + moteNetIP;
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when adding route: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -713,10 +701,8 @@ public class NativeIPGateway implements Plugin {
logger.info("> " + cmd); logger.info("> " + cmd);
process = Runtime.getRuntime().exec(cmd); process = Runtime.getRuntime().exec(cmd);
process.waitFor(); process.waitFor();
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when adding route: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
} }
@ -965,10 +951,8 @@ public class NativeIPGateway implements Plugin {
logger.info("> " + restoreRoutesCmd); logger.info("> " + restoreRoutesCmd);
Process routeProcess = Runtime.getRuntime().exec(restoreRoutesCmd); Process routeProcess = Runtime.getRuntime().exec(restoreRoutesCmd);
routeProcess.waitFor(); routeProcess.waitFor();
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.fatal("Error when deleting route: " + e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
} }
restoreRoutesCmd = null; restoreRoutesCmd = null;
} }