Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exabgp4 #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions exabgp4/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Unlike BIRD or Quagga, ExaBGP was not designed to transform a general purpose
server into a router, but to allow engineers to control their BGP (rfc4271)
network easily. Think of it as Software Defined Networking for people with
"commodity" routers.

ExaBGP transform BGP (rfc4271) messages into friendly plain text or JSON
which can be easily manipulate by scripts.

It allows the creation of tools such as:
* advanced looking glass graphically display the routing of prefix
* high availability tool which automatically isolate broken services
* DDOS mitigation
* an anycasted server
91 changes: 91 additions & 0 deletions exabgp4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# $NetBSD$

VERSION= 4.2.11
DISTNAME= ${VERSION}
PKGNAME= exabgp4-${VERSION}
PKGREVISION= 1
EGG_NAME= exabgp-${VERSION}
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GITHUB:=Exa-Networks/exabgp/archive/}
DIST_SUBDIR= exabgp

MAINTAINER= [email protected]
HOMEPAGE= https://github.com/Exa-Networks/exabgp/
COMMENT= Userspace BGP daemon written in python
LICENSE= modified-bsd

WRKSRC= ${WRKDIR}/exabgp-${VERSION}

# Unclear if this is needed;
# perl is used in two example scripts,
# which need their shebang fixed,
# but is not needed to build or to run the software
#USE_TOOLS+= perl:run

PYTHON_VERSIONED_DEPENDENCIES+= setuptools

REPLACE_PERL+= etc/exabgp/examples/dynamic-1.pl
REPLACE_PERL+= etc/exabgp/examples/watchdog-1.pl

REPLACE_PYTHON+= etc/exabgp/examples/api-add-remove.run
REPLACE_PYTHON+= etc/exabgp/examples/api-announce.run
REPLACE_PYTHON+= etc/exabgp/examples/api-announcement.run
REPLACE_PYTHON+= etc/exabgp/examples/api-api.nothing.run
REPLACE_PYTHON+= etc/exabgp/examples/api-api.receive.run
REPLACE_PYTHON+= etc/exabgp/examples/api-attributes-vpn.run
REPLACE_PYTHON+= etc/exabgp/examples/api-attributes.run
REPLACE_PYTHON+= etc/exabgp/examples/api-broken-flow.run
REPLACE_PYTHON+= etc/exabgp/examples/api-check.run
REPLACE_PYTHON+= etc/exabgp/examples/api-eor.run
REPLACE_PYTHON+= etc/exabgp/examples/api-fast.run
REPLACE_PYTHON+= etc/exabgp/examples/api-flow.run
REPLACE_PYTHON+= etc/exabgp/examples/api-manual-eor.run
REPLACE_PYTHON+= etc/exabgp/examples/api-multi-neighbor.run
REPLACE_PYTHON+= etc/exabgp/examples/api-multisession.run
REPLACE_PYTHON+= etc/exabgp/examples/api-nexthop-self.run
REPLACE_PYTHON+= etc/exabgp/examples/api-nexthop.run
REPLACE_PYTHON+= etc/exabgp/examples/api-no-respawn-1.run
REPLACE_PYTHON+= etc/exabgp/examples/api-no-respawn-2.run
REPLACE_PYTHON+= etc/exabgp/examples/api-notification.run
REPLACE_PYTHON+= etc/exabgp/examples/api-open.run
REPLACE_PYTHON+= etc/exabgp/examples/api-reload.run
REPLACE_PYTHON+= etc/exabgp/examples/api-teardown.run
REPLACE_PYTHON+= etc/exabgp/examples/api-vpls.run
REPLACE_PYTHON+= etc/exabgp/examples/api-vpnv4.run
REPLACE_PYTHON+= etc/exabgp/examples/stderr-1.py
REPLACE_PYTHON+= etc/exabgp/examples/syslog-1.py
REPLACE_PYTHON+= etc/exabgp/examples/watchdog.run

CHECK_PORTABILITY_SKIP+= dev/release/google

PYTHON_VERSIONS_ACCEPTED= 39 38 37 36

USE_LANGUAGES= # none

RCD_SCRIPTS+= exabgp4

CONF_FILES+= ${PREFIX}/share/examples/exabgp/exabgp.env ${PREFIX}/etc/exabgp/exabgp.env

INSTALLATION_DIRS+= share/exabgp bin
INSTALLATION_DIRS+= ${PKGMANDIR}/man1 ${PKGMANDIR}/man5
INSTALLATION_DIRS+= etc/exabgp

post-patch:
${SED} -e s,/etc/,${PREFIX}/etc/, ${WRKSRC}/doc/man/exabgp.1 > ${WRKSRC}/doc/man/exabgp.1.sed
${CP} ${WRKSRC}/doc/man/exabgp.1.sed ${WRKSRC}/doc/man/exabgp.1

pre-install:
find ${WRKDIR} -name "*.orig" | xargs rm -f

post-install:
${INSTALL_MAN} ${WRKSRC}/doc/man/exabgp.1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
${INSTALL_MAN} ${WRKSRC}/doc/man/exabgp.conf.5 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
${CP} ${FILESDIR}/exabgp.env ${DESTDIR}${PREFIX}/share/examples/exabgp/

.include "../../lang/python/distutils.mk"
.include "../../lang/python/application.mk"
.include "../../lang/python/pyversion.mk"
.include "../../lang/python/versioned_dependencies.mk"
.include "../../mk/bsd.pkg.mk"
948 changes: 948 additions & 0 deletions exabgp4/PLIST

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions exabgp4/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$NetBSD$

SHA1 (exabgp/4.2.11.tar.gz) = 49076db8591cdf58dacaa40bc2e3091934056903
RMD160 (exabgp/4.2.11.tar.gz) = 58c31f85b47ebac97e354d43fa82fdee34685cb6
SHA512 (exabgp/4.2.11.tar.gz) = 61c143e90fd81323b03682ad46f2861576ab0328e2030259eff15bb9ef965477c514fb355112cbaf3dc138fb9f5582b6e1e1efb8d0d4313a9b9924ced156a155
Size (exabgp/4.2.11.tar.gz) = 2931753 bytes
SHA1 (patch-lib_exabgp_reactor_daemon.py) = cb284bfa0e3263c7c9e71b4c0adf01a25602ad41
SHA1 (patch-setup.py) = fa9debeac9c2ab0610669244ffdbeeb3c48da264
58 changes: 58 additions & 0 deletions exabgp4/files/exabgp.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[exabgp.api]
ack = true
chunk = 1
cli = true
compact = false
encoder = json
pipename = 'exabgp'
respawn = true
terminate = false

[exabgp.bgp]
openwait = 60

[exabgp.cache]
attributes = true
nexthops = true

[exabgp.daemon]
daemonize = true
drop = true
pid = '/var/run/exabgp/exabgp.pid'
umask = '0o137'
user = 'nobody'

[exabgp.log]
all = false
configuration = true
daemon = true
destination = 'syslog'
enable = true
level = WARNING
message = false
network = true
packets = false
parser = false
processes = true
reactor = true
rib = false
routes = false
short = false
timers = false

[exabgp.pdb]
enable = false

[exabgp.profile]
enable = false
file = ''

[exabgp.reactor]
speed = 1.0

[exabgp.tcp]
acl = false
bind = ''
delay = 0
once = false
port = 179
35 changes: 35 additions & 0 deletions exabgp4/files/exabgp4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
#
# $NetBSD$
#

# PROVIDE: exabgp4
# REQUIRE: LOGIN

$_rc_subr_loaded . /etc/rc.subr

name="exabgp"
rcvar="exabgp4"
command="/usr/pkg/bin/${name}"
required_files="/usr/pkg/etc/exabgp/exabgp.env /usr/pkg/etc/exabgp/exabgp.conf"
command_args="-e ${required_files}"
pidfile="/var/run/${name}/${name}.pid"
command_interpreter="/usr/pkg/bin/python3.8"

makepipe() {
test -p /var/run/exabgp/exabgp.in || mkfifo /var/run/exabgp/exabgp.in
test -p /var/run/exabgp/exabgp.out || mkfifo /var/run/exabgp/exabgp.out
chown nobody /var/run/exabgp/exabgp.in /var/run/exabgp/exabgp.out
chmod 600 /var/run/exabgp/exabgp.in /var/run/exabgp/exabgp.out
}

cleanpipe() {
rm -f /var/run/exabgp/exabgp.in
rm -f /var/run/exabgp/exabgp.out
}

start_precmd=makepipe
stop_postcmd=cleanpipe

load_rc_config $name
run_rc_command "$1"
16 changes: 16 additions & 0 deletions exabgp4/patches/patch-lib_exabgp_reactor_daemon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$NetBSD$

Already fixed upstream, but not released
https://github.com/Exa-Networks/exabgp/commit/b4a7028

--- lib/exabgp/reactor/daemon.py.orig 2021-01-28 18:18:19.554094109 +0000
+++ lib/exabgp/reactor/daemon.py
@@ -156,7 +156,7 @@ class Daemon(object):
def _is_socket(self, fd):
try:
s = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
- except ValueError:
+ except (OSError, ValueError):
# The file descriptor is closed
return False
try:
15 changes: 15 additions & 0 deletions exabgp4/patches/patch-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$NetBSD$

In NetBSD, it is uncommon to write these files directly to /etc

--- setup.py.orig 2021-01-28 19:05:54.528803756 +0000
+++ setup.py
@@ -31,7 +31,7 @@ def filesOf(directory):


data_files = [
- ('etc/exabgp/examples', filesOf('etc/exabgp')),
+ ('share/examples/exabgp', filesOf('etc/exabgp')),
]

if platform.system() != 'NetBSD':