removed usage of brctl and dependency on bridge-utils library as it is deprecated, replaced with using iproute instead

This commit is contained in:
Blake Harnden 2019-12-23 14:48:56 -08:00
parent 8029a27bb4
commit fe8bc6f10e
8 changed files with 30 additions and 44 deletions

View file

@ -60,7 +60,6 @@ fpm -s dir -t rpm -n core \
-d "tk" \ -d "tk" \
-d "procps-ng" \ -d "procps-ng" \
-d "bash >= 3.0" \ -d "bash >= 3.0" \
-d "bridge-utils" \
-d "ebtables" \ -d "ebtables" \
-d "iproute" \ -d "iproute" \
-d "libev" \ -d "libev" \
@ -88,7 +87,6 @@ fpm -s dir -t deb -n core \
-d "procps" \ -d "procps" \
-d "libc6 >= 2.14" \ -d "libc6 >= 2.14" \
-d "bash >= 3.0" \ -d "bash >= 3.0" \
-d "bridge-utils" \
-d "ebtables" \ -d "ebtables" \
-d "iproute2" \ -d "iproute2" \
-d "libev4" \ -d "libev4" \
@ -128,7 +126,6 @@ $(info creating file $1 from $1.in)
-e 's,[@]CORE_DATA_DIR[@],$(CORE_DATA_DIR),g' \ -e 's,[@]CORE_DATA_DIR[@],$(CORE_DATA_DIR),g' \
-e 's,[@]CORE_CONF_DIR[@],$(CORE_CONF_DIR),g' \ -e 's,[@]CORE_CONF_DIR[@],$(CORE_CONF_DIR),g' \
-e 's,[@]CORE_GUI_CONF_DIR[@],$(CORE_GUI_CONF_DIR),g' \ -e 's,[@]CORE_GUI_CONF_DIR[@],$(CORE_GUI_CONF_DIR),g' \
-e 's,[@]brctl_path[@],$(brctl_path),g' \
-e 's,[@]sysctl_path[@],$(sysctl_path),g' \ -e 's,[@]sysctl_path[@],$(sysctl_path),g' \
-e 's,[@]ip_path[@],$(ip_path),g' \ -e 's,[@]ip_path[@],$(ip_path),g' \
-e 's,[@]tc_path[@],$(tc_path),g' \ -e 's,[@]tc_path[@],$(tc_path),g' \

View file

@ -113,11 +113,6 @@ if test "x$enable_daemon" = "xyes"; then
AM_PATH_PYTHON(3.6) AM_PATH_PYTHON(3.6)
AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])]) AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])])
AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH)
if test "x$brctl_path" = "xno" ; then
AC_MSG_ERROR([Could not locate brctl (from bridge-utils package).])
fi
AC_CHECK_PROG(sysctl_path, sysctl, $as_dir, no, $SEARCHPATH) AC_CHECK_PROG(sysctl_path, sysctl, $as_dir, no, $SEARCHPATH)
if test "x$sysctl_path" = "xno" ; then if test "x$sysctl_path" = "xno" ; then
AC_MSG_ERROR([Could not locate sysctl (from procps package).]) AC_MSG_ERROR([Could not locate sysctl (from procps package).])

View file

@ -8,7 +8,6 @@ FRR_STATE_DIR = "@CORE_STATE_DIR@/run/frr"
VNODED_BIN = which("vnoded", required=True) VNODED_BIN = which("vnoded", required=True)
VCMD_BIN = which("vcmd", required=True) VCMD_BIN = which("vcmd", required=True)
BRCTL_BIN = which("brctl", required=True)
SYSCTL_BIN = which("sysctl", required=True) SYSCTL_BIN = which("sysctl", required=True)
IP_BIN = which("ip", required=True) IP_BIN = which("ip", required=True)
ETHTOOL_BIN = which("ethtool", required=True) ETHTOOL_BIN = which("ethtool", required=True)

View file

@ -1,8 +1,9 @@
""" """
Clients for dealing with bridge/interface commands. Clients for dealing with bridge/interface commands.
""" """
import json
from core.constants import BRCTL_BIN, ETHTOOL_BIN, IP_BIN, OVS_BIN, TC_BIN from core.constants import ETHTOOL_BIN, IP_BIN, OVS_BIN, TC_BIN
def get_net_client(use_ovs, run): def get_net_client(use_ovs, run):
@ -231,17 +232,12 @@ class LinuxNetClient:
:param str name: bridge name :param str name: bridge name
:return: nothing :return: nothing
""" """
self.run(f"{BRCTL_BIN} addbr {name}") self.run(f"{IP_BIN} link add name {name} type bridge")
self.run(f"{BRCTL_BIN} stp {name} off") self.run(f"{IP_BIN} link set {name} type bridge stp_state 0")
self.run(f"{BRCTL_BIN} setfd {name} 0") self.run(f"{IP_BIN} link set {name} type bridge forward_delay 0")
self.run(f"{IP_BIN} link set {name} type bridge mcast_snooping 0")
self.device_up(name) self.device_up(name)
# turn off multicast snooping so forwarding occurs w/o IGMP joins
snoop_file = "multicast_snooping"
snoop = f"/sys/devices/virtual/net/{name}/bridge/{snoop_file}"
self.run(f"echo 0 > /tmp/{snoop_file}", shell=True)
self.run(f"cp /tmp/{snoop_file} {snoop}")
def delete_bridge(self, name): def delete_bridge(self, name):
""" """
Bring down and delete a Linux bridge. Bring down and delete a Linux bridge.
@ -250,7 +246,7 @@ class LinuxNetClient:
:return: nothing :return: nothing
""" """
self.device_down(name) self.device_down(name)
self.run(f"{BRCTL_BIN} delbr {name}") self.run(f"{IP_BIN} link delete {name} type bridge")
def create_interface(self, bridge_name, interface_name): def create_interface(self, bridge_name, interface_name):
""" """
@ -260,7 +256,7 @@ class LinuxNetClient:
:param str interface_name: interface name :param str interface_name: interface name
:return: nothing :return: nothing
""" """
self.run(f"{BRCTL_BIN} addif {bridge_name} {interface_name}") self.run(f"{IP_BIN} link set dev {interface_name} master {bridge_name}")
self.device_up(interface_name) self.device_up(interface_name)
def delete_interface(self, bridge_name, interface_name): def delete_interface(self, bridge_name, interface_name):
@ -271,7 +267,7 @@ class LinuxNetClient:
:param str interface_name: interface name :param str interface_name: interface name
:return: nothing :return: nothing
""" """
self.run(f"{BRCTL_BIN} delif {bridge_name} {interface_name}") self.run(f"{IP_BIN} link set dev {interface_name} nomaster")
def existing_bridges(self, _id): def existing_bridges(self, _id):
""" """
@ -279,11 +275,10 @@ class LinuxNetClient:
:param _id: node id to check bridges for :param _id: node id to check bridges for
""" """
output = self.run(f"{BRCTL_BIN} show") output = self.run(f"{IP_BIN} -j link show type bridge")
lines = output.split("\n") bridges = json.loads(output)
for line in lines[1:]: for bridge in bridges:
columns = line.split() name = bridge["ifname"]
name = columns[0]
fields = name.split(".") fields = name.split(".")
if len(fields) != 3: if len(fields) != 3:
continue continue
@ -298,7 +293,7 @@ class LinuxNetClient:
:param str name: bridge name :param str name: bridge name
:return: nothing :return: nothing
""" """
self.run(f"{BRCTL_BIN} setageing {name} 0") self.run(f"{IP_BIN} link set {name} type bridge ageing_time 0")
class OvsNetClient(LinuxNetClient): class OvsNetClient(LinuxNetClient):

View file

@ -26,7 +26,7 @@ the core-daemon for development based on Ubuntu 18.04.
### Install Dependencies ### Install Dependencies
```shell ```shell
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk \ sudo apt install -y automake pkg-config gcc libev-dev ebtables gawk \
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
``` ```
@ -188,7 +188,7 @@ Here are some other Linux commands that are useful for managing the Linux networ
```shell ```shell
# view the Linux bridging setup # view the Linux bridging setup
brctl show ip link show type bridge
# view the netem rules used for applying link effects # view the netem rules used for applying link effects
tc qdisc show tc qdisc show
# view the rules that make the wireless LAN work # view the rules that make the wireless LAN work

View file

@ -218,26 +218,26 @@ python3 -m pip install grpcio-tools
### Ubuntu 18.04 Requirements ### Ubuntu 18.04 Requirements
```shell ```shell
sudo apt install automake pkg-config gcc libev-dev bridge-utils ebtables python3-dev python3-setuptools tk libtk-img ethtool sudo apt install automake pkg-config gcc libev-dev ebtables python3-dev python3-setuptools tk libtk-img ethtool
``` ```
### Ubuntu 16.04 Requirements ### Ubuntu 16.04 Requirements
```shell ```shell
sudo apt-get install automake bridge-utils ebtables python3-dev libev-dev python3-setuptools libtk-img ethtool sudo apt-get install automake ebtables python3-dev libev-dev python3-setuptools libtk-img ethtool
``` ```
### CentOS 7 with Gnome Desktop Requirements ### CentOS 7 with Gnome Desktop Requirements
```shell ```shell
sudo yum -y install automake gcc python3-devel python3-devel libev-devel tk ethtool sudo yum -y install automake gcc python36 python36-devel libev-devel tk ethtool
``` ```
## Build and Install ## Build and Install
```shell ```shell
./bootstrap.sh ./bootstrap.sh
PYTHON=python3 ./configure ./configure
make make
sudo make install sudo make install
``` ```
@ -251,7 +251,7 @@ sudo apt install python3-sphinx
sudo yum install python3-sphinx sudo yum install python3-sphinx
./bootstrap.sh ./bootstrap.sh
PYTHON=python3 ./configure ./configure
make doc make doc
``` ```
@ -264,7 +264,7 @@ Build package commands, DESTDIR is used to make install into and then for packag
```shell ```shell
./bootstrap.sh ./bootstrap.sh
PYTHON=python3 ./configure ./configure
make make
mkdir /tmp/core-build mkdir /tmp/core-build
make fpm DESTDIR=/tmp/core-build make fpm DESTDIR=/tmp/core-build

View file

@ -15,7 +15,7 @@ CORE can be used via the GUI or [Python_Scripting](scripting.md). Often the GUI
The following image shows the various phases of a CORE session: The following image shows the various phases of a CORE session:
![](static/core-workflow.jpg) ![](static/core-workflow.jpg)
After pressing the start button, CORE will proceed through these phases, staying in the **runtime** phase. After the session is stopped, CORE will proceed to the **data collection** phase before tearing down the emulated state. After pressing the start button, CORE will proceed through these phases, staying in the **runtime** phase. After the session is stopped, CORE will proceed to the **data collection** phase before tearing down the emulated state.
CORE can be customized to perform any action at each phase in the workflow above. See the *Hooks...* entry on the **Session Menu** for details about when these session states are reached. CORE can be customized to perform any action at each phase in the workflow above. See the *Hooks...* entry on the **Session Menu** for details about when these session states are reached.
@ -33,7 +33,7 @@ sudo systemctl start core-daemon
sudo service core-daemon start sudo service core-daemon start
``` ```
You can also invoke the daemon directly from the command line, which can be useful if you'd like to see the logging output directly. You can also invoke the daemon directly from the command line, which can be useful if you'd like to see the logging output directly.
``` ```
# direct invocation # direct invocation
sudo core-daemon sudo core-daemon
@ -94,7 +94,7 @@ When CORE is in Edit mode (the default), the vertical Editing Toolbar exists on
| ![alt text](../gui/icons/tiny/rj45.gif) *RJ45* | with the RJ45 Physical Interface Tool, emulated nodes can be linked to real physical interfaces; using this tool, real networks and devices can be physically connected to the live-running emulation. | | ![alt text](../gui/icons/tiny/rj45.gif) *RJ45* | with the RJ45 Physical Interface Tool, emulated nodes can be linked to real physical interfaces; using this tool, real networks and devices can be physically connected to the live-running emulation. |
| ![alt text](../gui/icons/tiny/tunnel.gif) *Tunnel* | the Tunnel Tool allows connecting together more than one CORE emulation using GRE tunnels. | | ![alt text](../gui/icons/tiny/tunnel.gif) *Tunnel* | the Tunnel Tool allows connecting together more than one CORE emulation using GRE tunnels. |
### Anotation Tools ### Anotation Tools
| Tool | Functionality | | Tool | Functionality |
|---|---| |---|---|
@ -206,7 +206,7 @@ The tools menu lists different utility functions.
|---|---| |---|---|
| *Random* | nodes are randomly placed about the canvas, but are not linked together. This can be used in conjunction with a WLAN node to quickly create a wireless network. | | *Random* | nodes are randomly placed about the canvas, but are not linked together. This can be used in conjunction with a WLAN node to quickly create a wireless network. |
| *Grid* | nodes are placed in horizontal rows starting in the upper-left corner, evenly spaced to the right; nodes are not linked to each other. | | *Grid* | nodes are placed in horizontal rows starting in the upper-left corner, evenly spaced to the right; nodes are not linked to each other. |
| *Connected Grid* | nodes are placed in an N x M (width and height) rectangular grid, and each node is linked to the node above, below, left and right of itself. | | *Connected Grid* | nodes are placed in an N x M (width and height) rectangular grid, and each node is linked to the node above, below, left and right of itself. |
| *Chain* | nodes are linked together one after the other in a chain. | | *Chain* | nodes are linked together one after the other in a chain. |
| *Star* | one node is placed in the center with N nodes surrounding it in a circular pattern, with each node linked to the center node. | | *Star* | one node is placed in the center with N nodes surrounding it in a circular pattern, with each node linked to the center node. |
| *Cycle* | nodes are arranged in a circular pattern with every node connected to its neighbor to form a closed circular path. | | *Cycle* | nodes are arranged in a circular pattern with every node connected to its neighbor to form a closed circular path. |
@ -464,7 +464,7 @@ to **dummy0**, and link this to a node in your scenario. After starting the
session, configure an address on the host. session, configure an address on the host.
```shell ```shell
sudo brctl show sudo ip link show type bridge
# determine bridge name from the above command # determine bridge name from the above command
# assign an IP address on the same network as the linked node # assign an IP address on the same network as the linked node
sudo ip addr add 10.0.1.2/24 dev b.48304.34658 sudo ip addr add 10.0.1.2/24 dev b.48304.34658
@ -500,7 +500,7 @@ The wireless LAN (WLAN) is covered in the next section.
The wireless LAN node allows you to build wireless networks where moving nodes The wireless LAN node allows you to build wireless networks where moving nodes
around affects the connectivity between them. Connection between a pair of nodes is stronger around affects the connectivity between them. Connection between a pair of nodes is stronger
when the nodes are closer while connection is weaker when the nodes are further away. when the nodes are closer while connection is weaker when the nodes are further away.
The wireless LAN, or WLAN, node appears as a small cloud. The WLAN offers The wireless LAN, or WLAN, node appears as a small cloud. The WLAN offers
several levels of wireless emulation fidelity, depending on your modeling needs. several levels of wireless emulation fidelity, depending on your modeling needs.
The WLAN tool can be extended with plug-ins for different levels of wireless The WLAN tool can be extended with plug-ins for different levels of wireless

View file

@ -70,7 +70,7 @@ shift $((OPTIND - 1))
case ${os} in case ${os} in
"ubuntu") "ubuntu")
echo "Installing CORE for Ubuntu" echo "Installing CORE for Ubuntu"
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk iproute2 \ sudo apt install -y automake pkg-config gcc libev-dev ebtables gawk iproute2 \
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
install_ospf_mdr install_ospf_mdr
if [[ -z ${dev} ]]; then if [[ -z ${dev} ]]; then
@ -86,7 +86,7 @@ case ${os} in
fi fi
;; ;;
"centos") "centos")
sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel bridge-utils iptables-ebtables iproute \ sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel iptables-ebtables iproute \
python36 python36-devel python3-pip python3-tkinter tk ethtool libtool readline-devel autoconf gawk python36 python36-devel python3-pip python3-tkinter tk ethtool libtool readline-devel autoconf gawk
install_ospf_mdr install_ospf_mdr
if [[ -z ${dev} ]]; then if [[ -z ${dev} ]]; then