diff options
Diffstat (limited to 'snapcraft')
49 files changed, 1100 insertions, 0 deletions
diff --git a/snapcraft/.gitignore b/snapcraft/.gitignore new file mode 100644 index 0000000..a4796fd --- /dev/null +++ b/snapcraft/.gitignore @@ -0,0 +1,5 @@ +snapcraft.yaml +parts +prime +stage +frr*.snap diff --git a/snapcraft/README.snap_build.md b/snapcraft/README.snap_build.md new file mode 100644 index 0000000..9d83a52 --- /dev/null +++ b/snapcraft/README.snap_build.md @@ -0,0 +1,117 @@ +Building your own FRRouting Snap +======================================== +(Tested on Ubuntu 18.04) + +1. Install snapcraft: + + sudo apt-get install snapcraft + +2. Checkout FRRouting under a **unpriviledged** user account + + git clone https://github.com/frrouting/frr.git + cd frr + +3. (Optional) Add extra version information to + `snapcraft/extra_version_info.txt`. Information in this file will + be displayed with the frr.version command (simple `cat` after + the display of the `zebra --version` output) + +4. Run Bootstrap and make distribution tar.gz + + ./bootstrap.sh + ./configure --with-pkg-extra-version=-MySnapVersion + make dist + + Note: configure parameters are not important for the Snap building, + except the `with-pkg-extra-version` if you want to give the Snap + a specific name to mark your own unoffical build + + This will build `frr-something.tar.gz` - the distribution tar and + the snapcraft/snapcraft.yaml with the matching version number + +5. Create snap + + cd snapcraft + snapcraft + + You should now end up with `frr_something.snap` + +Installing the snap +=================== +(This can be done on a different system) + +1. Install snapd + + sudo apt-get install snapd + +2. Install self-built frr snap. (`--force-dangerous` is required to + install a unsigned self-built snap) + + snap install --force-dangerous ./frr*.snap + + Connect the priviledged `network-control` plug to the snap: + + snap connect frr:network-control core:network-control + +See README.usage.md for more details on setting up and using the snap + +DONE. + +The Snap will be auto-started and running. + +Operations +========== + +### FRRouting Daemons +At this time, all FRRouting daemons are auto-started. + +A daemon can be stopped/started with (ie ospf6d) + + systemctl stop snap.frr.ospf6d.service + systemctl start snap.frr.ospf6d.service + +or disabled/enabled with + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +### FRRouting Commands +All the commands are prefixed with frr. + + frr.vtysh -> vtysh + frr.version -> Just gives version output (zebra --version) + frr.readme -> Returns simple README with hints on using FRR + + frr.bgpd-debug -> Directly start each daemon (without service) + frr.isisd-debug + frr.ospf6d-debug + frr.ospfd-debug + frr.pimd-debug + frr.pim6d-debug + frr.ripd-debug + frr.ripngd-debug + frr.ldp-debug + frr.zebra-debug + frr.nhrpd-debug + frr.babeld-debug + frr.eigrpd-debug + frr.pbrd-debug + frr.staticd-debug + frr.bfdd-debug + frr.fabricd-debug + frr.pathd-debug + +vtysh can be accessed as frr.vtysh (Make sure you have /snap/bin in your +path). If access as `vtysh` instead of `frr.vtysh` is needed, you can enable it +via a snap alias as follows: + + sudo snap alias frr vtysh + +This will add the vtysh command to your /snap/bin for direct access. The output of + + sudo snap aliases + +should list vtysh command alias as enabled: + +App Alias Notes +frr.vtysh vtysh enabled diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md new file mode 100644 index 0000000..888a228 --- /dev/null +++ b/snapcraft/README.usage.md @@ -0,0 +1,174 @@ +Using the FRRouting Snap +=============================== + +After installing the Snap, the priviledged plug need to be connected: + + snap connect frr:network-control core:network-control + +Enabling/Disabling FRRouting Daemons +------------------------------------------- + +By default (at this time), all FRRouting daemons will be enabled +on installation. If you want to disable a specific daemon, then use +the systemctl commands + +ie for `ospf6d` (OSPFv3): + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +The daemons are: `ripd`, `ripngd`, `ospfd`, `ospf6d`, `isisd`, `bgpd`, +`pimd`, `pim6d`, `ldpd`, `eigrpd`, `babeld`, `nhrpd`, `bfdd`, `vrrpd`, +`pbrd`, `pathd`, `fabricd`, `staticd`, `zebra` + +Commands defined by this snap +----------------------------- + +- `frr.vtysh`: + FRRouting VTY Shell (configuration tool) +- `frr.version`: + Returns output of `zebra --version` to display version and configured + options +- `frr.readme`: + Returns this document `cat README_usage.md` +- `frr.set`: + Allows to enable `FPM` and/or disable RPKIi module. See Module section below + +and for debugging defined at this time (May get removed later - do not +depend on them). These are mainly intended to debug the Snap + +- `frr.zebra-debug`: + Starts zebra daemon in foreground +- `frr.ripd-debug`: + Starts ripd daemon in foreground +- `frr.ripngd-debug`: + Starts ripng daemon in foreground +- `frr.ospfd-debug`: + Starts ospfd daemon in foreground +- `frr.ospf6d-debug`: + Starts ospf6d daemon in foreground +- `frr.isisd-debug`: + Starts isisd daemon in foreground +- `frr.bgpd-debug`: + Starts bgpd daemon in foreground +- `frr.pimd-debug`: + Starts pimd daemon in foreground +- `frr.pim6d-debug`: + Starts pim6d daemon in foreground +- `frr.ldpd-debug`: + Starts ldpd daemon in foreground +- `frr.nhrpd-debug`: + Starts nhrpd daemon in foreground +- `frr.babeld-debug`: + Starts babeld daemon in foreground +- `frr.eigrpd-debug`: + Starts eigrpd daemon in foreground +- `frr.pbrd-debug`: + Starts pbrd daemon in foreground +- `frr.staticd-debug`: + Starts staticd daemon in foreground +- `frr.bfdd-debug`: + Starts bfdd daemon in foreground +- `frr.fabricd-debug`: + Starts fabricd daemon in foreground + +MPLS (LDP) +---------- +The MPLS forwarding requires a Linux Kernel version 4.5 or newer and +specific MPLS kernel modules loaded. It will be auto-detected by +FRR. You can check the detected setup with the `show mpls status` +command from within `frr.vtysh` + +The following kernel modules `mpls-router` and `mpls-iptunnel` +need to be loaded. On Ubuntu 16.04, this can be done by editing +'/etc/modules-load.d/modules.conf' and add the following lines: + + # Load MPLS Kernel Modules + mpls-router + mpls-iptunnel + +For other distributions, please check the documentation on loading +modules. You need to either reboot or use `modprobe` to manually load +the modules as well before MPLS will be available. + +In addition to this, the MPLS Label-Processing needs to be enabled +with `sysctl` on the required interfaces. Assuming the interfaces +are named `eth0`, `eth1` and `eth2`, then the additional lines in +`/etc/sysctl.conf` will enable it on a Ubuntu 16.04 system: + + # Enable MPLS Label processing on all interfaces + net.mpls.conf.eth0.input=1 + net.mpls.conf.eth1.input=1 + net.mpls.conf.eth2.input=1 + net.mpls.platform_labels=100000 + +These settings require either a reboot or a manual configuration with +`sysctl` as well. + +Modules +---------- +The `frr.set` allows to turn FPM module ond the RPKI module on or off. + + frr.set fpm {disable|protobuf|netlink} + + Disables FPM or enables FPM with selected mode (default: disabled) + +By default, the FPM module is disabled, but installed with netlink and +protobuf support. To enable the FPM module, use the `frr.set fpm protobuf` +or `frr.set fpm netlink` command. The command will only enable the mode +for the next restart of zebra. Please reboot or restart zebra after +changing the mode to become effective. + + frr.set rpki {enable|disable} + + Disables or enables BGP RPKI (default: enabled) + +By default, the RPKI module is enabled. To disable the RPKI module +use the `frr.set rpki disable` command. The command will only enable +the module after the next restart of the bgp daemon. Please reboot or +restart bgpd after changing the mode to become effective. +(Normally, there is no need to disable the module as it has no effect +if there are no RPKI configurations in BGP) + +FAQ +--- +- frr.vtysh displays `--MORE--` on long output. How to suppress this? + - Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add + `export VTYSH_PAGER=cat` to the end of your `.profile`) + +- bfdd / ospfd / ospf6d / nhrpd are not running after installation + - Installing a new snap starts the daemons, but at this time they + may not have the required privileged access. Make sure you + issue the `snap connect` command as given above (can be verified + with `snap interfaces`) and **THEN** restart the daemons (or + reboot the system). + This is a limitation of any snap package at this time which + requires privileged interfaces (ie to manipulate routing tables) + +- Can I run vtysh directly without the "frr." prefix? + - Yes, enable the vtysh alias in the frr snap package by: + sudo snap alias frr vtysh + +Sourcecode available +==================== + +The source for this SNAP is available as part of the FRRouting +Source Code Distribution under `GPLv2 or later` + +<https://github.com/frrouting/frr.git> + +Instructions for rebuilding the snap are in `snapcraft/README.snap_build.md` + +*Please checkout the desired branch before following the instructions +as they may have changed between versions of FRR* + +Official Webpage for FRR +======================== + +Official webpage for FRR is at <https://www.frrouting.org/> + +Feedback welcome +================ + +Please send Feedback about this snap to Martin Winter at +`mwinter@opensourcerouting.org` diff --git a/snapcraft/defaults/babeld.conf.default b/snapcraft/defaults/babeld.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/babeld.conf.default diff --git a/snapcraft/defaults/bfdd.conf.default b/snapcraft/defaults/bfdd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/bfdd.conf.default diff --git a/snapcraft/defaults/bgpd.conf.default b/snapcraft/defaults/bgpd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/bgpd.conf.default diff --git a/snapcraft/defaults/eigrpd.conf.default b/snapcraft/defaults/eigrpd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/eigrpd.conf.default diff --git a/snapcraft/defaults/fabricd.conf.default b/snapcraft/defaults/fabricd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/fabricd.conf.default diff --git a/snapcraft/defaults/isisd.conf.default b/snapcraft/defaults/isisd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/isisd.conf.default diff --git a/snapcraft/defaults/ldpd.conf.default b/snapcraft/defaults/ldpd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/ldpd.conf.default diff --git a/snapcraft/defaults/nhrpd.conf.default b/snapcraft/defaults/nhrpd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/nhrpd.conf.default diff --git a/snapcraft/defaults/ospf6d.conf.default b/snapcraft/defaults/ospf6d.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/ospf6d.conf.default diff --git a/snapcraft/defaults/ospfd.conf.default b/snapcraft/defaults/ospfd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/ospfd.conf.default diff --git a/snapcraft/defaults/pathd.conf.default b/snapcraft/defaults/pathd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/pathd.conf.default diff --git a/snapcraft/defaults/pbrd.conf.default b/snapcraft/defaults/pbrd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/pbrd.conf.default diff --git a/snapcraft/defaults/pim6d.conf.default b/snapcraft/defaults/pim6d.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/pim6d.conf.default diff --git a/snapcraft/defaults/pimd.conf.default b/snapcraft/defaults/pimd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/pimd.conf.default diff --git a/snapcraft/defaults/ripd.conf.default b/snapcraft/defaults/ripd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/ripd.conf.default diff --git a/snapcraft/defaults/ripngd.conf.default b/snapcraft/defaults/ripngd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/ripngd.conf.default diff --git a/snapcraft/defaults/staticd.conf.default b/snapcraft/defaults/staticd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/staticd.conf.default diff --git a/snapcraft/defaults/vrrpd.conf.default b/snapcraft/defaults/vrrpd.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/vrrpd.conf.default diff --git a/snapcraft/defaults/vtysh.conf.default b/snapcraft/defaults/vtysh.conf.default new file mode 100644 index 0000000..5c15e6b --- /dev/null +++ b/snapcraft/defaults/vtysh.conf.default @@ -0,0 +1 @@ +no service integrated-vtysh-config diff --git a/snapcraft/defaults/zebra.conf.default b/snapcraft/defaults/zebra.conf.default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/defaults/zebra.conf.default diff --git a/snapcraft/extra_version_info.txt b/snapcraft/extra_version_info.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snapcraft/extra_version_info.txt diff --git a/snapcraft/helpers/Makefile b/snapcraft/helpers/Makefile new file mode 100644 index 0000000..c44bee7 --- /dev/null +++ b/snapcraft/helpers/Makefile @@ -0,0 +1,7 @@ +all: + +install: + install -D -m 0755 $(DESTDIR)/usr/bin/telnet.netkit $(DESTDIR)/bin/telnet + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute.db $(DESTDIR)/bin/traceroute + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute6.db $(DESTDIR)/bin/traceroute6 + diff --git a/snapcraft/scripts/Makefile b/snapcraft/scripts/Makefile new file mode 100644 index 0000000..951625f --- /dev/null +++ b/snapcraft/scripts/Makefile @@ -0,0 +1,25 @@ +all: + +install: + mkdir -p $(DESTDIR)/bin + install -D -m 0755 zebra-service $(DESTDIR)/bin/ + install -D -m 0755 bgpd-service $(DESTDIR)/bin/ + install -D -m 0755 ospfd-service $(DESTDIR)/bin/ + install -D -m 0755 ospf6d-service $(DESTDIR)/bin/ + install -D -m 0755 ripd-service $(DESTDIR)/bin/ + install -D -m 0755 ripngd-service $(DESTDIR)/bin/ + install -D -m 0755 isisd-service $(DESTDIR)/bin/ + install -D -m 0755 pimd-service $(DESTDIR)/bin/ + install -D -m 0755 pim6d-service $(DESTDIR)/bin/ + install -D -m 0755 ldpd-service $(DESTDIR)/bin/ + install -D -m 0755 nhrpd-service $(DESTDIR)/bin/ + install -D -m 0755 babeld-service $(DESTDIR)/bin/ + install -D -m 0755 eigrpd-service $(DESTDIR)/bin/ + install -D -m 0755 pbrd-service $(DESTDIR)/bin/ + install -D -m 0755 staticd-service $(DESTDIR)/bin/ + install -D -m 0755 bfdd-service $(DESTDIR)/bin/ + install -D -m 0755 fabricd-service $(DESTDIR)/bin/ + install -D -m 0755 vrrpd-service $(DESTDIR)/bin/ + install -D -m 0755 pathd-service $(DESTDIR)/bin/ + install -D -m 0755 set-options $(DESTDIR)/bin/ + install -D -m 0755 show_version $(DESTDIR)/bin/ diff --git a/snapcraft/scripts/babeld-service b/snapcraft/scripts/babeld-service new file mode 100644 index 0000000..9e022f8 --- /dev/null +++ b/snapcraft/scripts/babeld-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/babeld.conf ]; then + cp $SNAP/etc/frr/babeld.conf.default $SNAP_DATA/babeld.conf +fi +exec $SNAP/sbin/babeld \ + -f $SNAP_DATA/babeld.conf \ + --pid_file $SNAP_DATA/babeld.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/bfdd-service b/snapcraft/scripts/bfdd-service new file mode 100644 index 0000000..f94a7ab --- /dev/null +++ b/snapcraft/scripts/bfdd-service @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/bfdd.conf ]; then + cp $SNAP/etc/frr/bfdd.conf.default $SNAP_DATA/bfdd.conf +fi +exec $SNAP/sbin/bfdd \ + -f $SNAP_DATA/bfdd.conf \ + --pid_file $SNAP_DATA/bfdd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA \ + --bfdctl $SNAP_DATA/bfdd.sock + diff --git a/snapcraft/scripts/bgpd-service b/snapcraft/scripts/bgpd-service new file mode 100644 index 0000000..64273d9 --- /dev/null +++ b/snapcraft/scripts/bgpd-service @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/bgpd.conf ]; then + cp $SNAP/etc/frr/bgpd.conf.default $SNAP_DATA/bgpd.conf +fi +# If no RPKI option is specified, then we create a default +# with RPKI enabled +if ! [ -e $SNAP_DATA/rpki.conf ]; then + echo "-M rpki" > $SNAP_DATA/rpki.conf +fi +EXTRA_OPTIONS="`$SNAP/bin/cat $SNAP_DATA/rpki.conf`" +exec $SNAP/sbin/bgpd \ + -f $SNAP_DATA/bgpd.conf \ + --pid_file $SNAP_DATA/bgpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA \ + --moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS + diff --git a/snapcraft/scripts/eigrpd-service b/snapcraft/scripts/eigrpd-service new file mode 100644 index 0000000..fe945e5 --- /dev/null +++ b/snapcraft/scripts/eigrpd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/eigrpd.conf ]; then + cp $SNAP/etc/frr/eigrpd.conf.default $SNAP_DATA/eigrpd.conf +fi +exec $SNAP/sbin/eigrpd \ + -f $SNAP_DATA/eigrpd.conf \ + --pid_file $SNAP_DATA/eigrpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/fabricd-service b/snapcraft/scripts/fabricd-service new file mode 100644 index 0000000..586f061 --- /dev/null +++ b/snapcraft/scripts/fabricd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/fabricd.conf ]; then + cp $SNAP/etc/frr/fabricd.conf.default $SNAP_DATA/fabricd.conf +fi +exec $SNAP/sbin/fabricd \ + -f $SNAP_DATA/fabricd.conf \ + --pid_file $SNAP_DATA/fabricd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/isisd-service b/snapcraft/scripts/isisd-service new file mode 100644 index 0000000..aef92e9 --- /dev/null +++ b/snapcraft/scripts/isisd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/isisd.conf ]; then + cp $SNAP/etc/frr/isisd.conf.default $SNAP_DATA/isisd.conf +fi +exec $SNAP/sbin/isisd \ + -f $SNAP_DATA/isisd.conf \ + --pid_file $SNAP_DATA/isisd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ldpd-service b/snapcraft/scripts/ldpd-service new file mode 100644 index 0000000..4c4a8eb --- /dev/null +++ b/snapcraft/scripts/ldpd-service @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ldpd.conf ]; then + cp $SNAP/etc/frr/ldpd.conf.default $SNAP_DATA/ldpd.conf +fi +exec $SNAP/sbin/ldpd \ + -f $SNAP_DATA/ldpd.conf \ + --pid_file $SNAP_DATA/ldpd.pid \ + --socket $SNAP_DATA/zsock \ + --ctl_socket $SNAP_DATA \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/nhrpd-service b/snapcraft/scripts/nhrpd-service new file mode 100644 index 0000000..a3ba5e3 --- /dev/null +++ b/snapcraft/scripts/nhrpd-service @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/nhrpd.conf ]; then + cp $SNAP/etc/frr/nhrpd.conf.default $SNAP_DATA/nhrpd.conf +fi +exec $SNAP/sbin/nhrpd \ + -f $SNAP_DATA/nhrpd.conf \ + --pid_file $SNAP_DATA/nhrpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA diff --git a/snapcraft/scripts/ospf6d-service b/snapcraft/scripts/ospf6d-service new file mode 100644 index 0000000..4dc3cb0 --- /dev/null +++ b/snapcraft/scripts/ospf6d-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospf6d.conf ]; then + cp $SNAP/etc/frr/ospf6d.conf.default $SNAP_DATA/ospf6d.conf +fi +exec $SNAP/sbin/ospf6d \ + -f $SNAP_DATA/ospf6d.conf \ + --pid_file $SNAP_DATA/ospf6d.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ospfd-service b/snapcraft/scripts/ospfd-service new file mode 100644 index 0000000..7cac34b --- /dev/null +++ b/snapcraft/scripts/ospfd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospfd.conf ]; then + cp $SNAP/etc/frr/ospfd.conf.default $SNAP_DATA/ospfd.conf +fi +exec $SNAP/sbin/ospfd \ + -f $SNAP_DATA/ospfd.conf \ + --pid_file $SNAP_DATA/ospfd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/pathd-service b/snapcraft/scripts/pathd-service new file mode 100644 index 0000000..6473c59 --- /dev/null +++ b/snapcraft/scripts/pathd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pathd.conf ]; then + cp $SNAP/etc/frr/pathd.conf.default $SNAP_DATA/pathd.conf +fi +exec $SNAP/sbin/pathd \ + -f $SNAP_DATA/pathd.conf \ + --pid_file $SNAP_DATA/pathd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/pbrd-service b/snapcraft/scripts/pbrd-service new file mode 100644 index 0000000..a9265a1 --- /dev/null +++ b/snapcraft/scripts/pbrd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pbrd.conf ]; then + cp $SNAP/etc/frr/pbrd.conf.default $SNAP_DATA/pbrd.conf +fi +exec $SNAP/sbin/pbrd \ + -f $SNAP_DATA/pbrd.conf \ + --pid_file $SNAP_DATA/pbrd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/pim6d-service b/snapcraft/scripts/pim6d-service new file mode 100644 index 0000000..386c616 --- /dev/null +++ b/snapcraft/scripts/pim6d-service @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pim6d.conf ]; then + cp $SNAP/etc/frr/pim6d.conf.default $SNAP_DATA/pim6d.conf +fi +exec $SNAP/sbin/pim6d \ + -f $SNAP_DATA/pim6d.conf \ + --pid_file $SNAP_DATA/pim6d.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA diff --git a/snapcraft/scripts/pimd-service b/snapcraft/scripts/pimd-service new file mode 100644 index 0000000..3ddd394 --- /dev/null +++ b/snapcraft/scripts/pimd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pimd.conf ]; then + cp $SNAP/etc/frr/pimd.conf.default $SNAP_DATA/pimd.conf +fi +exec $SNAP/sbin/pimd \ + -f $SNAP_DATA/pimd.conf \ + --pid_file $SNAP_DATA/pimd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripd-service b/snapcraft/scripts/ripd-service new file mode 100644 index 0000000..f9959be --- /dev/null +++ b/snapcraft/scripts/ripd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripd.conf ]; then + cp $SNAP/etc/frr/ripd.conf.default $SNAP_DATA/ripd.conf +fi +exec $SNAP/sbin/ripd \ + -f $SNAP_DATA/ripd.conf \ + --pid_file $SNAP_DATA/ripd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripngd-service b/snapcraft/scripts/ripngd-service new file mode 100644 index 0000000..bd06e6b --- /dev/null +++ b/snapcraft/scripts/ripngd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripngd.conf ]; then + cp $SNAP/etc/frr/ripngd.conf.default $SNAP_DATA/ripngd.conf +fi +exec $SNAP/sbin/ripngd \ + -f $SNAP_DATA/ripngd.conf \ + --pid_file $SNAP_DATA/ripngd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/set-options b/snapcraft/scripts/set-options new file mode 100755 index 0000000..0637d2c --- /dev/null +++ b/snapcraft/scripts/set-options @@ -0,0 +1,63 @@ +#!/bin/sh + +set -e + +case $1 in + fpm) + case $2 in + disable) + rm -f $SNAP_DATA/fpm.conf + echo "FPM module disabled. Please restart FRR" + ;; + protobuf) + echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf + echo "FPM enabled and set to protobuf mode. Please restart FRR" + ;; + netlink) + echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf + echo "FPM enabled and set to netlink mode. Please restart FRR" + ;; + *) + echo "Usage:" + echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}" + echo "" + echo " Disables FPM module or enables it with specified mode" + echo " Mode will be saved for next restart of zebra, but zebra" + echo " is not automatically restarted" + exit 1 + ;; + esac + ;; + rpki) + case $2 in + disable) + echo "" > $SNAP_DATA/rpki.conf + echo "RPKI module disabled. Please restart FRR" + ;; + enable) + echo "-M rpki" > $SNAP_DATA/rpki.conf + echo "RPKI module enabled. Please restart FRR" + ;; + *) + echo "Usage:" + echo " ${SNAP_NAME}.set rpki {disable|enable}" + echo "" + echo " Disables BGP RPKI module or enables it (default: enabled)" + echo " Mode will be saved for next restart of bgpd, but bgpd" + echo " is not automatically restarted" + exit 1 + ;; + esac + ;; + *) + echo "Usage:" + echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}" + echo " ${SNAP_NAME}.set rpki {disable|enable}" + echo "" + echo " fpm: Disables FPM or enables FPM with selected mode" + echo " rpki: Disables BGP RPKI or enables it (default: enabled)" + exit 1 + ;; +esac + +exit 0 diff --git a/snapcraft/scripts/show_version b/snapcraft/scripts/show_version new file mode 100644 index 0000000..ca1c2aa --- /dev/null +++ b/snapcraft/scripts/show_version @@ -0,0 +1,6 @@ +#!/bin/sh + +$SNAP/sbin/zebra --version +$SNAP/bin/cat $SNAP/doc/extra_version_info.txt + +exit 0 diff --git a/snapcraft/scripts/staticd-service b/snapcraft/scripts/staticd-service new file mode 100644 index 0000000..3b22881 --- /dev/null +++ b/snapcraft/scripts/staticd-service @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/staticd.conf ]; then + if [ -e $SNAP_DATA/zebra.conf ]; then + # if we have a zebra.conf, but no staticd conf, then we use + # this file as the default config for staticd + cp $SNAP_DATA/zebra.conf $SNAP_DATA/staticd.conf + else + # new config, start with template + cp $SNAP/etc/frr/staticd.conf $SNAP_DATA/staticd.conf + fi +fi +exec $SNAP/sbin/staticd \ + -f $SNAP_DATA/staticd.conf \ + --pid_file $SNAP_DATA/staticd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/vrrpd-service b/snapcraft/scripts/vrrpd-service new file mode 100644 index 0000000..1f60d11 --- /dev/null +++ b/snapcraft/scripts/vrrpd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/vrrpd.conf ]; then + cp $SNAP/etc/frr/vrrpd.conf.default $SNAP_DATA/vrrpd.conf +fi +exec $SNAP/sbin/vrrpd \ + -f $SNAP_DATA/vrrpd.conf \ + --pid_file $SNAP_DATA/vrrpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/zebra-service b/snapcraft/scripts/zebra-service new file mode 100644 index 0000000..2ee131f --- /dev/null +++ b/snapcraft/scripts/zebra-service @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/zebra.conf ]; then + cp $SNAP/etc/frr/zebra.conf.default $SNAP_DATA/zebra.conf +fi +if ! [ -e $SNAP_DATA/vtysh.conf ]; then + cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf +fi +EXTRA_OPTIONS="" +if [ -e $SNAP_DATA/fpm.conf ]; then + EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`" +fi +exec $SNAP/sbin/zebra \ + -f $SNAP_DATA/zebra.conf \ + --pid_file $SNAP_DATA/zebra.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA \ + --moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS diff --git a/snapcraft/snap/gui/icon.png b/snapcraft/snap/gui/icon.png Binary files differnew file mode 100644 index 0000000..3ab3f8f --- /dev/null +++ b/snapcraft/snap/gui/icon.png diff --git a/snapcraft/snapcraft.yaml.in b/snapcraft/snapcraft.yaml.in new file mode 100644 index 0000000..607cbc7 --- /dev/null +++ b/snapcraft/snapcraft.yaml.in @@ -0,0 +1,434 @@ +name: frr +version: '@VERSION@' +summary: FRRouting BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM/LDP/EIGRP/BFD routing daemon +description: BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM/LDP/EIGRP/BFD routing daemon + FRRouting (FRR) is free software which manages TCP/IP based routing + protocols. It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, + RIPng, PIM, LDP, Babel, EIGRP, PBR (Policy-based routing), PATHD (Segment + routing), BFD and OpenFabric as well as the IPv6 versions of these. + FRRouting (frr) is a fork of Quagga. +confinement: strict +grade: devel +base: core18 + +apps: + vtysh: + command: bin/vtysh --vty_socket $SNAP_DATA --config_dir $SNAP_DATA + plugs: + - network + - network-bind + - network-control + aliases: [vtysh] + version: + command: bin/show_version + readme: + command: bin/cat $SNAP/doc/README.usage.md + zebra: + command: bin/zebra-service + daemon: simple + plugs: + - network + - network-bind + - network-control + bgpd: + command: bin/bgpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospfd: + command: bin/ospfd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospf6d: + command: bin/ospf6d-service + daemon: simple + plugs: + - network + - network-bind + - network-control + isisd: + command: bin/isisd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripd: + command: bin/ripd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripngd: + command: bin/ripngd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pimd: + command: bin/pimd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pim6d: + command: bin/pim6d-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ldpd: + command: bin/ldpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + nhrpd: + command: bin/nhrpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + babeld: + command: bin/babeld-service + daemon: simple + plugs: + - network + - network-bind + - network-control + eigrpd: + command: bin/eigrpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pbrd: + command: bin/pbrd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + staticd: + command: bin/staticd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + bfdd: + command: bin/bfdd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + fabricd: + command: bin/fabricd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + vrrpd: + command: bin/vrrpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pathd: + command: bin/pathd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + set: + command: bin/set-options + zebra-debug: + command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + bgpd-debug: + command: sbin/bgpd -f $SNAP_DATA/bgpd.conf --pid_file $SNAP_DATA/bgpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA --moduledir $SNAP/lib/frr/modules + plugs: + - network + - network-bind + - network-control + ospfd-debug: + command: sbin/ospfd -f $SNAP_DATA/ospfd.conf --pid_file $SNAP_DATA/ospfd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ospf6d-debug: + command: sbin/ospf6d -f $SNAP_DATA/ospf6d.conf --pid_file $SNAP_DATA/ospf6d.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + isisd-debug: + command: sbin/isisd -f $SNAP_DATA/isisd.conf --pid_file $SNAP_DATA/isisd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripd-debug: + command: sbin/ripd -f $SNAP_DATA/ripd.conf --pid_file $SNAP_DATA/ripd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripngd-debug: + command: sbin/ripngd -f $SNAP_DATA/ripngd.conf --pid_file $SNAP_DATA/ripngd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pimd-debug: + command: sbin/pimd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pim6d-debug: + command: sbin/pim6d -f $SNAP_DATA/pim6d.conf --pid_file $SNAP_DATA/pim6d.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ldpd-debug: + command: sbin/ldpd -f $SNAP_DATA/ldpd.conf --pid_file $SNAP_DATA/ldpd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + nhrpd-debug: + command: sbin/nhrpd -f $SNAP_DATA/nhrpd.conf --pid_file $SNAP_DATA/nhrpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + babeld-debug: + command: sbin/babeld -f $SNAP_DATA/babeld.conf --pid_file $SNAP_DATA/babeld.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + eigrpd-debug: + command: sbin/eigrpd -f $SNAP_DATA/eigrpd.conf --pid_file $SNAP_DATA/eigrpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pbrd-debug: + command: sbin/pbrd -f $SNAP_DATA/pbrd.conf --pid_file $SNAP_DATA/pbrd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + staticd-debug: + command: sbin/staticd -f $SNAP_DATA/staticd.conf --pid_file $SNAP_DATA/staticd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + bfdd-debug: + command: sbin/bfdd -f $SNAP_DATA/bfdd.conf --pid_file $SNAP_DATA/bfdd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA --bfdctl $SNAP_DATA/bfdd.sock + plugs: + - network + - network-bind + - network-control + fabricd-debug: + command: sbin/fabricd -f $SNAP_DATA/fabricd.conf --pid_file $SNAP_DATA/fabricd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + vrrpd-debug: + command: sbin/vrrpd -f $SNAP_DATA/vrrpd.conf --pid_file $SNAP_DATA/vrrpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pathd-debug: + command: sbin/pathd -f $SNAP_DATA/pathd.conf --pid_file $SNAP_DATA/pathd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + +parts: + rtrlib: + build-packages: + - cmake + - make + - gcc + - libssh-dev + stage-packages: + - libssh-4 + - zlib1g + prime: + - lib/librtr.so* + - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libssh.so* + source: https://github.com/rtrlib/rtrlib.git + source-type: git + source-tag: v0.8.0 + plugin: cmake + configflags: + - -DCMAKE_BUILD_TYPE=Release + libyang: + build-packages: + - cmake + - make + - gcc + - libpcre2-dev + stage-packages: + - libpcre2-8-0 + source: https://github.com/CESNET/libyang.git + source-type: git + source-tag: v2.1.80 + plugin: cmake + configflags: + - -DCMAKE_INSTALL_PREFIX:PATH=/usr + - -DENABLE_LYD_PRIV=ON + - -DENABLE_CACHE=ON + - -DCMAKE_BUILD_TYPE:String="Release" + frr: + after: [rtrlib,libyang] + build-packages: + - gcc + - autoconf + - automake + - libtool + - make + - gawk + - libreadline-dev + - libelf-dev + - texinfo + - libncurses5-dev + - texlive-latex-base + - texlive-generic-recommended + - libcap-dev + - imagemagick + - ghostscript + - groff + - libpcre3-dev + - chrpath + - pkg-config + - libjson-c-dev + - libc-ares-dev + - bison + - flex + - python3-dev + - libprotobuf-c-dev + - protobuf-c-compiler + - python3-sphinx + stage-packages: + - coreutils + - iproute2 + - logrotate + - libcap2 + - libtinfo5 + - libreadline7 + - libjson-c3 + - libc-ares2 + - libatm1 + - libprotobuf-c1 + - libdb5.3 + - libacl1 + - libattr1 + - libaudit1 + - libcap-ng0 + - libpam0g + - libpcre3 + - libselinux1 + - libxtables12 + plugin: autotools + source: ../frr-@PACKAGE_VERSION@.tar.gz + configflags: + - --enable-vtysh + - --enable-isisd + - --enable-watchfrr + - --enable-ospfclient=yes + - --enable-ospfapi=yes + - --enable-multipath=64 + - --enable-rtadv + - --enable-irdp + - --enable-user=root + - --enable-group=root + - --enable-pimd + - --enable-pim6d + - --enable-ldpd + - --enable-fpm + - --enable-protobuf + - --enable-rpki + - --enable-vrrpd + - --enable-configfile-mask=0640 + - --enable-logfile-mask=0640 + - --localstatedir=/var/run + - --sbindir=/sbin + - --bindir=/bin + - --sysconfdir=/etc/frr + - --with-pkg-extra-version=@PACKAGE_EXTRAVERSION@ + frr-defaults: + plugin: dump + source: defaults + organize: + zebra.conf.default: etc/frr/zebra.conf.default + bgpd.conf.default: etc/frr/bgpd.conf.default + isisd.conf.default: etc/frr/isisd.conf.default + ospf6d.conf.default: etc/frr/ospf6d.conf.default + ospfd.conf.default: etc/frr/ospfd.conf.default + pimd.conf.default: etc/frr/pimd.conf.default + pim6d.conf.default: etc/frr/pim6d.conf.default + ripd.conf.default: etc/frr/ripd.conf.default + ripngd.conf.default: etc/frr/ripngd.conf.default + ldpd.conf.default: etc/frr/ldpd.conf.default + nhrpd.conf.default: etc/frr/nhrpd.conf.default + babeld.conf.default: etc/frr/babeld.conf.default + eigrpd.conf.default: etc/frr/eigrpd.conf.default + pbrd.conf.default: etc/frr/pbrd.conf.default + bfdd.conf.default: etc/frr/bfdd.conf.default + fabricd.conf.default: etc/frr/fabricd.conf.default + vrrpd.conf.default: etc/frr/vrrpd.conf.default + pathd.conf.default: etc/frr/pathd.conf.default + vtysh.conf.default: etc/frr/vtysh.conf.default + staticd.conf.default: etc/frr/staticd.conf.default + frr-scripts: + plugin: make + source: scripts + helpers: + stage-packages: + - telnet + - traceroute + - libgcc1 + - libstdc++6 + plugin: make + source: helpers + prime: + - bin/telnet + - bin/traceroute + - bin/traceroute6 + docs: + plugin: dump + source: . + organize: + README.usage.md: doc/README.usage.md + README.snap_build.md: doc/README.snap_build.md + extra_version_info.txt: doc/extra_version_info.txt |