From 7bbc2aef0ec3862ad0951ed13e29e73e7d35a4f2 Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Thu, 20 Oct 2016 18:06:23 -0400 Subject: [PATCH 01/20] daemon: Remove the SIGPIPE signal handler. Python installs a default signal handler for SIGPIPE that raises an exception. Let core-daemon handle the exception instead of exiting. --- daemon/sbin/core-daemon | 1 - 1 file changed, 1 deletion(-) 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) From 591de2cc9f42702c87b3262de050728800100306 Mon Sep 17 00:00:00 2001 From: Andrew Ahlers Date: Sat, 22 Oct 2016 21:14:16 -0400 Subject: [PATCH 02/20] Converted README to rst --- README => README.rst | 61 +++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 23 deletions(-) rename README => README.rst (50%) diff --git a/README b/README.rst similarity index 50% rename from README rename to README.rst index c3004eb0..e119377d 100644 --- a/README +++ b/README.rst @@ -1,9 +1,16 @@ +==== +CORE +==== CORE: Common Open Research Emulator + Copyright (c)2005-2013 the Boeing Company. + See the LICENSE file included in this distribution. -== ABOUT ======================================================================= +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 @@ -13,49 +20,57 @@ Google Code page (2) hosts a wiki, blog, bug tracker, and quickstart guide. 2. http://code.google.com/p/coreemu/ -== BUILDING CORE =============================================================== +Building CORE +============= To build this software you should use: - ./bootstrap.sh - ./configure - make - sudo make install + ./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 + /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 ================================================================ +Running CORE +============ First start the CORE services: - sudo /etc/init.d/core-daemon start + 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 + core-gui This launches the CORE GUI. You do not need to run the GUI as root. -== SUPPORT ===================================================================== + +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 + +- `core-users`_ for general comments and questions + +- `core-dev`_ for bugs, compile errors, and other development issues + + +.. _core-users: http://pf.itd.nrl.navy.mil/mailman/listinfo/core-users +.. _core-dev: http://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev From f80304384ab72a6dace1a0ffa42500ff5c9ccb16 Mon Sep 17 00:00:00 2001 From: Andrew Ahlers Date: Sat, 22 Oct 2016 21:18:17 -0400 Subject: [PATCH 03/20] Added direct link to manual --- README.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index e119377d..113fba6b 100644 --- a/README.rst +++ b/README.rst @@ -16,8 +16,13 @@ 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/ +1. http://www.nrl.navy.mil/itd/ncs/products/core + +2. http://code.google.com/p/coreemu/ + +3. `Official Documentation`_ + +.. _Official Documentation: http://downloads.pf.itd.nrl.navy.mil/docs/core/core-html/index.html Building CORE From cec880e6e28dd61dbf62b61a68c725384c42ee61 Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Thu, 22 Dec 2016 10:53:23 -0500 Subject: [PATCH 04/20] daemon: Add the EMANE TDMA model to the list of an available models. --- daemon/data/core.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/data/core.conf b/daemon/data/core.conf index 2479eda7..95750f43 100644 --- a/daemon/data/core.conf +++ b/daemon/data/core.conf @@ -57,7 +57,7 @@ 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 From 49c91a2a31bcf92889636b8030f1773448fac2a5 Mon Sep 17 00:00:00 2001 From: Kyle Jackson Date: Wed, 11 Jan 2017 09:24:41 -0500 Subject: [PATCH 05/20] [MRG] DOC typo in EMANE install instructions --- doc/emane.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From da33defa411e19cafdb7a36ff798b891afd56093 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Thu, 12 Jan 2017 14:14:41 -0500 Subject: [PATCH 06/20] systemd: remove limit on fork() branching factor On distributions using systemd, a default limit on the number of tasks allowed to be created from a given unit may be set by default (e.g., on F24, "DefaultTasksAccounting=yes" and "DefaultTasksMax=512" are set in /etc/systemd/system.conf. A large CORE simulation may well exceed that limit, at least during startup when many (sub)shell processes are generated using fork(). To avoid running into this limit, set "TasksMax=infinity" in the core-daemon.service unit file template. Signed-off-by: Gabriel Somlo --- scripts/core-daemon.service.in | 1 + 1 file changed, 1 insertion(+) 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 From 6609d2c394d3d64fab939fd489baa6153e0e4d8d Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Thu, 12 Jan 2017 16:40:45 -0500 Subject: [PATCH 07/20] daemon: streamline Quagga startup Currently, all Quagga daemons are started concurrently by their respective CORE services, using "quaggaboot.sh" generated by the 'zebra' service. However, all routing services depend on 'zebra' already running, and 'vtysh' depends on ALL other Quagga services before it can push configuration from the common "Quagga.conf" to all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh"). The spinwait+timeout based implementation of "waitforvtyfiles()" may, depending on load, give up too early and fail to configure all Quagga daemons. This patch streamlines the way Quagga daemons are started, by launching them all from the 'zebra' service. The correct sequence is to first launch the 'zebra' daemon itself, then proceed with all routing daemons, and finish with a call to "vtysh -b" which configures all running daemons. The list of all applicable daemons to launch is obtained using 'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used to discover which *.vty files to look for in /var/run/quagga/. The startup command for all services other than 'zebra' becomes empty, and "quaggaboot.sh" issues a warning on attempts to have it launch any other daemon. Signed-off-by: Gabriel Somlo --- daemon/core/services/quagga.py | 67 ++++++++++++---------------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index d045a502..e2892cdc 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -170,21 +170,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,53 +181,47 @@ 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 + 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" + 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) @@ -311,7 +290,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 +361,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 +465,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 +490,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 +513,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 +537,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 +567,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 @@ -622,7 +601,7 @@ class Vtysh(CoreService): _name = "vtysh" _group = "Quagga" _startindex = 45 - _startup = ("sh quaggaboot.sh vtysh",) + _startup = () _shutdown = () @classmethod From 3a34467e38cc276806fbcb3589f2c344b00869a2 Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Thu, 26 Jan 2017 09:13:47 -0800 Subject: [PATCH 08/20] update NRL links from http to https; freshen content; resolves #105 --- README.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 113fba6b..116671c9 100644 --- a/README.rst +++ b/README.rst @@ -13,16 +13,19 @@ 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. +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. http://code.google.com/p/coreemu/ +2. https://github.com/coreemu/core -3. `Official Documentation`_ +3. http://code.google.com/p/coreemu/ -.. _Official Documentation: http://downloads.pf.itd.nrl.navy.mil/docs/core/core-html/index.html +4. `Official Documentation`_ + +.. _Official Documentation: https://downloads.pf.itd.nrl.navy.mil/docs/core/core-html/index.html Building CORE @@ -75,7 +78,7 @@ If you have questions, comments, or trouble, please use the CORE mailing lists: - `core-dev`_ for bugs, compile errors, and other development issues -.. _core-users: http://pf.itd.nrl.navy.mil/mailman/listinfo/core-users -.. _core-dev: http://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev +.. _core-users: https://pf.itd.nrl.navy.mil/mailman/listinfo/core-users +.. _core-dev: https://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev From 33906aae9f518193a46fc459710eee6ecc16fdcb Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Fri, 13 Jan 2017 09:33:48 -0500 Subject: [PATCH 09/20] daemon: remove Quagga 'vtysh' service Since all Quagga daemons are configured from a consolidated location (the 'zebra' service), there is nothing left to do for a dedicated service such as 'vtysh'. This patch removes the service, along with all references to it from the rest of the source tree (sample *.imn files, examples, etc.) Signed-off-by: Gabriel Somlo --- daemon/core/misc/xmlparser1.py | 8 ++++---- daemon/core/services/quagga.py | 19 ------------------- daemon/core/xen/xen.py | 1 - daemon/examples/netns/emane80211.py | 2 +- daemon/examples/netns/howmanynodes.py | 2 +- daemon/ns3/examples/ns3wifirandomwalk.py | 2 +- doc/usage.rst | 4 ++-- gui/configs/sample1.imn | 2 +- gui/configs/sample10-kitchen-sink.imn | 4 ++-- gui/configs/sample3-bgp.imn | 16 ++++++++-------- gui/configs/sample4-nrlsmf.imn | 20 ++++++++++---------- gui/configs/sample5-mgen.imn | 4 ++-- gui/configs/sample8-ipsec-service.imn | 6 +++--- gui/nodes.tcl | 8 ++++---- gui/util.tcl | 2 +- 15 files changed, 40 insertions(+), 60 deletions(-) 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/services/quagga.py b/daemon/core/services/quagga.py index e2892cdc..381f4a56 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -30,7 +30,6 @@ 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") @@ -593,21 +592,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 = () - _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/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/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/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..93cabd4d 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"] From b1ea0574e58868437fe412b9b7378a5e1616fa01 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Fri, 13 Jan 2017 09:38:23 -0500 Subject: [PATCH 10/20] daemon: start Quagga with default user/group names Allow native distribution packages to run with their default user and group names by no longer forcing "-u root -g root" on any of the Quagga daemons' command lines. This should continue to allow hand-compiled and/or "side-loaded" Quagga software to run as root, if configured to do so at build time. Signed-off-by: Gabriel Somlo --- daemon/core/services/quagga.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index 381f4a56..914b9070 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -20,11 +20,6 @@ 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): ''' ''' @@ -139,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() { @@ -185,7 +178,7 @@ bootdaemon() 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 @@ -222,7 +215,7 @@ fi confcheck bootquagga """ % (cls._configs[0], quagga_sbin_search, quagga_bin_search, \ - QUAGGA_STATE_DIR, QUAGGA_USER, QUAGGA_GROUP) + QUAGGA_STATE_DIR) addservice(Zebra) From 798793ed876756da22806eb85e57009386579abc Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Wed, 8 Feb 2017 14:14:55 -0800 Subject: [PATCH 11/20] fix #24 Throughput Widget bug, now that hex interface numbers are used (cherry picked from commit e8d4d5397c86d9edd454870f71c6ee72ea728df2) --- gui/widget.tcl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/widget.tcl b/gui/widget.tcl index ed84ccf9..077ad95e 100644 --- a/gui/widget.tcl +++ b/gui/widget.tcl @@ -924,7 +924,8 @@ proc getstats_link_ifname { link } { # 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 hex [format "%x" $node_num] + set ifname "veth$hex\\.[string range $ifname 3 end]\\.*" return $ifname } From a70da2eb6122d787db5960c4d5725f886544e041 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Fri, 10 Feb 2017 11:31:44 -0500 Subject: [PATCH 12/20] rpm: include iproute-tc [Build]Requires for fedora >= 25 As of F25, the 'tc' command was moved to a separate sub-package of iproute, which must be included both at build- and run-time. Signed-off-by: Gabriel Somlo --- packaging/rpm/core.spec.in | 6 ++++++ 1 file changed, 6 insertions(+) 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 From c147d5b2f5faaa9d3210d4d481a5fc4905b76e95 Mon Sep 17 00:00:00 2001 From: adamson <> Date: Sat, 11 Feb 2017 15:52:03 +0000 Subject: [PATCH 13/20] added option Throughput widge to observe transmissions/receptions separately if desired --- gui/widget.tcl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gui/widget.tcl b/gui/widget.tcl index 077ad95e..19fe6d0b 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)] } { @@ -920,6 +932,7 @@ proc getstats_link_ifname { link } { set ifname [ifcByPeer $lnode2 $lnode1] } if { $node_num < 0 } { return "" } + set node_num [format %x $node_num] # TODO: need to determine session number used by daemon # instead this uses a '*' character for a regexp match against From 56896bddd14f0a3d415a9782f564452efa925167 Mon Sep 17 00:00:00 2001 From: adamson <> Date: Sun, 19 Feb 2017 17:55:31 +0000 Subject: [PATCH 14/20] fixed issue with indexing EMANE RJ45 objects --- daemon/core/emane/emane.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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] From 67117a3af342ada69779cadecf4f6678491af505 Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Fri, 24 Feb 2017 00:20:57 +0000 Subject: [PATCH 15/20] daemon: Improve importing custom services. This should help avoid python module name conflicts. --- daemon/core/service.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/daemon/core/service.py b/daemon/core/service.py index ddca4fc4..23d37699 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)) From e665a122b647f753481b3764073a3268037344d1 Mon Sep 17 00:00:00 2001 From: lbaumgaertner Date: Tue, 28 Mar 2017 12:00:24 +0200 Subject: [PATCH 16/20] fix to add correct broadcast address for ipv4 interfaces with netns backend --- daemon/core/netns/vnode.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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): From 724534e3acb691221b9bc0b89327533731497a60 Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Fri, 31 Mar 2017 09:55:26 -0700 Subject: [PATCH 17/20] fix broken Throughput Widget and Wireshark for node numbers above 10 this also fixes the Throughput Widget results when multiple sessions are running --- gui/editor.tcl | 9 +++++---- gui/widget.tcl | 10 ++++------ 2 files changed, 9 insertions(+), 10 deletions(-) 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/widget.tcl b/gui/widget.tcl index 19fe6d0b..12c40499 100644 --- a/gui/widget.tcl +++ b/gui/widget.tcl @@ -919,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] @@ -932,13 +933,10 @@ proc getstats_link_ifname { link } { set ifname [ifcByPeer $lnode2 $lnode1] } if { $node_num < 0 } { return "" } - set node_num [format %x $node_num] - - # 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 ssid [shortSessionID $g_current_session] set hex [format "%x" $node_num] - set ifname "veth$hex\\.[string range $ifname 3 end]\\.*" + set ifnum [string range $ifname 3 end] + set ifname "veth$hex.$ifnum.$ssid" return $ifname } From 0b0557e0088f92856a1d42bd9d9aca5ff72ca60b Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Fri, 31 Mar 2017 10:59:58 -0700 Subject: [PATCH 18/20] fix /var/run/quagga permissions for Ubuntu 16.04 --- daemon/core/services/quagga.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index 914b9070..7d57ae92 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -194,6 +194,12 @@ bootquagga() return 1 fi + # 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 From b4ce4e93702c9bb32b0db7a3d7123548f70700af Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Thu, 18 May 2017 21:36:45 +0000 Subject: [PATCH 19/20] gui: Fix using xfce4-terminal as the terminal program. --- gui/util.tcl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gui/util.tcl b/gui/util.tcl index 93cabd4d..204694b0 100644 --- a/gui/util.tcl +++ b/gui/util.tcl @@ -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" } From 17e4fc09336bdd0896c944a08236599a91fd2ba4 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Thu, 18 May 2017 18:39:19 -0400 Subject: [PATCH 20/20] Emit more descriptive error message if config file is incorrect --- daemon/core/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/core/service.py b/daemon/core/service.py index 23d37699..e6d5ee44 100644 --- a/daemon/core/service.py +++ b/daemon/core/service.py @@ -831,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":