Skip to content

Commit

Permalink
Merge pull request #501 from coreemu/release-7.0.1
Browse files Browse the repository at this point in the history
Release 7.0.1
  • Loading branch information
bharnden authored Jul 28, 2020
2 parents eb70386 + afe434f commit 1fdc5c5
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 65 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2020-07-28 CORE 7.0.1

* Bugfixes
* \#500 - fixed issue running node commands with shell=True
* fixed issue for poetry based install not properly vetting requirements for dataclasses dependency

## 2020-07-23 CORE 7.0.0

* Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

# this defines the CORE version number, must be static for AC_INIT
AC_INIT(core, 7.0.0)
AC_INIT(core, 7.0.1)

# autoconf and automake initialization
AC_CONFIG_SRCDIR([netns/version.h.in])
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/configservices/frrservices/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FRRZebra(ConfigService):
]
executables: List[str] = ["zebra"]
dependencies: List[str] = []
startup: List[str] = ["sh frrboot.sh zebra"]
startup: List[str] = ["bash frrboot.sh zebra"]
validate: List[str] = ["pidof zebra"]
shutdown: List[str] = ["killall zebra"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down
16 changes: 8 additions & 8 deletions daemon/core/configservices/nrlservices/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MgenSinkService(ConfigService):
files: List[str] = ["mgensink.sh", "sink.mgen"]
executables: List[str] = ["mgen"]
dependencies: List[str] = []
startup: List[str] = ["sh mgensink.sh"]
startup: List[str] = ["bash mgensink.sh"]
validate: List[str] = ["pidof mgen"]
shutdown: List[str] = ["killall mgen"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -36,7 +36,7 @@ class NrlNhdp(ConfigService):
files: List[str] = ["nrlnhdp.sh"]
executables: List[str] = ["nrlnhdp"]
dependencies: List[str] = []
startup: List[str] = ["sh nrlnhdp.sh"]
startup: List[str] = ["bash nrlnhdp.sh"]
validate: List[str] = ["pidof nrlnhdp"]
shutdown: List[str] = ["killall nrlnhdp"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -58,7 +58,7 @@ class NrlSmf(ConfigService):
files: List[str] = ["startsmf.sh"]
executables: List[str] = ["nrlsmf", "killall"]
dependencies: List[str] = []
startup: List[str] = ["sh startsmf.sh"]
startup: List[str] = ["bash startsmf.sh"]
validate: List[str] = ["pidof nrlsmf"]
shutdown: List[str] = ["killall nrlsmf"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -93,7 +93,7 @@ class NrlOlsr(ConfigService):
files: List[str] = ["nrlolsrd.sh"]
executables: List[str] = ["nrlolsrd"]
dependencies: List[str] = []
startup: List[str] = ["sh nrlolsrd.sh"]
startup: List[str] = ["bash nrlolsrd.sh"]
validate: List[str] = ["pidof nrlolsrd"]
shutdown: List[str] = ["killall nrlolsrd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -117,7 +117,7 @@ class NrlOlsrv2(ConfigService):
files: List[str] = ["nrlolsrv2.sh"]
executables: List[str] = ["nrlolsrv2"]
dependencies: List[str] = []
startup: List[str] = ["sh nrlolsrv2.sh"]
startup: List[str] = ["bash nrlolsrv2.sh"]
validate: List[str] = ["pidof nrlolsrv2"]
shutdown: List[str] = ["killall nrlolsrv2"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -139,7 +139,7 @@ class OlsrOrg(ConfigService):
files: List[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"]
executables: List[str] = ["olsrd"]
dependencies: List[str] = []
startup: List[str] = ["sh olsrd.sh"]
startup: List[str] = ["bash olsrd.sh"]
validate: List[str] = ["pidof olsrd"]
shutdown: List[str] = ["killall olsrd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -161,7 +161,7 @@ class MgenActor(ConfigService):
files: List[str] = ["start_mgen_actor.sh"]
executables: List[str] = ["mgen"]
dependencies: List[str] = []
startup: List[str] = ["sh start_mgen_actor.sh"]
startup: List[str] = ["bash start_mgen_actor.sh"]
validate: List[str] = ["pidof mgen"]
shutdown: List[str] = ["killall mgen"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -176,7 +176,7 @@ class Arouted(ConfigService):
files: List[str] = ["startarouted.sh"]
executables: List[str] = ["arouted"]
dependencies: List[str] = []
startup: List[str] = ["sh startarouted.sh"]
startup: List[str] = ["bash startarouted.sh"]
validate: List[str] = ["pidof arouted"]
shutdown: List[str] = ["pkill arouted"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/configservices/quaggaservices/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Zebra(ConfigService):
]
executables: List[str] = ["zebra"]
dependencies: List[str] = []
startup: List[str] = ["sh quaggaboot.sh zebra"]
startup: List[str] = ["bash quaggaboot.sh zebra"]
validate: List[str] = ["pidof zebra"]
shutdown: List[str] = ["killall zebra"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down
10 changes: 5 additions & 5 deletions daemon/core/configservices/securityservices/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class VpnClient(ConfigService):
files: List[str] = ["vpnclient.sh"]
executables: List[str] = ["openvpn", "ip", "killall"]
dependencies: List[str] = []
startup: List[str] = ["sh vpnclient.sh"]
startup: List[str] = ["bash vpnclient.sh"]
validate: List[str] = ["pidof openvpn"]
shutdown: List[str] = ["killall openvpn"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -48,7 +48,7 @@ class VpnServer(ConfigService):
files: List[str] = ["vpnserver.sh"]
executables: List[str] = ["openvpn", "ip", "killall"]
dependencies: List[str] = []
startup: List[str] = ["sh vpnserver.sh"]
startup: List[str] = ["bash vpnserver.sh"]
validate: List[str] = ["pidof openvpn"]
shutdown: List[str] = ["killall openvpn"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -91,7 +91,7 @@ class IPsec(ConfigService):
files: List[str] = ["ipsec.sh"]
executables: List[str] = ["racoon", "ip", "setkey", "killall"]
dependencies: List[str] = []
startup: List[str] = ["sh ipsec.sh"]
startup: List[str] = ["bash ipsec.sh"]
validate: List[str] = ["pidof racoon"]
shutdown: List[str] = ["killall racoon"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -106,7 +106,7 @@ class Firewall(ConfigService):
files: List[str] = ["firewall.sh"]
executables: List[str] = ["iptables"]
dependencies: List[str] = []
startup: List[str] = ["sh firewall.sh"]
startup: List[str] = ["bash firewall.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -121,7 +121,7 @@ class Nat(ConfigService):
files: List[str] = ["nat.sh"]
executables: List[str] = ["iptables"]
dependencies: List[str] = []
startup: List[str] = ["sh nat.sh"]
startup: List[str] = ["bash nat.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down
18 changes: 9 additions & 9 deletions daemon/core/configservices/utilservices/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DefaultRouteService(ConfigService):
files: List[str] = ["defaultroute.sh"]
executables: List[str] = ["ip"]
dependencies: List[str] = []
startup: List[str] = ["sh defaultroute.sh"]
startup: List[str] = ["bash defaultroute.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -44,7 +44,7 @@ class DefaultMulticastRouteService(ConfigService):
files: List[str] = ["defaultmroute.sh"]
executables: List[str] = []
dependencies: List[str] = []
startup: List[str] = ["sh defaultmroute.sh"]
startup: List[str] = ["bash defaultmroute.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -66,7 +66,7 @@ class StaticRouteService(ConfigService):
files: List[str] = ["staticroute.sh"]
executables: List[str] = []
dependencies: List[str] = []
startup: List[str] = ["sh staticroute.sh"]
startup: List[str] = ["bash staticroute.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -94,7 +94,7 @@ class IpForwardService(ConfigService):
files: List[str] = ["ipforward.sh"]
executables: List[str] = ["sysctl"]
dependencies: List[str] = []
startup: List[str] = ["sh ipforward.sh"]
startup: List[str] = ["bash ipforward.sh"]
validate: List[str] = []
shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand All @@ -116,7 +116,7 @@ class SshService(ConfigService):
files: List[str] = ["startsshd.sh", "/etc/ssh/sshd_config"]
executables: List[str] = ["sshd"]
dependencies: List[str] = []
startup: List[str] = ["sh startsshd.sh"]
startup: List[str] = ["bash startsshd.sh"]
validate: List[str] = []
shutdown: List[str] = ["killall sshd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -164,7 +164,7 @@ class DhcpClientService(ConfigService):
files: List[str] = ["startdhcpclient.sh"]
executables: List[str] = ["dhclient"]
dependencies: List[str] = []
startup: List[str] = ["sh startdhcpclient.sh"]
startup: List[str] = ["bash startdhcpclient.sh"]
validate: List[str] = ["pidof dhclient"]
shutdown: List[str] = ["killall dhclient"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down Expand Up @@ -200,9 +200,9 @@ class PcapService(ConfigService):
files: List[str] = ["pcap.sh"]
executables: List[str] = ["tcpdump"]
dependencies: List[str] = []
startup: List[str] = ["sh pcap.sh start"]
startup: List[str] = ["bash pcap.sh start"]
validate: List[str] = ["pidof tcpdump"]
shutdown: List[str] = ["sh pcap.sh stop"]
shutdown: List[str] = ["bash pcap.sh stop"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
default_configs: List[Configuration] = []
modes: Dict[str, Dict[str, str]] = {}
Expand Down Expand Up @@ -249,7 +249,7 @@ class AtdService(ConfigService):
files: List[str] = ["startatd.sh"]
executables: List[str] = ["atd"]
dependencies: List[str] = []
startup: List[str] = ["sh startatd.sh"]
startup: List[str] = ["bash startatd.sh"]
validate: List[str] = ["pidof atd"]
shutdown: List[str] = ["pkill atd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
Expand Down
12 changes: 11 additions & 1 deletion daemon/core/executables.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List

BASH: str = "bash"
VNODED: str = "vnoded"
VCMD: str = "vcmd"
SYSCTL: str = "sysctl"
Expand All @@ -11,7 +12,16 @@
UMOUNT: str = "umount"
OVS_VSCTL: str = "ovs-vsctl"

COMMON_REQUIREMENTS: List[str] = [SYSCTL, IP, ETHTOOL, TC, EBTABLES, MOUNT, UMOUNT]
COMMON_REQUIREMENTS: List[str] = [
BASH,
EBTABLES,
ETHTOOL,
IP,
MOUNT,
SYSCTL,
TC,
UMOUNT,
]
VCMD_REQUIREMENTS: List[str] = [VNODED, VCMD]
OVS_REQUIREMENTS: List[str] = [OVS_VSCTL]

Expand Down
3 changes: 2 additions & 1 deletion daemon/core/location/mobility.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
RegisterTlvs,
)
from core.errors import CoreError
from core.executables import BASH
from core.nodes.base import CoreNode
from core.nodes.interface import CoreInterface
from core.nodes.network import WlanNode
Expand Down Expand Up @@ -1167,7 +1168,7 @@ def statescript(self, typestr: str) -> None:
if filename is None or filename == "":
return
filename = self.findfile(filename)
args = f"/bin/sh {filename} {typestr}"
args = f"{BASH} {filename} {typestr}"
utils.cmd(
args, cwd=self.session.session_dir, env=self.session.get_environment()
)
2 changes: 1 addition & 1 deletion daemon/core/nodes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str:
if self.server is None:
return self.client.check_cmd(args, wait=wait, shell=shell)
else:
args = self.client.create_cmd(args)
args = self.client.create_cmd(args, shell)
return self.server.remote_cmd(args, wait=wait)

def termcmdstring(self, sh: str = "/bin/sh") -> str:
Expand Down
8 changes: 5 additions & 3 deletions daemon/core/nodes/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from core import utils
from core.executables import VCMD
from core.executables import BASH, VCMD


class VnodeClient:
Expand Down Expand Up @@ -49,7 +49,9 @@ def close(self) -> None:
"""
pass

def create_cmd(self, args: str) -> str:
def create_cmd(self, args: str, shell: bool = False) -> str:
if shell:
args = f'{BASH} -c "{args}"'
return f"{VCMD} -c {self.ctrlchnlname} -- {args}"

def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str:
Expand All @@ -63,5 +65,5 @@ def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str:
:raises core.CoreCommandError: when there is a non-zero exit status
"""
self._verify_connection()
args = self.create_cmd(args)
args = self.create_cmd(args, shell)
return utils.cmd(args, wait=wait, shell=shell)
4 changes: 2 additions & 2 deletions daemon/core/nodes/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ def shutdown(self) -> None:
try:
self.node.node_net_client.device_flush(self.name)
except CoreCommandError:
logging.exception("error shutting down interface")
pass
if self.localname:
try:
self.net_client.delete_device(self.localname)
except CoreCommandError:
logging.info("link already removed: %s", self.localname)
pass
self.up = False


Expand Down
6 changes: 1 addition & 5 deletions daemon/core/nodes/netclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ def device_flush(self, device: str) -> None:
:param device: device to flush
:return: nothing
"""
self.run(
f"[ -e /sys/class/net/{device} ] && "
f"{IP} address flush dev {device} || true",
shell=True,
)
self.run(f"{IP} address flush dev {device}")

def device_mac(self, device: str, mac: str) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/services/emaneservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EmaneTransportService(CoreService):
dependencies: Tuple[str, ...] = ()
dirs: Tuple[str, ...] = ()
configs: Tuple[str, ...] = ("emanetransport.sh",)
startup: Tuple[str, ...] = (f"sh {configs[0]}",)
startup: Tuple[str, ...] = (f"bash {configs[0]}",)
validate: Tuple[str, ...] = (f"pidof {executables[0]}",)
validation_timer: float = 0.5
shutdown: Tuple[str, ...] = (f"killall {executables[0]}",)
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/services/frr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FRRZebra(CoreService):
"/usr/local/etc/frr/vtysh.conf",
"/usr/local/etc/frr/daemons",
)
startup: Tuple[str, ...] = ("sh frrboot.sh zebra",)
startup: Tuple[str, ...] = ("bash frrboot.sh zebra",)
shutdown: Tuple[str, ...] = ("killall zebra",)
validate: Tuple[str, ...] = ("pidof zebra",)

Expand Down
6 changes: 3 additions & 3 deletions daemon/core/services/nrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class NrlSmf(NrlService):

name: str = "SMF"
executables: Tuple[str, ...] = ("nrlsmf",)
startup: Tuple[str, ...] = ("sh startsmf.sh",)
startup: Tuple[str, ...] = ("bash startsmf.sh",)
shutdown: Tuple[str, ...] = ("killall nrlsmf",)
validate: Tuple[str, ...] = ("pidof nrlsmf",)
configs: Tuple[str, ...] = ("startsmf.sh",)
Expand Down Expand Up @@ -566,7 +566,7 @@ class MgenActor(NrlService):
group: str = "ProtoSvc"
executables: Tuple[str, ...] = ("mgen",)
configs: Tuple[str, ...] = ("start_mgen_actor.sh",)
startup: Tuple[str, ...] = ("sh start_mgen_actor.sh",)
startup: Tuple[str, ...] = ("bash start_mgen_actor.sh",)
validate: Tuple[str, ...] = ("pidof mgen",)
shutdown: Tuple[str, ...] = ("killall mgen",)

Expand Down Expand Up @@ -596,7 +596,7 @@ class Arouted(NrlService):
name: str = "arouted"
executables: Tuple[str, ...] = ("arouted",)
configs: Tuple[str, ...] = ("startarouted.sh",)
startup: Tuple[str, ...] = ("sh startarouted.sh",)
startup: Tuple[str, ...] = ("bash startarouted.sh",)
shutdown: Tuple[str, ...] = ("pkill arouted",)
validate: Tuple[str, ...] = ("pidof arouted",)

Expand Down
2 changes: 1 addition & 1 deletion daemon/core/services/quagga.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Zebra(CoreService):
"quaggaboot.sh",
"/usr/local/etc/quagga/vtysh.conf",
)
startup: Tuple[str, ...] = ("sh quaggaboot.sh zebra",)
startup: Tuple[str, ...] = ("bash quaggaboot.sh zebra",)
shutdown: Tuple[str, ...] = ("killall zebra",)
validate: Tuple[str, ...] = ("pidof zebra",)

Expand Down
Loading

0 comments on commit 1fdc5c5

Please sign in to comment.