From 10863a75b871a0705869f8c616b1663474b07b27 Mon Sep 17 00:00:00 2001 From: Florent Thoumie Date: Tue, 17 May 2005 14:46:42 +0000 Subject: [PATCH] - Add openbgpd 3.6, a free implementation of the Border Gateway Protocol. Credits to: Lukasz Bromirski --- net/Makefile | 1 + net/openbgpd/Makefile | 63 +++++++++++++++++++++++ net/openbgpd/distinfo | 6 +++ net/openbgpd/files/openbgpd.sh.in | 31 +++++++++++ net/openbgpd/files/patch-bgpctl_bgpctl.8 | 16 ++++++ net/openbgpd/files/patch-bgpctl_bgpctl.c | 18 +++++++ net/openbgpd/files/patch-bgpd_Makefile | 14 +++++ net/openbgpd/files/patch-bgpd_bgpd.8 | 37 +++++++++++++ net/openbgpd/files/patch-bgpd_bgpd.conf.5 | 30 +++++++++++ net/openbgpd/files/patch-bgpd_bgpd.h | 14 +++++ net/openbgpd/files/patch-bgpd_session.c | 15 ++++++ net/openbgpd/pkg-descr | 8 +++ 12 files changed, 253 insertions(+) create mode 100644 net/openbgpd/Makefile create mode 100644 net/openbgpd/distinfo create mode 100644 net/openbgpd/files/openbgpd.sh.in create mode 100644 net/openbgpd/files/patch-bgpctl_bgpctl.8 create mode 100644 net/openbgpd/files/patch-bgpctl_bgpctl.c create mode 100644 net/openbgpd/files/patch-bgpd_Makefile create mode 100644 net/openbgpd/files/patch-bgpd_bgpd.8 create mode 100644 net/openbgpd/files/patch-bgpd_bgpd.conf.5 create mode 100644 net/openbgpd/files/patch-bgpd_bgpd.h create mode 100644 net/openbgpd/files/patch-bgpd_session.c create mode 100644 net/openbgpd/pkg-descr diff --git a/net/Makefile b/net/Makefile index 308ba80d029b..ed51585c2a35 100644 --- a/net/Makefile +++ b/net/Makefile @@ -443,6 +443,7 @@ SUBDIR += olsrd SUBDIR += onenetd SUBDIR += openam + SUBDIR += openbgpd SUBDIR += opendchub SUBDIR += opengk SUBDIR += openh323 diff --git a/net/openbgpd/Makefile b/net/openbgpd/Makefile new file mode 100644 index 000000000000..f8c74b2d35cd --- /dev/null +++ b/net/openbgpd/Makefile @@ -0,0 +1,63 @@ +# New ports collection makefile for: openbgpd +# Date created: May 10 2005 +# Whom: Florent Thoumie +# +# $FreeBSD$ +# + +PORTNAME= openbgpd +PORTVERSION= 3.6 +CATEGORIES= net +MASTER_SITES= ftp://ftp.openbsd.org/pub/OpenBSD/OpenBGPD/:openbsd \ + ${MASTER_SITE_LOCAL:S/$/:freebsd/g} +MASTER_SITE_SUBDIR= flz/openbgpd/:freebsd +DISTFILES= ${PORTNAME}-${PORTVERSION}.tgz:openbsd \ + if_media.h:freebsd pfkey_compat.c:freebsd +DIST_SUBDIR= openbgpd +EXTRACT_ONLY= ${PORTNAME}-${PORTVERSION}.tgz + +MAINTAINER= flz@FreeBSD.org +COMMENT= Free implementation of the Border Gateway Protocol, Version 4 + +WRKSRC= ${WRKDIR} +MANCOMPRESSED= yes +USE_RC_SUBR= openbgpd.sh +USE_REINPLACE= yes +MAKE_ENV= BINDIR="${PREFIX}/sbin" \ + MANDIR="${PREFIX}/man/man" + +PLIST_FILES= sbin/bgpctl \ + sbin/bgpd + +MAN5= bgpd.conf.5 +MAN8= bgpctl.8 \ + bgpd.8 + +SUBDIRS= bgpd \ + bgpctl + +.include + +post-extract: + @${CP} ${DISTDIR}/${DIST_SUBDIR}/if_media.h ${WRKSRC}/bgpctl/ + @${CP} ${DISTDIR}/${DIST_SUBDIR}/pfkey_compat.c ${WRKSRC}/bgpd/ + +post-patch: + @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \ + ${WRKSRC}/bgpd/Makefile \ + ${WRKSRC}/bgpd/bgpd.8 \ + ${WRKSRC}/bgpd/bgpd.h \ + ${WRKSRC}/bgpd/bgpd.conf.5 \ + ${WRKSRC}/bgpctl/Makefile + +do-build: +.for i in ${SUBDIRS} + cd ${WRKSRC}/$i; make +.endfor + +do-install: +.for i in ${SUBDIRS} + cd ${WRKSRC}/$i; make install ${MAKE_ENV} +.endfor + +.include diff --git a/net/openbgpd/distinfo b/net/openbgpd/distinfo new file mode 100644 index 000000000000..355886db62d5 --- /dev/null +++ b/net/openbgpd/distinfo @@ -0,0 +1,6 @@ +MD5 (openbgpd/openbgpd-3.6.tgz) = e40c5dce08c3c0e7fb232bdd5ea11523 +SIZE (openbgpd/openbgpd-3.6.tgz) = 109058 +MD5 (openbgpd/if_media.h) = 4ff9297f5c133425dafe3ca565c0f811 +SIZE (openbgpd/if_media.h) = 23762 +MD5 (openbgpd/pfkey_compat.c) = 8c3bdf02fd308b327bd30e09674c1858 +SIZE (openbgpd/pfkey_compat.c) = 360 diff --git a/net/openbgpd/files/openbgpd.sh.in b/net/openbgpd/files/openbgpd.sh.in new file mode 100644 index 000000000000..eb7a8311a283 --- /dev/null +++ b/net/openbgpd/files/openbgpd.sh.in @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: bgpd +# REQUIRE: LOGIN abi +# BEFORE: securelevel +# KEYWORD: FreeBSD shutdown + +# Add the following line to /etc/rc.conf to enable `openbgpd': +# +# openbgpd_enable="YES" +# +# See bgpd(8) for openbgpd_flags +# + +. "%%RC_SUBR%%" + +name="openbgpd" +rcvar=`set_rcvar` + +extra_commands="reload" +command="%%PREFIX%%/sbin/bgpd" +required_files="%%PREFIX%%/etc/bgpd.conf" + +load_rc_config "$name" +: ${openbgpd_enable="NO"} +: ${openbgpd_flags=""} + +run_rc_command "$1" diff --git a/net/openbgpd/files/patch-bgpctl_bgpctl.8 b/net/openbgpd/files/patch-bgpctl_bgpctl.8 new file mode 100644 index 000000000000..9000ace56664 --- /dev/null +++ b/net/openbgpd/files/patch-bgpctl_bgpctl.8 @@ -0,0 +1,16 @@ + +$FreeBSD$ + +--- bgpctl/bgpctl.8.orig ++++ bgpctl/bgpctl.8 +@@ -138,8 +138,8 @@ + and message counters. + .El + .Sh FILES +-.Bl -tag -width "/etc/bgpd.conf" -compact +-.It Pa /etc/bgpd.conf ++.Bl -tag -width "%%PREFIX%%/etc/bgpd.conf" -compact ++.It Pa %%PREFIX%%/etc/bgpd.conf + default + .Xr bgpd 8 + configuration file diff --git a/net/openbgpd/files/patch-bgpctl_bgpctl.c b/net/openbgpd/files/patch-bgpctl_bgpctl.c new file mode 100644 index 000000000000..3233ff2c8245 --- /dev/null +++ b/net/openbgpd/files/patch-bgpctl_bgpctl.c @@ -0,0 +1,18 @@ +--- bgpctl/bgpctl.c.orig Fri Aug 20 17:49:35 2004 ++++ bgpctl/bgpctl.c Sun Mar 20 15:27:10 2005 +@@ -20,7 +20,6 @@ + #include + #include + #include +-#include + #include + + #include +@@ -35,6 +34,7 @@ + #include "rde.h" + #include "log.h" + #include "parser.h" ++#include "if_media.h" + + enum neighbor_views { + NV_DEFAULT, diff --git a/net/openbgpd/files/patch-bgpd_Makefile b/net/openbgpd/files/patch-bgpd_Makefile new file mode 100644 index 000000000000..45a2fa56b7de --- /dev/null +++ b/net/openbgpd/files/patch-bgpd_Makefile @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- bgpd/Makefile.orig ++++ bgpd/Makefile +@@ -5,7 +5,7 @@ + PROG= bgpd + SRCS= bgpd.c buffer.c session.c log.c parse.y config.c imsg.c \ + rde.c rde_rib.c rde_decide.c rde_prefix.c mrt.c kroute.c \ +- control.c pfkey.c rde_update.c rde_attr.c printconf.c \ ++ control.c pfkey_compat.c rde_update.c rde_attr.c printconf.c \ + rde_filter.c pftable.c + CFLAGS+= -Wall -I${.CURDIR} + CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes diff --git a/net/openbgpd/files/patch-bgpd_bgpd.8 b/net/openbgpd/files/patch-bgpd_bgpd.8 new file mode 100644 index 000000000000..5810275fa85e --- /dev/null +++ b/net/openbgpd/files/patch-bgpd_bgpd.8 @@ -0,0 +1,37 @@ + +$FreeBSD$ + +--- bgpd/bgpd.8.orig ++++ bgpd/bgpd.8 +@@ -46,9 +46,9 @@ + .Nm + is usually started at boot time, and can be enabled by + setting the following in +-.Pa /etc/rc.conf.local : ++.Pa /etc/rc.conf : + .Pp +-.Dl bgpd_flags=\&"\&" ++.Dl openbgpd_enable=\&"YES\&" + .Pp + See + .Xr rc 8 +@@ -90,7 +90,7 @@ + .Ar file + as the configuration file, + instead of the default +-.Pa /etc/bgpd.conf . ++.Pa %%PREFIX%%/etc/bgpd.conf . + .It Fl n + Configtest mode. + Only check the configuration file for validity. +@@ -98,8 +98,8 @@ + Produce more verbose output. + .El + .Sh FILES +-.Bl -tag -width "/etc/bgpd.confXXX" -compact +-.It Pa /etc/bgpd.conf ++.Bl -tag -width "%%PREFIX%%/etc/bgpd.confXXX" -compact ++.It Pa %%PREFIX%%/etc/bgpd.conf + default + .Nm + configuration file diff --git a/net/openbgpd/files/patch-bgpd_bgpd.conf.5 b/net/openbgpd/files/patch-bgpd_bgpd.conf.5 new file mode 100644 index 000000000000..4946c71f101a --- /dev/null +++ b/net/openbgpd/files/patch-bgpd_bgpd.conf.5 @@ -0,0 +1,30 @@ + +$FreeBSD$ + +--- bgpd/bgpd.conf.5.orig ++++ bgpd/bgpd.conf.5 +@@ -431,11 +431,11 @@ + With + .Xr isakmpd 8 , + it is sufficient to copy the peer's public key, found in +-.Pa /etc/isakmpd/private/local.pub , ++.Pa %%PREFIX%%/etc/isakmpd/private/local.pub , + to the local machine. + It must be stored in a file + named after the peer's IP address and must be stored in +-.Pa /etc/isakmpd/pubkeys/ipv4/ . ++.Pa %%PREFIX%%/etc/isakmpd/pubkeys/ipv4/ . + The local public key must be copied to the peer in the same way. + As + .Xr bgpd 8 +@@ -819,8 +819,8 @@ + .Em AS path . + .El + .Sh FILES +-.Bl -tag -width "/etc/bgpd.conf" -compact +-.It Pa /etc/bgpd.conf ++.Bl -tag -width "%%PREFIX%%/etc/bgpd.conf" -compact ++.It Pa %%PREFIX%%/etc/bgpd.conf + .Xr bgpd 8 + configuration file + .El diff --git a/net/openbgpd/files/patch-bgpd_bgpd.h b/net/openbgpd/files/patch-bgpd_bgpd.h new file mode 100644 index 000000000000..e9aa00e8afaa --- /dev/null +++ b/net/openbgpd/files/patch-bgpd_bgpd.h @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- bgpd/bgpd.h.orig ++++ bgpd/bgpd.h +@@ -31,7 +31,7 @@ + + #define BGP_VERSION 4 + #define BGP_PORT 179 +-#define CONFFILE "/etc/bgpd.conf" ++#define CONFFILE "%%PREFIX%%/etc/bgpd.conf" + #define BGPD_USER "_bgpd" + #define PEER_DESCR_LEN 32 + #define PFTABLE_LEN 16 diff --git a/net/openbgpd/files/patch-bgpd_session.c b/net/openbgpd/files/patch-bgpd_session.c new file mode 100644 index 000000000000..71f749f170db --- /dev/null +++ b/net/openbgpd/files/patch-bgpd_session.c @@ -0,0 +1,15 @@ +--- bgpd/session.c.orig Thu Sep 9 23:53:57 2004 ++++ bgpd/session.c Sun Mar 20 15:33:51 2005 +@@ -206,9 +206,12 @@ + setproctitle("session engine"); + bgpd_process = PROC_SE; + ++/* we don't have PF_KEY implemented in a way OpenBSD has ++ + if (pfkey_init(&sysdep) == -1) + fatalx("pfkey setup failed"); + ++*/ + if (setgroups(1, &pw->pw_gid) || + setegid(pw->pw_gid) || setgid(pw->pw_gid) || + seteuid(pw->pw_uid) || setuid(pw->pw_uid)) diff --git a/net/openbgpd/pkg-descr b/net/openbgpd/pkg-descr new file mode 100644 index 000000000000..0a17fc34bbde --- /dev/null +++ b/net/openbgpd/pkg-descr @@ -0,0 +1,8 @@ +OpenBGPD is a FREE implementation of the Border Gateway Protocol, Version 4. +It allows ordinary machines to be used as routers exchanging routes with +other systems speaking the BGP protocol. + +WWW: http://www.openbgp.org/ + +- Florent Thoumie +flz@xbsd.org