diff --git a/README b/README deleted file mode 100644 index c3004eb0..00000000 --- a/README +++ /dev/null @@ -1,61 +0,0 @@ - -CORE: Common Open Research Emulator -Copyright (c)2005-2013 the Boeing Company. -See the LICENSE file included in this distribution. - -== ABOUT ======================================================================= -CORE is a tool for emulating networks using a GUI or Python scripts. The CORE -project site (1) is a good source of introductory information, with a manual, -screenshots, and demos about this software. Also a supplemental -Google Code page (2) hosts a wiki, blog, bug tracker, and quickstart guide. - - 1. http://www.nrl.navy.mil/itd/ncs/products/core - 2. http://code.google.com/p/coreemu/ - - -== BUILDING CORE =============================================================== - -To build this software you should use: - - ./bootstrap.sh - ./configure - make - sudo make install - -Here is what is installed with 'make install': - - /usr/local/bin/core-gui - /usr/local/sbin/core-daemon - /usr/local/sbin/[vcmd, vnoded, coresendmsg, core-cleanup.sh] - /usr/local/lib/core/* - /usr/local/share/core/* - /usr/local/lib/python2.6/dist-packages/core/* - /usr/local/lib/python2.6/dist-packages/[netns,vcmd].so - /etc/core/* - /etc/init.d/core - -See the manual for the software required for building CORE. - - -== RUNNING CORE ================================================================ - -First start the CORE services: - - sudo /etc/init.d/core-daemon start - -This automatically runs the core-daemon program. -Assuming the GUI is in your PATH, run the CORE GUI by typing the following: - - core-gui - -This launches the CORE GUI. You do not need to run the GUI as root. - -== SUPPORT ===================================================================== - -If you have questions, comments, or trouble, please use the CORE mailing lists: -- core-users for general comments and questions - http://pf.itd.nrl.navy.mil/mailman/listinfo/core-users -- core-dev for bugs, compile errors, and other development issues - http://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev - - diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..116671c9 --- /dev/null +++ b/README.rst @@ -0,0 +1,84 @@ +==== +CORE +==== + +CORE: Common Open Research Emulator + +Copyright (c)2005-2013 the Boeing Company. + +See the LICENSE file included in this distribution. + +About +===== + +CORE is a tool for emulating networks using a GUI or Python scripts. The CORE +project site (1) is a good source of introductory information, with a manual, +screenshots, and demos about this software. The GitHub project (2) hosts the +source repos, wiki, and bug tracker. There is a deprecated +Google Code page (3) with the old wiki, blog, bug tracker, and quickstart guide. + +1. http://www.nrl.navy.mil/itd/ncs/products/core + +2. https://github.com/coreemu/core + +3. http://code.google.com/p/coreemu/ + +4. `Official Documentation`_ + +.. _Official Documentation: https://downloads.pf.itd.nrl.navy.mil/docs/core/core-html/index.html + + +Building CORE +============= + +To build this software you should use: + + ./bootstrap.sh + ./configure + make + sudo make install + +Here is what is installed with 'make install': + + /usr/local/bin/core-gui + /usr/local/sbin/core-daemon + /usr/local/sbin/[vcmd, vnoded, coresendmsg, core-cleanup.sh] + /usr/local/lib/core/* + /usr/local/share/core/* + /usr/local/lib/python2.6/dist-packages/core/* + /usr/local/lib/python2.6/dist-packages/[netns,vcmd].so + /etc/core/* + /etc/init.d/core + +See the manual for the software required for building CORE. + + +Running CORE +============ + +First start the CORE services: + + sudo /etc/init.d/core-daemon start + +This automatically runs the core-daemon program. +Assuming the GUI is in your PATH, run the CORE GUI by typing the following: + + core-gui + +This launches the CORE GUI. You do not need to run the GUI as root. + + +Support +======= + +If you have questions, comments, or trouble, please use the CORE mailing lists: + +- `core-users`_ for general comments and questions + +- `core-dev`_ for bugs, compile errors, and other development issues + + +.. _core-users: https://pf.itd.nrl.navy.mil/mailman/listinfo/core-users +.. _core-dev: https://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev + + diff --git a/daemon/core/emane/emane.py b/daemon/core/emane/emane.py index 8765a916..671abfea 100644 --- a/daemon/core/emane/emane.py +++ b/daemon/core/emane/emane.py @@ -239,7 +239,9 @@ class Emane(ConfigurableManager): # Adamson change: first check for iface config keyed by "node:ifc.name" # (so that nodes w/ multiple interfaces of same conftype can have # different configs for each separate interface) - key = 1000*ifc.node.objid + ifc.netindex + key = 1000*ifc.node.objid + if ifc.netindex is not None: + key += ifc.netindex values = self.getconfig(key, conftype, None)[1] if not values: values = self.getconfig(ifc.node.objid, conftype, None)[1] diff --git a/daemon/core/misc/xmlparser1.py b/daemon/core/misc/xmlparser1.py index 8b0a22c1..88782917 100644 --- a/daemon/core/misc/xmlparser1.py +++ b/daemon/core/misc/xmlparser1.py @@ -911,12 +911,12 @@ class CoreDocumentParser1(object): def parse_default_services(self): # defaults from the CORE GUI self.default_services = { - 'router': ['zebra', 'OSPFv2', 'OSPFv3', 'vtysh', 'IPForward'], + 'router': ['zebra', 'OSPFv2', 'OSPFv3', 'IPForward'], 'host': ['DefaultRoute', 'SSH'], 'PC': ['DefaultRoute',], - 'mdr': ['zebra', 'OSPFv3MDR', 'vtysh', 'IPForward'], - # 'prouter': ['zebra', 'OSPFv2', 'OSPFv3', 'vtysh', 'IPForward'], - # 'xen': ['zebra', 'OSPFv2', 'OSPFv3', 'vtysh', 'IPForward'], + 'mdr': ['zebra', 'OSPFv3MDR', 'IPForward'], + # 'prouter': ['zebra', 'OSPFv2', 'OSPFv3', 'IPForward'], + # 'xen': ['zebra', 'OSPFv2', 'OSPFv3', 'IPForward'], } default_services = \ getFirstChildByTagName(self.scenario, 'CORE:defaultservices') diff --git a/daemon/core/netns/vnode.py b/daemon/core/netns/vnode.py index 44041cdc..9ec605af 100644 --- a/daemon/core/netns/vnode.py +++ b/daemon/core/netns/vnode.py @@ -225,8 +225,12 @@ class SimpleLxcNode(PyCoreNode): "error setting MAC address %s" % str(addr)) def addaddr(self, ifindex, addr): if self.up: - self.cmd([IP_BIN, "addr", "add", str(addr), - "dev", self.ifname(ifindex)]) + if ":" in str(addr): # check if addr is ipv6 + self.cmd([IP_BIN, "addr", "add", str(addr), + "dev", self.ifname(ifindex)]) + else: + self.cmd([IP_BIN, "addr", "add", str(addr), "broadcast", "+", + "dev", self.ifname(ifindex)]) self._netif[ifindex].addaddr(addr) def deladdr(self, ifindex, addr): diff --git a/daemon/core/service.py b/daemon/core/service.py index ddca4fc4..e6d5ee44 100644 --- a/daemon/core/service.py +++ b/daemon/core/service.py @@ -15,6 +15,7 @@ services. ''' import sys, os, shlex +import imp from itertools import repeat from core.api import coreapi @@ -47,9 +48,8 @@ class CoreServices(ConfigurableManager): _name = "services" _type = coreapi.CORE_TLV_REG_UTILITY - _invalid_custom_names = ('core', 'addons', 'api', 'bsd', 'emane', 'misc', - 'netns', 'phys', 'services', 'xen') - + service_path = set() + def __init__(self, session): ConfigurableManager.__init__(self, session) # dict of default services tuples, key is node type @@ -65,23 +65,34 @@ class CoreServices(ConfigurableManager): self.importcustom(path) self.isStartupService = startup.Startup.isStartupService + @classmethod + def add_service_path(cls, path): + cls.service_path.add(path) + def importcustom(self, path): ''' Import services from a myservices directory. ''' - if not path or len(path) == 0: + if not path or path in self.service_path: return if not os.path.isdir(path): self.session.warn("invalid custom service directory specified" \ ": %s" % path) return + self.add_service_path(path) try: parentdir, childdir = os.path.split(path) - if childdir in self._invalid_custom_names: - raise ValueError, "use a unique custom services dir name, " \ - "not '%s'" % childdir - if not parentdir in sys.path: - sys.path.append(parentdir) - exec("from %s import *" % childdir) + f, pathname, description = imp.find_module(childdir, [parentdir]) + name = 'core.services.custom.' + childdir + if name in sys.modules: + i = 1 + while name + str(i) in sys.modules: + i += 1 + name += str(i) + m = imp.load_module(name, f, pathname, description) + if hasattr(m, '__all__'): + for x in m.__all__: + f, pathname, description = imp.find_module(x, [path]) + imp.load_module(name + '.' + x, f, pathname, description) except Exception, e: self.session.warn("error importing custom services from " \ "%s:\n%s" % (path, e)) @@ -820,7 +831,7 @@ class CoreService(object): def setvalue(self, key, value): if key not in self.keys: - raise ValueError + raise ValueError('key `%s` not in `%s`' % (key, self.keys)) # this handles data conversion to int, string, and tuples if value: if key == "startidx": diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index d045a502..7d57ae92 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -20,17 +20,11 @@ from core.misc.ipaddr import IPv4Prefix, isIPv4Address, isIPv6Address from core.api import coreapi from core.constants import * -QUAGGA_USER="root" -QUAGGA_GROUP="root" -if os.uname()[0] == "FreeBSD": - QUAGGA_GROUP="wheel" - class Zebra(CoreService): ''' ''' _name = "zebra" _group = "Quagga" - _depends = ("vtysh", ) _dirs = ("/usr/local/etc/quagga", "/var/run/quagga") _configs = ("/usr/local/etc/quagga/Quagga.conf", "quaggaboot.sh","/usr/local/etc/quagga/vtysh.conf") @@ -140,8 +134,6 @@ QUAGGA_CONF=%s QUAGGA_SBIN_SEARCH=%s QUAGGA_BIN_SEARCH=%s QUAGGA_STATE_DIR=%s -QUAGGA_USER=%s -QUAGGA_GROUP=%s searchforprog() { @@ -170,21 +162,6 @@ confcheck() fi } -waitforvtyfiles() -{ - for f in "$@"; do - count=1 - until [ -e $QUAGGA_STATE_DIR/$f ]; do - if [ $count -eq 10 ]; then - echo "ERROR: vty file not found: $QUAGGA_STATE_DIR/$f" >&2 - return 1 - fi - sleep 0.1 - count=$(($count + 1)) - done - done -} - bootdaemon() { QUAGGA_SBIN_DIR=$(searchforprog $1 $QUAGGA_SBIN_SEARCH) @@ -196,55 +173,55 @@ bootdaemon() flags="" - if [ "$1" != "zebra" ]; then - waitforvtyfiles zebra.vty - fi - if [ "$1" = "xpimd" ] && \\ grep -E -q '^[[:space:]]*router[[:space:]]+pim6[[:space:]]*$' $QUAGGA_CONF; then flags="$flags -6" fi - $QUAGGA_SBIN_DIR/$1 $flags -u $QUAGGA_USER -g $QUAGGA_GROUP -d + $QUAGGA_SBIN_DIR/$1 $flags -d + if [ "$?" != "0" ]; then + echo "ERROR: Quagga's '$1' daemon failed to start!:" + return 1 + fi } -bootvtysh() +bootquagga() { - QUAGGA_BIN_DIR=$(searchforprog $1 $QUAGGA_BIN_SEARCH) + QUAGGA_BIN_DIR=$(searchforprog 'vtysh' $QUAGGA_BIN_SEARCH) if [ "z$QUAGGA_BIN_DIR" = "z" ]; then - echo "ERROR: Quagga's '$1' daemon not found in search path:" - echo " $QUAGGA_SBIN_SEARCH" + echo "ERROR: Quagga's 'vtysh' program not found in search path:" + echo " $QUAGGA_BIN_SEARCH" return 1 fi - vtyfiles="zebra.vty" + # fix /var/run/quagga permissions + id -u quagga 2>/dev/null >/dev/null + if [ "$?" = "0" ]; then + chown quagga $QUAGGA_STATE_DIR + fi + + bootdaemon "zebra" for r in rip ripng ospf6 ospf bgp babel; do if grep -q "^router \<${r}\>" $QUAGGA_CONF; then - vtyfiles="$vtyfiles ${r}d.vty" + bootdaemon "${r}d" fi done if grep -E -q '^[[:space:]]*router[[:space:]]+pim6?[[:space:]]*$' $QUAGGA_CONF; then - vtyfiles="$vtyfiles xpimd.vty" + bootdaemon "xpimd" fi - # wait for Quagga daemon vty files to appear before invoking vtysh - waitforvtyfiles $vtyfiles - $QUAGGA_BIN_DIR/vtysh -b } -confcheck -if [ "x$1" = "x" ]; then - echo "ERROR: missing the name of the Quagga daemon to boot" +if [ "$1" != "zebra" ]; then + echo "WARNING: '$1': all Quagga daemons are launched by the 'zebra' service!" exit 1 -elif [ "$1" = "vtysh" ]; then - bootvtysh $1 -else - bootdaemon $1 fi +confcheck +bootquagga """ % (cls._configs[0], quagga_sbin_search, quagga_bin_search, \ - QUAGGA_STATE_DIR, QUAGGA_USER, QUAGGA_GROUP) + QUAGGA_STATE_DIR) addservice(Zebra) @@ -311,7 +288,7 @@ class Ospfv2(QuaggaService): unified Quagga.conf file. ''' _name = "OSPFv2" - _startup = ("sh quaggaboot.sh ospfd",) + _startup = () _shutdown = ("killall ospfd", ) _validate = ("pidof ospfd", ) _ipv4_routing = True @@ -382,7 +359,7 @@ class Ospfv3(QuaggaService): unified Quagga.conf file. ''' _name = "OSPFv3" - _startup = ("sh quaggaboot.sh ospf6d",) + _startup = () _shutdown = ("killall ospf6d", ) _validate = ("pidof ospf6d", ) _ipv4_routing = True @@ -486,7 +463,7 @@ class Bgp(QuaggaService): having the same AS number. ''' _name = "BGP" - _startup = ("sh quaggaboot.sh bgpd",) + _startup = () _shutdown = ("killall bgpd", ) _validate = ("pidof bgpd", ) _custom_needed = True @@ -511,7 +488,7 @@ class Rip(QuaggaService): ''' The RIP service provides IPv4 routing for wired networks. ''' _name = "RIP" - _startup = ("sh quaggaboot.sh ripd",) + _startup = () _shutdown = ("killall ripd", ) _validate = ("pidof ripd", ) _ipv4_routing = True @@ -534,7 +511,7 @@ class Ripng(QuaggaService): ''' The RIP NG service provides IPv6 routing for wired networks. ''' _name = "RIPNG" - _startup = ("sh quaggaboot.sh ripngd",) + _startup = () _shutdown = ("killall ripngd", ) _validate = ("pidof ripngd", ) _ipv6_routing = True @@ -558,7 +535,7 @@ class Babel(QuaggaService): protocol for IPv6 and IPv4 with fast convergence properties. ''' _name = "Babel" - _startup = ("sh quaggaboot.sh babeld",) + _startup = () _shutdown = ("killall babeld", ) _validate = ("pidof babeld", ) _ipv6_routing = True @@ -588,7 +565,7 @@ class Xpimd(QuaggaService): PIM multicast routing based on XORP. ''' _name = 'Xpimd' - _startup = ('sh quaggaboot.sh xpimd',) + _startup = () _shutdown = ('killall xpimd', ) _validate = ('pidof xpimd', ) _ipv4_routing = True @@ -614,21 +591,3 @@ class Xpimd(QuaggaService): return ' ip mfea\n ip igmp\n ip pim\n' addservice(Xpimd) - -class Vtysh(CoreService): - ''' Simple service to run vtysh -b (boot) after all Quagga daemons have - started. - ''' - _name = "vtysh" - _group = "Quagga" - _startindex = 45 - _startup = ("sh quaggaboot.sh vtysh",) - _shutdown = () - - @classmethod - def generateconfig(cls, node, filename, services): - return "" - -addservice(Vtysh) - - diff --git a/daemon/core/xen/xen.py b/daemon/core/xen/xen.py index 68b5a64f..eae3f770 100644 --- a/daemon/core/xen/xen.py +++ b/daemon/core/xen/xen.py @@ -109,7 +109,6 @@ class XenNode(PyCoreNode): #'sh quaggaboot.sh zebra', #'sh quaggaboot.sh ospfd', #'sh quaggaboot.sh ospf6d', - 'sh quaggaboot.sh vtysh', 'killall zebra', 'killall ospfd', 'killall ospf6d', diff --git a/daemon/data/core.conf b/daemon/data/core.conf index fd927298..ebee4778 100644 --- a/daemon/data/core.conf +++ b/daemon/data/core.conf @@ -57,9 +57,9 @@ emane_platform_port = 8101 emane_transform_port = 8201 emane_event_generate = True emane_event_monitor = False -emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass +emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass, Tdma # EMANE log level range [0,4] default: 2 #emane_log_level = 2 emane_realtime = True -aux_request_handler = core.addons.api2handler.CoreApi2RequestHandler:12222 \ No newline at end of file +aux_request_handler = core.addons.api2handler.CoreApi2RequestHandler:12222 diff --git a/daemon/examples/netns/emane80211.py b/daemon/examples/netns/emane80211.py index 6868d49c..1a494721 100755 --- a/daemon/examples/netns/emane80211.py +++ b/daemon/examples/netns/emane80211.py @@ -70,7 +70,7 @@ def main(): values[ names.index('propagationmodel') ] = '2ray' session.emane.setconfig(wlan.objid, EmaneIeee80211abgModel._name, values) - services_str = "zebra|OSPFv3MDR|vtysh|IPForward" + services_str = "zebra|OSPFv3MDR|IPForward" print "creating %d nodes with addresses from %s" % \ (options.numnodes, prefix) diff --git a/daemon/examples/netns/howmanynodes.py b/daemon/examples/netns/howmanynodes.py index efafb107..ab3f94cc 100755 --- a/daemon/examples/netns/howmanynodes.py +++ b/daemon/examples/netns/howmanynodes.py @@ -97,7 +97,7 @@ def main(): parser.add_option("-s", "--services", dest = "services", type = str, help = "pipe-delimited list of services added to each " \ "node (default = %s)\n(Example: 'zebra|OSPFv2|OSPFv3|" \ - "vtysh|IPForward')" % parser.defaults["services"]) + "IPForward')" % parser.defaults["services"]) def usage(msg = None, err = 0): sys.stdout.write("\n") diff --git a/daemon/ns3/examples/ns3wifirandomwalk.py b/daemon/ns3/examples/ns3wifirandomwalk.py index a02eb69a..205b1157 100755 --- a/daemon/ns3/examples/ns3wifirandomwalk.py +++ b/daemon/ns3/examples/ns3wifirandomwalk.py @@ -66,7 +66,7 @@ def wifisession(opt): wifi.phy.Set("RxGain", ns.core.DoubleValue(18.0)) prefix = ipaddr.IPv4Prefix("10.0.0.0/16") - services_str = "zebra|OSPFv3MDR|vtysh|IPForward" + services_str = "zebra|OSPFv3MDR|IPForward" nodes = [] for i in xrange(1, opt.numnodes + 1): node = session.addnode(name = "n%d" % i) diff --git a/daemon/sbin/core-daemon b/daemon/sbin/core-daemon index f9126b16..2229c866 100755 --- a/daemon/sbin/core-daemon +++ b/daemon/sbin/core-daemon @@ -156,7 +156,6 @@ def sighandler(signum, stackframe): signal.signal(signal.SIGHUP, sighandler) signal.signal(signal.SIGINT, sighandler) -signal.signal(signal.SIGPIPE, sighandler) signal.signal(signal.SIGTERM, sighandler) signal.signal(signal.SIGUSR1, sighandler) signal.signal(signal.SIGUSR2, sighandler) diff --git a/doc/emane.rst b/doc/emane.rst index 18cf2243..b4da0c69 100644 --- a/doc/emane.rst +++ b/doc/emane.rst @@ -111,7 +111,7 @@ Here are quick instructions for installing all EMANE packages: :: # install dependencies - sudo apt-get install libssl-dev libxml-lixbml-perl libxml-simple-perl + sudo apt-get install libssl-dev libxml-libxml-perl libxml-simple-perl # download and install EMANE 0.8.1 export URL=http://downloads.pf.itd.nrl.navy.mil/emane/0.8.1-r2 wget $URL/emane-0.8.1-release-2.ubuntu-12_04.amd64.tgz diff --git a/doc/usage.rst b/doc/usage.rst index d0dc35cd..ec6e6028 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -1448,13 +1448,13 @@ Here are the default node types and their services: .. index:: Xen .. index:: physical nodes -* *router* - zebra, OSFPv2, OSPFv3, vtysh, and IPForward services for IGP +* *router* - zebra, OSFPv2, OSPFv3, and IPForward services for IGP link-state routing. * *host* - DefaultRoute and SSH services, representing an SSH server having a default route when connected directly to a router. * *PC* - DefaultRoute service for having a default route when connected directly to a router. -* *mdr* - zebra, OSPFv3MDR, vtysh, and IPForward services for +* *mdr* - zebra, OSPFv3MDR, and IPForward services for wireless-optimized MANET Designated Router routing. * *prouter* - a physical router, having the same default services as the *router* node type; for incorporating Linux testbed machines into an diff --git a/gui/configs/sample1.imn b/gui/configs/sample1.imn index c394bbe6..912f1e71 100644 --- a/gui/configs/sample1.imn +++ b/gui/configs/sample1.imn @@ -105,7 +105,7 @@ node n5 { labelcoords {540.0 376.0} interface-peer {eth0 n10} interface-peer {eth1 n15} - services {zebra OSPFv2 OSPFv3MDR vtysh IPForward} + services {zebra OSPFv2 OSPFv3MDR IPForward} custom-config { custom-config-id service:zebra custom-command zebra diff --git a/gui/configs/sample10-kitchen-sink.imn b/gui/configs/sample10-kitchen-sink.imn index a9e21a4a..d5463952 100644 --- a/gui/configs/sample10-kitchen-sink.imn +++ b/gui/configs/sample10-kitchen-sink.imn @@ -283,7 +283,7 @@ node n11 { } } - services {zebra OSPFv2 OSPFv3MDR vtysh IPForward} + services {zebra OSPFv2 OSPFv3MDR IPForward} } node n12 { @@ -517,7 +517,7 @@ node n20 { } } - services {zebra OSPFv2 OSPFv3MDR vtysh IPForward} + services {zebra OSPFv2 OSPFv3MDR IPForward} } node n21 { diff --git a/gui/configs/sample3-bgp.imn b/gui/configs/sample3-bgp.imn index f782585e..d4a396ae 100644 --- a/gui/configs/sample3-bgp.imn +++ b/gui/configs/sample3-bgp.imn @@ -20,7 +20,7 @@ node n1 { interface-peer {eth1 n2} interface-peer {eth2 n3} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -82,7 +82,7 @@ node n2 { interface-peer {eth1 n16} interface-peer {eth2 n6} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -140,7 +140,7 @@ node n3 { interface-peer {eth0 n4} interface-peer {eth1 n1} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -197,7 +197,7 @@ node n4 { interface-peer {eth0 n3} interface-peer {eth1 n7} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -258,7 +258,7 @@ node n5 { interface-peer {eth0 n7} interface-peer {eth1 n6} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -323,7 +323,7 @@ node n6 { interface-peer {eth0 n5} interface-peer {eth1 n2} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -376,7 +376,7 @@ node n7 { interface-peer {eth0 n5} interface-peer {eth1 n4} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf @@ -555,7 +555,7 @@ node n16 { interface-peer {eth0 n1} interface-peer {eth1 n2} canvas c1 - services {zebra BGP vtysh IPForward} + services {zebra BGP IPForward} custom-config { custom-config-id service:zebra:/usr/local/etc/quagga/Quagga.conf custom-command /usr/local/etc/quagga/Quagga.conf diff --git a/gui/configs/sample4-nrlsmf.imn b/gui/configs/sample4-nrlsmf.imn index a1b08b53..165c424f 100644 --- a/gui/configs/sample4-nrlsmf.imn +++ b/gui/configs/sample4-nrlsmf.imn @@ -65,7 +65,7 @@ node n1 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_green.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -101,7 +101,7 @@ node n2 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_green.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -137,7 +137,7 @@ node n3 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_green.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -173,7 +173,7 @@ node n4 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_green.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -209,7 +209,7 @@ node n5 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_green.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -245,7 +245,7 @@ node n6 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -281,7 +281,7 @@ node n7 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -317,7 +317,7 @@ node n8 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -353,7 +353,7 @@ node n9 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh @@ -389,7 +389,7 @@ node n10 { canvas c1 interface-peer {eth0 n11} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif - services {zebra OSPFv3MDR vtysh SMF IPForward UserDefined} + services {zebra OSPFv3MDR SMF IPForward UserDefined} custom-config { custom-config-id service:UserDefined:custom-post-config-commands.sh custom-command custom-post-config-commands.sh diff --git a/gui/configs/sample5-mgen.imn b/gui/configs/sample5-mgen.imn index 925266c4..e27b55a7 100644 --- a/gui/configs/sample5-mgen.imn +++ b/gui/configs/sample5-mgen.imn @@ -51,7 +51,7 @@ node n1 { cmdup=('sh mgen.sh', ) } } - services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined} + services {zebra OSPFv2 OSPFv3 IPForward UserDefined} } node n2 { @@ -101,7 +101,7 @@ node n2 { mgen input send_$HN.mgn output $LOGDIR/mgen_$HN.log > /dev/null 2> /dev/null < /dev/null & } } - services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined} + services {zebra OSPFv2 OSPFv3 IPForward UserDefined} } link l1 { diff --git a/gui/configs/sample8-ipsec-service.imn b/gui/configs/sample8-ipsec-service.imn index d1274c6f..ba409185 100644 --- a/gui/configs/sample8-ipsec-service.imn +++ b/gui/configs/sample8-ipsec-service.imn @@ -354,7 +354,7 @@ node n1 { } } - services {zebra OSPFv2 OSPFv3 vtysh IPForward IPsec} + services {zebra OSPFv2 OSPFv3 IPForward IPsec} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif } @@ -528,7 +528,7 @@ node n2 { } } - services {zebra OSPFv2 OSPFv3 vtysh IPForward IPsec} + services {zebra OSPFv2 OSPFv3 IPForward IPsec} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif } @@ -697,7 +697,7 @@ node n3 { } } - services {zebra OSPFv2 OSPFv3 vtysh IPForward IPsec} + services {zebra OSPFv2 OSPFv3 IPForward IPsec} custom-image $CORE_DATA_DIR/icons/normal/router_red.gif } diff --git a/gui/editor.tcl b/gui/editor.tcl index c451c1e7..a69ec4f8 100644 --- a/gui/editor.tcl +++ b/gui/editor.tcl @@ -1475,7 +1475,7 @@ proc addInterfaceCommand { node parentmenu txt cmd state isnodecmd } { $parentmenu add cascade -label $txt -menu $childmenu -state $state if { ! $isnodecmd } { if { $g_current_session == 0 } { set state disabled } - set ssid [shortSessionID $g_current_session] + set ssid [shortSessionID $g_current_session] } foreach ifc [ifcList $node] { set addr [lindex [getIfcIPv4addr $node $ifc] 0] @@ -1483,10 +1483,11 @@ proc addInterfaceCommand { node parentmenu txt cmd state isnodecmd } { if { $isnodecmd } { ;# run command in a node set icmd "spawnShell $node \"$cmd $ifc\"" } else { ;# exec a command directly - set nodenum [string range $node 1 end] + set node_num [string range $node 1 end] + set hex [format "%x" $node_num] set ifnum [string range $ifc 3 end] - set localifc veth$nodenum.$ifnum.$ssid - set icmd "exec $cmd $localifc &" + set ifname "veth$hex\\.$ifnum\\.$ssid" + set icmd "exec $cmd $ifname &" } $childmenu add command -label "$ifc$addr" -state $state -command $icmd } diff --git a/gui/nodes.tcl b/gui/nodes.tcl index a86ae345..7fd65e57 100644 --- a/gui/nodes.tcl +++ b/gui/nodes.tcl @@ -15,18 +15,18 @@ if { $execMode == "interactive" } { # these are the default node types when nodes.conf does not exist # index {name normal-icon tiny-icon services type metadata} array set g_node_types_default { - 1 {router router.gif router.gif {zebra OSPFv2 OSPFv3 vtysh IPForward} \ + 1 {router router.gif router.gif {zebra OSPFv2 OSPFv3 IPForward} \ netns {built-in type for routing}} 2 {host host.gif host.gif {DefaultRoute SSH} \ netns {built-in type for servers}} 3 {PC pc.gif pc.gif {DefaultRoute} \ netns {built-in type for end hosts}} - 4 {mdr mdr.gif mdr.gif {zebra OSPFv3MDR vtysh IPForward} \ + 4 {mdr mdr.gif mdr.gif {zebra OSPFv3MDR IPForward} \ netns {built-in type for wireless routers}} 5 {prouter router_green.gif router_green.gif \ - {zebra OSPFv2 OSPFv3 vtysh IPForward} \ + {zebra OSPFv2 OSPFv3 IPForward} \ physical {built-in type for physical nodes}} - 6 {xen xen.gif xen.gif {zebra OSPFv2 OSPFv3 vtysh IPForward} \ + 6 {xen xen.gif xen.gif {zebra OSPFv2 OSPFv3 IPForward} \ xen {built-in type for Xen PVM domU router}} } diff --git a/gui/util.tcl b/gui/util.tcl index 88c7cb3b..204694b0 100644 --- a/gui/util.tcl +++ b/gui/util.tcl @@ -160,7 +160,7 @@ proc upgradeNetworkConfigToServices { } { set bgp [netconfFetchSection $node "router bgp"] if { $ospfv2 != "" || $ospfv3 != "" || $rip != "" || $ripng != "" } { set cfg "" - set services "zebra vtysh IPForward" + set services "zebra IPForward" foreach ifc [ifcList $node] { lappend cfg "interface $ifc" set ifccfg [netconfFetchSection $node "interface $ifc"] @@ -1113,7 +1113,7 @@ proc get_text_editor { want_default } { # variable, then find the first in the list of terminals that exists on the # system set TERMS "{gnome-terminal -x} {lxterminal -e} {konsole -e} {xterm -e}" -set TERMS "$TERMS {aterm -e} {eterm -e} {rxvt -e} {xfce4-terminal -e}" +set TERMS "$TERMS {aterm -e} {eterm -e} {rxvt -e} {xfce4-terminal -x}" proc get_term_prog { want_default } { global g_prefs env TERMS @@ -1130,8 +1130,13 @@ proc get_term_prog { want_default } { } if { $term != "" } { set arg "-e" - # gnome-terminal has problem w/subsequent arguments after -e, needs -x - if { [file tail $term] == "gnome-terminal" } { set arg "-x" } + # gnome-terminal and xfce4-terminal have problems w/subsequent + # arguments after -e, needs -x + set basename [file tail $term] + if {[lsearch -exact \ + {"gnome-terminal" "xfce4-terminal"} $basename] >= 0} { + set arg "-x" + } set term "$term $arg" } diff --git a/gui/widget.tcl b/gui/widget.tcl index ed84ccf9..12c40499 100644 --- a/gui/widget.tcl +++ b/gui/widget.tcl @@ -572,7 +572,7 @@ proc exec_observer_callback { node execnum cmd result status } { ##### ##### ################################################################################ -array set thruConfig { show 1 avg 1 thresh 250.0 width 10 color #FF0000 } +array set thruConfig { show 1 up 1 down 1 avg 1 thresh 250.0 width 10 color #FF0000 } # netgraph names of pipe nodes array set throughput_cache { } @@ -597,7 +597,12 @@ proc widget_thru_config {} { checkbutton $wi.tlab.avg \ -text "Use exponentially weighted moving average" \ -variable thruConfig(avg) - pack $wi.tlab.show_thru $wi.tlab.avg -side top -anchor w -padx 4 + checkbutton $wi.tlab.down \ + -text "Include transmissions" -variable thruConfig(down) + checkbutton $wi.tlab.up \ + -text "Include receptions" -variable thruConfig(up) + pack $wi.tlab.show_thru $wi.tlab.avg $wi.tlab.down \ + $wi.tlab.up -side top -anchor w -padx 4 pack $wi.tlab -side top frame $wi.msg -borderwidth 4 @@ -807,7 +812,14 @@ proc widget_thru_periodic { now } { set div [expr { (1000.0 / 8.0) * $dt }] set kbps_down [expr { ([lindex $bytes 0]-[lindex $bytes2 0]) / $div }] set kbps_up [expr { ([lindex $bytes 1]-[lindex $bytes2 1]) / $div }] - set kbps [expr {$kbps_down + $kbps_up}] + set kbps 0.0 + if { $thruConfig(up) } { + set kbps [expr {$kbps + $kbps_up}] + } + if { $thruConfig(down) } { + set kbps [expr {$kbps + $kbps_down}] + } + #set kbps [expr {$kbps_down + $kbps_up}] if { $thruConfig(avg) } { if { ![info exists link_thru_avg_stats($key)] } { @@ -907,6 +919,7 @@ proc getstats_bytes_netgraph { raw_input } { } proc getstats_link_ifname { link } { + global g_current_session set lnode1 [lindex [linkPeers $link] 0] set lnode2 [lindex [linkPeers $link] 1] @@ -920,11 +933,10 @@ proc getstats_link_ifname { link } { set ifname [ifcByPeer $lnode2 $lnode1] } if { $node_num < 0 } { return "" } - - # TODO: need to determine session number used by daemon - # instead this uses a '*' character for a regexp match against - # the interfaces in /proc/net/dev - set ifname "veth$node_num\\.[string range $ifname 3 end]\\.*" + set ssid [shortSessionID $g_current_session] + set hex [format "%x" $node_num] + set ifnum [string range $ifname 3 end] + set ifname "veth$hex.$ifnum.$ssid" return $ifname } diff --git a/packaging/rpm/core.spec.in b/packaging/rpm/core.spec.in index 1a2cc9e3..7cf28a7b 100644 --- a/packaging/rpm/core.spec.in +++ b/packaging/rpm/core.spec.in @@ -32,12 +32,18 @@ Requires: procps-ng %if %{with_kernel_modules_extra} Requires: kernel-modules-extra %endif +%if 0%{?fedora} >= 25 +Requires: iproute-tc +%endif BuildRequires: make automake autoconf libev-devel python-devel bridge-utils ebtables iproute net-tools ImageMagick help2man %if 0%{?el6} BuildRequires: procps %else BuildRequires: procps-ng %endif +%if 0%{?fedora} >= 25 +BuildRequires: iproute-tc +%endif Provides: core-daemon # python-sphinx %description daemon diff --git a/scripts/core-daemon.service.in b/scripts/core-daemon.service.in index 657c160f..b0c4a7f2 100644 --- a/scripts/core-daemon.service.in +++ b/scripts/core-daemon.service.in @@ -6,6 +6,7 @@ After=network.target Type=forking PIDFile=/var/run/core-daemon.pid ExecStart=@PYTHON@ @SBINDIR@/core-daemon -d +TasksMax=infinity [Install] WantedBy=multi-user.target