1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

New port: net/gobgp

GoBGP: BGP implementation in Go

GoBGP is an open source BGP implementation designed from scratch
for modern environment and implemented in a modern programming
language, the Go Programming Language.

WWW: https://github.com/osrg/gobgp

PR:		218678
Submitted by:	nork@ninth-nine.com, John W. O'Brien <john@saltant.com>
This commit is contained in:
Kurt Jaeger 2018-02-27 18:19:54 +00:00
parent 11016f74f6
commit 746617409c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=463150
7 changed files with 309 additions and 0 deletions

View File

@ -182,6 +182,7 @@
SUBDIR += gnome-online-miners
SUBDIR += gnu-dico
SUBDIR += gnu-radius
SUBDIR += gobgp
SUBDIR += go-amqp
SUBDIR += go-bapu
SUBDIR += go-cs

85
net/gobgp/Makefile Normal file
View File

@ -0,0 +1,85 @@
# $FreeBSD$
PORTNAME= gobgp
PORTVERSION= 1.28
DISTVERSIONPREFIX= v
CATEGORIES= net
DIST_SUBDIR= gobgp
MAINTAINER= nork@ninth-nine.com
COMMENT= BGP implementation in Go
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
GO_TARGET= ${GO_PKGNAME}/gobgp \
${GO_PKGNAME}/gobgpd
USE_GITHUB= yes
GH_ACCOUNT= osrg:DEFAULT
GH_TUPLE= BurntSushi:toml:b26d9c3:toml/../src/github.com/BurntSushi/toml \
armon:go-radix:1fca145:radix/../src/github.com/armon/go-radix \
davecgh:go-spew:346938d:spew/../src/github.com/davecgh/go-spew \
dgryski:go-farm:ac7624e:farm/../src/github.com/dgryski/go-farm \
eapache:channels:47238d5:channels/../src/github.com/eapache/channels \
eapache:queue:ded5959:queue/../src/github.com/eapache/queue \
fsnotify:fsnotify:629574c:fsnotify/../src/github.com/fsnotify/fsnotify \
golang:protobuf:748d386:protobuf/../src/github.com/golang/protobuf \
hashicorp:hcl:392dba7:hcl/../src/github.com/hashicorp/hcl \
inconshreveable:mousetrap:76626ae:mousetrap/../src/github.com/inconshreveable/mousetrap \
influxdata:influxdb:5887e92:influxdb/../src/github.com/influxdata/influxdb \
jessevdk:go-flags:96dc062:flags/../src/github.com/jessevdk/go-flags \
kr:pretty:cfb55aa:pretty/../src/github.com/kr/pretty \
kr:text:7cafcd8:krtext/../src/github.com/kr/text \
magiconair:properties:be5ece7:properties/../src/github.com/magiconair/properties \
mitchellh:mapstructure:d0303fe:mapstructure/../src/github.com/mitchellh/mapstructure \
pelletier:go-buffruneio:c37440a:buffruneio/../src/github.com/pelletier/go-buffruneio \
pelletier:go-toml:5ccdfb1:toml/../src/github.com/pelletier/go-toml \
pmezard:go-difflib:792786c:difflib/../src/github.com/pmezard/go-difflib \
satori:go.uuid:36e9d2e:uuid/../src/github.com/satori/go.uuid \
sirupsen:logrus:a3f95b5:logrus/../src/github.com/sirupsen/logrus \
spf13:afero:9be6508:afero/../src/github.com/spf13/afero \
spf13:cast:acbeb36:cast/../src/github.com/spf13/cast \
spf13:cobra:b26b538:cobra/../src/github.com/spf13/cobra \
spf13:jWalterWeatherman:0efa520:jwalterweatherman/../src/github.com/spf13/jwalterweatherman \
spf13:pflag:e57e3ee:pflag/../src/github.com/spf13/pflag \
spf13:viper:25b30aa:viper/../src/github.com/spf13/viper \
stretchr:testify:69483b4:testify/../src/github.com/stretchr/testify \
vishvananda:netlink:a956595:netlink/../src/github.com/vishvananda/netlink \
vishvananda:netns:86bef33:netns/../src/github.com/vishvananda/netns \
golang:net:f5079bd:gonet/../src/golang.org/x/net \
golang:sys:e312636:gosys/../src/golang.org/x/sys \
golang:text:3bd178b:gotext/../src/golang.org/x/text \
google:go-genproto:09f6ed2:genproto/../src/google.golang.org/genproto \
grpc:grpc-go:b8669c3:grpc/../src/google.golang.org/grpc \
go-tomb:tomb:d5d1b58:tombv2/../src/gopkg.in/tomb.v2 \
go-yaml:yaml:25c4ec8:yamlv2/../src/gopkg.in/yaml.v2 \
golang:crypto:5119cf5:gocrypto/../src/golang.org/x/crypto
PLIST_FILES= bin/gobgp libexec/gobgpd
OPTIONS_DEFINE= BASH ZSH
OPTIONS_DEFAULT=BASH ZSH
BASH_PLIST_FILES= etc/bash_completion.d/gobgp-completion.bash \
etc/bash_completion.d/gobgp-dynamic-completion.bash \
etc/bash_completion.d/gobgp-static-completion.bash
ZSH_PLIST_FILES= share/zsh/site-functions/_gobgp
USE_RC_SUBR= gobgpd
SUB_FILES= gobgpd
do-install:
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/gobgp ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/gobgpd ${STAGEDIR}${PREFIX}/libexec
post-install-BASH-on:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
${INSTALL_DATA} ${GO_WRKSRC}/tools/completion/gobgp*-completion.bash ${STAGEDIR}${PREFIX}/etc/bash_completion.d/
post-install-ZSH-on:
${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
${INSTALL_DATA} ${GO_WRKSRC}/tools/completion/zsh/_gobgp ${STAGEDIR}${PREFIX}/share/zsh/site-functions/
.include <bsd.port.mk>

77
net/gobgp/distinfo Normal file
View File

@ -0,0 +1,77 @@
TIMESTAMP = 1518279013
SHA256 (gobgp/osrg-gobgp-v1.28_GH0.tar.gz) = 49c5b8a61a32c50be9d5a79a5cbc37ae5c01b615812cf356e1fc70d769e0e3e7
SIZE (gobgp/osrg-gobgp-v1.28_GH0.tar.gz) = 717184
SHA256 (gobgp/pelletier-go-toml-5ccdfb1_GH0.tar.gz) = 3d5ba78c7f30cc14421a86940ab647a11f4afc83351d6be1e122b7e61632c0a3
SIZE (gobgp/pelletier-go-toml-5ccdfb1_GH0.tar.gz) = 47013
SHA256 (gobgp/armon-go-radix-1fca145_GH0.tar.gz) = 78dd05b37ac60393e08fad0180ceab6355ce45b13840f2f14f0e0d3da48272d2
SIZE (gobgp/armon-go-radix-1fca145_GH0.tar.gz) = 5940
SHA256 (gobgp/davecgh-go-spew-346938d_GH0.tar.gz) = 92e706ece5da01f2c61cf632e168d8c24d44866523b25f0e8eb9d1596c5d5f79
SIZE (gobgp/davecgh-go-spew-346938d_GH0.tar.gz) = 42343
SHA256 (gobgp/dgryski-go-farm-ac7624e_GH0.tar.gz) = 5536292cd910b2c3c7ed80535394c74e47fdb69d11569a9287519283bb8ca01d
SIZE (gobgp/dgryski-go-farm-ac7624e_GH0.tar.gz) = 20512
SHA256 (gobgp/eapache-channels-47238d5_GH0.tar.gz) = f187e475d4e03e4b454845ea311daeeacc9b42558d5e9b6ea4132cb4c3ac237d
SIZE (gobgp/eapache-channels-47238d5_GH0.tar.gz) = 11706
SHA256 (gobgp/eapache-queue-ded5959_GH0.tar.gz) = a3aa9c17d3c0a563d1b52bc0c50ec825cfeb94606defc27076b97418c3771ded
SIZE (gobgp/eapache-queue-ded5959_GH0.tar.gz) = 3261
SHA256 (gobgp/fsnotify-fsnotify-629574c_GH0.tar.gz) = c8da466b460ded4f23bef2b75fc7646d6ccfac3643b0cd2eaeb57de21889576b
SIZE (gobgp/fsnotify-fsnotify-629574c_GH0.tar.gz) = 29554
SHA256 (gobgp/golang-protobuf-748d386_GH0.tar.gz) = 769b6a06736ba2ea79d80291982847f8435dd508d24c4fa2aea82e4bab8b7389
SIZE (gobgp/golang-protobuf-748d386_GH0.tar.gz) = 253421
SHA256 (gobgp/hashicorp-hcl-392dba7_GH0.tar.gz) = a9ec781e8590fe45a11f84833cb3a6ad56d7da069ee95750f53f8e133bc679e8
SIZE (gobgp/hashicorp-hcl-392dba7_GH0.tar.gz) = 69728
SHA256 (gobgp/inconshreveable-mousetrap-76626ae_GH0.tar.gz) = d56204c0067e12a8939e1db62e907095f4fba37d98cb1e0ec574f1dce89effc4
SIZE (gobgp/inconshreveable-mousetrap-76626ae_GH0.tar.gz) = 2288
SHA256 (gobgp/influxdata-influxdb-5887e92_GH0.tar.gz) = 59eeb0efde69c461668f4392d547235295f890ceb4afa3c4bd71357a811b071d
SIZE (gobgp/influxdata-influxdb-5887e92_GH0.tar.gz) = 1068563
SHA256 (gobgp/jessevdk-go-flags-96dc062_GH0.tar.gz) = 861b8f2b4f47da687e14e6d3e5e1b74feabc6467197f6fe2326d54f39d315d18
SIZE (gobgp/jessevdk-go-flags-96dc062_GH0.tar.gz) = 55449
SHA256 (gobgp/kr-pretty-cfb55aa_GH0.tar.gz) = 5c8e2093298c7540a2707a34d283ce37f1b288497786d4f5725647a63ab2ac5c
SIZE (gobgp/kr-pretty-cfb55aa_GH0.tar.gz) = 8499
SHA256 (gobgp/kr-text-7cafcd8_GH0.tar.gz) = 218bd56a3927283e4c9232b4ee15e0fcc989ace72a2a0be14863ce3795ad3c90
SIZE (gobgp/kr-text-7cafcd8_GH0.tar.gz) = 8584
SHA256 (gobgp/magiconair-properties-be5ece7_GH0.tar.gz) = ec40448e2e63301527519ba2ffea379645a8e884490116fb1b9784b1af85aea7
SIZE (gobgp/magiconair-properties-be5ece7_GH0.tar.gz) = 27511
SHA256 (gobgp/mitchellh-mapstructure-d0303fe_GH0.tar.gz) = 30e7697b7e321d8f14bff5f19b789cd38fd277518aae251c370ea53ddb53d1f7
SIZE (gobgp/mitchellh-mapstructure-d0303fe_GH0.tar.gz) = 15560
SHA256 (gobgp/pelletier-go-buffruneio-c37440a_GH0.tar.gz) = d2bdcd763e33d9bdda4058b10dc2b4fc25aeb1b752b7e1bb9b4713dc06e24af4
SIZE (gobgp/pelletier-go-buffruneio-c37440a_GH0.tar.gz) = 3027
SHA256 (gobgp/pmezard-go-difflib-792786c_GH0.tar.gz) = 7c2a6d7ea0700411ba7d13865230c03bd6734d3ff6c213357bda121f5bb707fb
SIZE (gobgp/pmezard-go-difflib-792786c_GH0.tar.gz) = 11401
SHA256 (gobgp/satori-go.uuid-36e9d2e_GH0.tar.gz) = aa54b317ac4122e7a4db33f84bac64fa9079637f4fd0517206c06d1aa1341b2d
SIZE (gobgp/satori-go.uuid-36e9d2e_GH0.tar.gz) = 8738
SHA256 (gobgp/sirupsen-logrus-a3f95b5_GH0.tar.gz) = bbcff7baa2014b1095e000a61eb805658ac43c8f01da294575f1a8437561a8de
SIZE (gobgp/sirupsen-logrus-a3f95b5_GH0.tar.gz) = 28454
SHA256 (gobgp/spf13-afero-9be6508_GH0.tar.gz) = 6814d3c2e2c55540cbc190def53324924cf44b06ac4ec39b4cb09c3416a5dcb5
SIZE (gobgp/spf13-afero-9be6508_GH0.tar.gz) = 40630
SHA256 (gobgp/spf13-cast-acbeb36_GH0.tar.gz) = 403d9ba0ea7655ad375cf31e9ff1fece4425b3795fc47eb86e824ab6ac6ef620
SIZE (gobgp/spf13-cast-acbeb36_GH0.tar.gz) = 9588
SHA256 (gobgp/spf13-cobra-b26b538_GH0.tar.gz) = 650cd92ad567a10f348c2d7b1ac5a22747d257d393efef5742498bab10490ee4
SIZE (gobgp/spf13-cobra-b26b538_GH0.tar.gz) = 100085
SHA256 (gobgp/spf13-jWalterWeatherman-0efa520_GH0.tar.gz) = 30724b69b0975bd29ee722fb46bb2ad332f0648194c40d6edddccd660db5ed9b
SIZE (gobgp/spf13-jWalterWeatherman-0efa520_GH0.tar.gz) = 6343
SHA256 (gobgp/spf13-pflag-e57e3ee_GH0.tar.gz) = 16556b4873f12211cffec75aa4d3a6332efa26e64ff0476fdbd99f672ca37d51
SIZE (gobgp/spf13-pflag-e57e3ee_GH0.tar.gz) = 38998
SHA256 (gobgp/spf13-viper-25b30aa_GH0.tar.gz) = 1c122475eae91ebeeb20e799f8eaec0e4ae3f3dce18cfbe244dc9292dbf2373a
SIZE (gobgp/spf13-viper-25b30aa_GH0.tar.gz) = 30808
SHA256 (gobgp/stretchr-testify-69483b4_GH0.tar.gz) = 4f0aa4ed2d03c2c844fb8913a720e03473b8bf439cd906302a53af0aae6c14e8
SIZE (gobgp/stretchr-testify-69483b4_GH0.tar.gz) = 83325
SHA256 (gobgp/vishvananda-netlink-a956595_GH0.tar.gz) = 338d5d91d2371bad62e4cba9f7a010b81e3d2d3e445ab32c4ac3cddb6c7f975c
SIZE (gobgp/vishvananda-netlink-a956595_GH0.tar.gz) = 103163
SHA256 (gobgp/vishvananda-netns-86bef33_GH0.tar.gz) = 7115bddebbc915d27f02f8a8106c8339c115df243c7cb30da2a1847eaa7a33a3
SIZE (gobgp/vishvananda-netns-86bef33_GH0.tar.gz) = 7742
SHA256 (gobgp/golang-net-f5079bd_GH0.tar.gz) = f2344b7016ad61ee82642d62ac78aeb83e1d31d92939cdc3f0958ea4301101c1
SIZE (gobgp/golang-net-f5079bd_GH0.tar.gz) = 912361
SHA256 (gobgp/golang-sys-e312636_GH0.tar.gz) = b9622b35e06ba971c911663981824f5f63ab9ffa5c3ee466f3578b9d5cbc3357
SIZE (gobgp/golang-sys-e312636_GH0.tar.gz) = 732863
SHA256 (gobgp/golang-text-3bd178b_GH0.tar.gz) = 01790b4215077e7d4c15e685c9460df93f4e835211928351dd9eb7eea783b830
SIZE (gobgp/golang-text-3bd178b_GH0.tar.gz) = 4594818
SHA256 (gobgp/google-go-genproto-09f6ed2_GH0.tar.gz) = 08f7fc1132b33dd6a365d7bc8e931dd4648f51d6fcb219aa0bc2df3420364b99
SIZE (gobgp/google-go-genproto-09f6ed2_GH0.tar.gz) = 952658
SHA256 (gobgp/grpc-grpc-go-b8669c3_GH0.tar.gz) = a8be62ec0740019fbe07b2f8ed828c7e40ad21140e5d973ce78effccf64430ca
SIZE (gobgp/grpc-grpc-go-b8669c3_GH0.tar.gz) = 302786
SHA256 (gobgp/go-tomb-tomb-d5d1b58_GH0.tar.gz) = 15f81593032433527203ace3277c819f2b4b90fd337ea2193de0c7a515b87f08
SIZE (gobgp/go-tomb-tomb-d5d1b58_GH0.tar.gz) = 5513
SHA256 (gobgp/go-yaml-yaml-25c4ec8_GH0.tar.gz) = dc5116c179734068aab4a7047655051756b75b0b4d92106bd9c9016dd3683e52
SIZE (gobgp/go-yaml-yaml-25c4ec8_GH0.tar.gz) = 61310
SHA256 (gobgp/golang-crypto-5119cf5_GH0.tar.gz) = 07e82eeb40a4cea7688283874446946dc43f6ab50f9876a9bff9b687cc261a51
SIZE (gobgp/golang-crypto-5119cf5_GH0.tar.gz) = 1450883

106
net/gobgp/files/gobgpd.in Normal file
View File

@ -0,0 +1,106 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: gobgpd
# REQUIRE: netif routing
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Define these gobgpd* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/gobgpd
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
# Add the following lines to /etc/rc.conf to enable gobgpd:
#
# gobgpd_enable="YES"
# gobgpd_config="<default unset>"
# gobgpd_config_type="<default unset>"
# gobgpd_flags="<set as needed>"
# gobgpd_log_level="<set as needed like 'debug'>"
# gobgpd_stdlog_enable="<default 'NO'>"
# gobgpd_syslog_host="<set as needed like 'yes'(same as ':') or 'udp:otherhost:514'>"
# gobgpd_syslog_facility="<set as needed like 'daemon'>"
# gobgpd_foreground_enable="<default 'NO'>"
#
. /etc/rc.subr
name="gobgpd"
rcvar="gobgpd_enable"
load_rc_config $name
: ${gobgpd_enable:=NO}
: ${gobgpd_stdlog_enable:=NO}
: ${gobgpd_foreground_enable:=NO}
pidfile="/var/run/${name}.pid"
procname="%%PREFIX%%/libexec/gobgpd"
command_args="${gobgpd_flags}${gobgpd_ctype:+ -t ${gobgpd_config_type}}${gobgpd_config:+ -f ${gobgpd_config}}${gobgpd_log_level:+ --log-level=${gobgpd_log_level}}"
start_cmd="gobgpd_start"
start_precmd="gobgpd_prestart"
reload_cmd="gobgpd_reload"
sig_stop="KILL"
gobgpd_prestart () {
case "${gobgpd_flags}" in
-f*|*-f*|--config-file*|*--config-file*)
err 1 "gobgpd_flags includes the --config-file option, use gobgpd_config instead."
;;
-t*|*-t*|--config-type*|*--config-type*)
err 1 "gobgpd_flags includes the --config-type option, use gobgpd_config_type instead."
;;
-s*|*-s*|--syslog*)
err 1 "gobgpd_flags includes the --syslog option, use gobgpd_syslog_host instead."
;;
--syslog-facility*|*--syslog-facility*)
err 1 "gobgpd_flags includes the --syslog-facility option, use gobgpd_syslog_host instead."
;;
--disable-stdlog*|*--disable-stdlog*)
err 1 "gobgpd_flags includes the --disable-stdlog option, use gobgpd_stdlog_enable instead."
;;
--log-level*|*--log-level*)
err 1 "gobgpd_flags includes the --log-level option, use gobgp_log_level instead."
;;
-d*|*-d*|--dry-run*|*--dry-run*)
err 1 "gobgpd_flags doesn't require --dry-run option."
;;
-h*|*-h*|--help*|*--help*)
err 1 "gobgpd_flags doesn't require --help option."
;;
esac
case "x${gobgpd_config_type}" in
x|xtoml|xyaml|xjson)
;;
*)
err 1 "gobgpd_config_type requires one of 'toml', 'yaml' or 'json'."
esac
if [ -f ${gobgpd_config} ]; then
${procname} --dry-run ${command_args} > /dev/null
if [ $? -ne 0 ]; then
err 1 $(${procname} --dry-run --log-plain ${command_args})
fi
fi
}
gobgpd_start () {
if checkyesno gobgpd_foreground_enable; then
${procname} ${command_args} $(checkyesno gobgpd_stdlog_enable || echo --disable-stdlog) ${gobgpd_syslog_host:+ --syslog=${gobgpd_syslog_host}}${gobgpd_syslog_facility:+ --syslog-facility=${gobgpd_syslog_facility}}
else
echo "Starting ${name}."
/usr/sbin/daemon -c -p ${pidfile} ${procname} ${command_args} $(checkyesno gobgpd_stdlog_enable || echo --disable-stdlog) ${gobgpd_syslog_host:+ --syslog=${gobgpd_syslog_host}}${gobgpd_syslog_facility:+ --syslog-facility=${gobgpd_syslog_facility}}
fi
}
gobgpd_reload () {
echo "Graceful Restarting ${name}."
${procname} --graceful-restart ${command_args}
}
run_rc_command "$1"

View File

@ -0,0 +1,17 @@
--- server/sockopt_bsd.go.orig 2018-02-09 18:45:37 UTC
+++ server/sockopt_bsd.go
@@ -23,13 +23,12 @@ import (
)
const (
- TCP_MD5SIG = 0x10 // TCP MD5 Signature (RFC2385)
IPV6_MINHOPCOUNT = 73 // Generalized TTL Security Mechanism (RFC5082)
)
func setsockoptTcpMD5Sig(fd int, address string, key string) error {
// always enable and assumes that the configuration is done by setkey()
- return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, TCP_MD5SIG, 1))
+ return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, syscall.TCP_MD5SIG, 1))
}
func setTcpMD5SigSockopt(l *net.TCPListener, address string, key string) error {

View File

@ -0,0 +1,16 @@
--- server/sockopt_openbsd.go.orig 2018-02-09 18:45:43 UTC
+++ server/sockopt_openbsd.go
@@ -348,12 +348,11 @@ func saDelete(address string) error {
}
const (
- TCP_MD5SIG = 0x4 // TCP MD5 Signature (RFC2385)
IPV6_MINHOPCOUNT = 73 // Generalized TTL Security Mechanism (RFC5082)
)
func setsockoptTcpMD5Sig(fd int, address string, key string) error {
- if err := syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, TCP_MD5SIG, 1); err != nil {
+ if err := syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, syscall.TCP_MD5SIG, 1); err != nil {
return os.NewSyscallError("setsockopt", err)
}
if len(key) > 0 {

7
net/gobgp/pkg-descr Normal file
View File

@ -0,0 +1,7 @@
GoBGP: BGP implementation in Go
GoBGP is an open source BGP implementation designed from scratch
for modern environment and implemented in a modern programming
language, the Go Programming Language.
WWW: https://github.com/osrg/gobgp