diff --git a/ubuntu_base/opportunistic_node.py b/ubuntu_base/opportunistic_node.py index 044509b6e60da8308da93d27f5ffdcabc0482e25..2e2018a36a4d79b19fcd60431bbd15192a107375 100644 --- a/ubuntu_base/opportunistic_node.py +++ b/ubuntu_base/opportunistic_node.py @@ -15,9 +15,16 @@ map_firewall = {} def setup_firewall(inter_num): - subprocess.run( - [f'{DIR}/ubuntu_base/configure_bridge_firewall', f"public{inter_num}", f"private{inter_num}", f"ens{inter_num}", f"br{inter_num}", f"{inter_num}", DIR], - check=True) + try: + subprocess.run( + [f'{DIR}/ubuntu_base/configure_bridge_firewall', f"public{inter_num}", f"private{inter_num}", f"ens{inter_num}", f"br{inter_num}", f"{inter_num}", DIR], + check=True) + except subprocess.CalledProcessError as e: + # This will run if the command returns a non-zero exit code (i.e., an error) + print(f"Error: {e}") + print(f"Return code: {e.returncode}") # The exit code + print(f"Command output: {e.output}") # Any output (stdout/stderr) + def process_packet(new_packet):