Skip to content

Build FRR 8.3.1 RPMs (for Route Views) #1

@ryeleo

Description

@ryeleo

Acceptance Criteria

  • Build RPMs for FRR 8.3.1 following instructions below
  • Get new FRR version integrated into (private) RV infra repo, with help of @routeviews/maintainers

Building FRR Instructions

ℹ Copied from "Building FRR" docs in (private) infra repo

For RouteViews, we use a custom version of FRR.
Mainly, we customize FRR to enable telnet sessions to access the FRR shell.

This document walks through the process to modify FRR source code and build scripts then run the build.
Additionally, this document discusses how to deploy and test the FRR build once it is ready to go!

Downloading and Patching FRR

We have a VM that has many prerequisites pre-installed: build.routeviews.org
Important: apparently the rpmbuild command actually requires a host with proper DNS resolution available -- this build server fulfills that requirement.

This document describes the building and packaging process for frr in the context of routeviews.
These instructions are based on FRR Packaging for RedHat instructions and FRR Packing for Debian instructions.

Today, these instructions assume CentOS 7, or Ubuntu 20.04

Download FRR Source Code

First, you'll need to clone git repo and choose the branch/version that you want to build.
In this example, we are building the latest 'stable/8.1' version of FRR source code.

git clone https://github.com/frrouting/frr.git
cd frr
git checkout stable/8.1

It is a good idea to create a routeviews-specific local branch (off of the stable branch).

git checkout -b rv-frr-8.1 

Apply VTY Patch

We patch the VTY code with some enhanced logging to make our lives easier.

  1. In file /lib/libfrr.c find the method static void frr_vty_serv(void).

  2. Within that method, encase the line vty_serv_sock(di->vty_addr, di->vty_port, di->vty_path); with logging, like the following:

     #if defined(HAVE_PRIV_VTY)
         if (di->privs->change(ZPRIVS_RAISE)) {
             zlog_err("unable to raise privs for %s's, vty", di->name);
         }
     #endif
    
         vty_serv_sock(di->vty_addr, di->vty_port, di->vty_path);
    
     #if defined(HAVE_PRIV_VTY)
         if (di->privs->change(ZPRIVS_LOWER)) {
             zlog_err("unable to lower privs for %s's, vty", di->name);
         }
     #endif
    

Create Build Flags for --enable-privileged-vty

In file /configure.ac

Add the following:

AC_ARG_ENABLE(privileged_vty,
    AS_HELP_STRING([--enable-privileged-vty], [Allow vty to bind to privileged ports]))

And:

if test "${enable_privileged_vty}" = "yes"; then
    AC_DEFINE([HAVE_PRIV_VTY],,[Allow vty to bind to privileged ports])
fi

In the corresponding sections with similar commands.

ℹ Hint: Search for HAVE_SHELL_ACCESS to find the appropriate sections of the code.

CentOS 7 Packaging Instructions

Required Packages

First, you must install required packages:

sudo yum install git autoconf automake libtool make \
    readline-devel texinfo net-snmp-devel groff pkgconfig \
    json-c-devel pam-devel bison flex pytest c-ares-devel \
    python-devel python-sphinx libcap-devel \
    elfutils-libelf-devel libunwind-devel \
    libssh libssh-devel librtr-devel

In addition, a special version libyang and libyang-devel are required to build FRR.
Today, this version of libyang is actually only available via an FRR RPM repository.
The instructions to add this repo to your CentOS 7 build server are copied below:

FRRVER="frr-stable"
curl -O https://rpm.frrouting.org/repo/$FRRVER-repo-1-0.el7.noarch.rpm
sudo yum install ./$FRRVER*

With the FRR RPM repo available, now you can simply install libyang2 using yum:

sudo yum install libyang2

Create RPM Package

Creating the RPM package requires many steps; from bootstrapping to

Bootstrap

Run the following commands in the root directory of the repo:

./bootstrap.sh
./configure --with-pkg-extra-version=-rv
make dist

Establish rpmbuild directory

Create the rpmbuild directory - from the root directory of the frr repo:

mkdir -p rpmbuild/SOURCES rpmbuild/SPECS
cp redhat/*.spec rpmbuild/SPECS/.
cp frr*.tar.gz rpmbuild/SOURCES/.

Choose FRR Features

  1. Open the file rpmbuild/SPECS/frr.spec for editing.
  2. Disable all features in the # with-feature options section except for the flags indicated in the table below:

All other flags should be 0.

Flag Why leave enabled?
with_bfdd frr will fail building without this.
with_eigrpd frr will fail building without this.
with_multipath There's no harm in leaving this.
with_watchfrr Needed for systemd integration.
with_opsfapi frr will fail building without this.
with_opsfclient frr will fail building without this.
  1. At the end of # with-feature options, add the following line to enable our newly added 'enable_privileged_vty' feature:

     %{!?with_privileged_vty: %global with_privileged_vty 1 }
    
  2. In the middle of the %configure \ section, add the following lines (also to enable our newly added 'enable_privileged_vty' feature):

     %if %{with_privileged_vty}
         --enable-privileged-vty \
     %endif
    

Important: Do not put this at the very end, otherwise the line-continuation logic may break!

Build the RPM

Finally, everything is in place so that we can run rpmbuild!

This will take a few minutes.

rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/frr.spec

If the rpmbuild command succeeds, all of the RPM packages will be written to the rpmbuilds/[S]RPMS/ directories.
The rpmbuild output will indicate where these files have been written:

Wrote: /root/frr/rpmbuild/SRPMS/frr-8.1_rv-01.el7.src.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-contrib-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-pythontools-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-devel-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-rpki-rtrlib-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-snmp-8.1_rv-01.el7.x86_64.rpm
Wrote: /root/frr/rpmbuild/RPMS/x86_64/frr-debuginfo-8.1_rv-01.el7.x86_64.rpm

Additional required packages (at runtime)

In addition to the packages we just created, we need ensure some supporting rpms are up to date as well.
They can be found as artifacts on the (public) FRR Build Server.

At the time of writing, only the following rpms are required:

librtr.*.el7.x86_64.rpm
librtr-devel.*el7.x86_64.rpm

Metadata

Metadata

Assignees

No one assigned

    Labels

    collectorIssue related to Route Views collector(s).enhancementNew feature or requesthelp wantedExtra attention is neededtriageNeeds intake-processing & prioritization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions