Index: head/net/exabgp/Makefile =================================================================== --- head/net/exabgp/Makefile (revision 490391) +++ head/net/exabgp/Makefile (revision 490392) @@ -1,49 +1,50 @@ # Created by: Ryan Steinmetz # $FreeBSD$ PORTNAME= exabgp PORTVERSION= 3.4.25 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= GH \ ZI MAINTAINER= zi@FreeBSD.org COMMENT= BGP engine and route injector RUN_DEPENDS= ${PY_IPADDRESS} LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/COPYRIGHT USE_GITHUB= yes GH_ACCOUNT= Exa-Networks USES= python:2.7 SUB_FILES= pkg-message exabgp.sh SUB_LIST= PYTHON_LIBDIR=${PYTHON_LIBDIR} PYTHON_CMD=${PYTHON_CMD} \ PYTHON_SITELIBDIR=${PYTHON_SITELIBDIR} USE_RC_SUBR= ${PORTNAME} NO_ARCH= yes USERS= _bgpd GROUPS= _bgpd OPTIONS_DEFINE= EXAMPLES post-extract: @${MV} -f ${WRKSRC}/etc/systemd ${WRKSRC} do-build: ${PYTHON_CMD} -m compileall ${WRKSRC}/lib do-install: ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME}.sh ${STAGEDIR}${PREFIX}/sbin/${PORTNAME} ${INSTALL_MAN} ${WRKSRC}/doc/man/${PORTNAME}.1 ${STAGEDIR}${PREFIX}/man/man1 @${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME} ${STAGEDIR}${ETCDIR} (cd ${WRKSRC}/lib && ${COPYTREE_SHARE} . ${STAGEDIR}${PYTHON_SITELIBDIR}) ${INSTALL_DATA} ${FILESDIR}/exabgp.env ${STAGEDIR}${ETCDIR}/exabgp.env.sample do-install-EXAMPLES-on: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} (cd ${WRKSRC}/etc/exabgp && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}) .include Index: head/net/exabgp/files/exabgp.env =================================================================== --- head/net/exabgp/files/exabgp.env (revision 490391) +++ head/net/exabgp/files/exabgp.env (revision 490392) @@ -1,33 +1,53 @@ +[exabgp.api] +encoder = text +highres = false +respawn = false +socket = '' +[exabgp.bgp] +openwait = 60 + +[exabgp.cache] +attributes = true +nexthops = true + [exabgp.daemon] daemonize = true +drop = true pid = '/var/run/exabgp/exabgp.pid' user = '_bgpd' [exabgp.log] all = false configuration = false daemon = true destination = '/var/log/exabgp/exabgp.log' enable = true level = INFO message = false network = true packets = false parser = false processes = true +reactor = true rib = false routes = false short = false -supervisor = true timers = false [exabgp.pdb] enable = false [exabgp.profile] enable = false file = '' +[exabgp.reactor] +speed = 1.0 + [exabgp.tcp] -timeout = 1 +acl = false +bind = '' +delay = 0 +once = false +port = 179 Index: head/net/exabgp/files/exabgp.in =================================================================== --- head/net/exabgp/files/exabgp.in (revision 490391) +++ head/net/exabgp/files/exabgp.in (revision 490392) @@ -1,57 +1,63 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: exabgp # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following line(s) to /etc/rc.conf to enable exabgp: # # exabgp_enable="YES" . /etc/rc.subr name=exabgp rcvar=exabgp_enable load_rc_config $name exabgp_enable=${exabgp_enable:-"NO"} exabgp_conf=${exabgp_conf:-"%%ETCDIR%%/exabgp.conf"} pidfile=/var/run/${name}/${name}.pid required_files=${exabgp_conf} -command="%%PYTHON_SITELIBDIR%%/${name}/application/bgp.py" -procname="%%PYTHON_CMD%%" +command="%%PYTHON_CMD%%" +command_args="-m exabgp --folder /usr/local/etc/exabgp ${exabgp_conf}" -start_cmd="exabgp_start" +configtest_cmd="exabgp_configtest" +start_precmd="exabgp_precmd" +reload_precmd="exabgp_configtest" +restart_precmd="exabgp_configtest" reload_all_cmd="exabgp_reload_all" -extra_commands="reload reload_all" +reload_all_precmd="exabgp_configtest" +extra_commands="configtest reload reload_all" sig_reload="USR1" -exabgp_start() +exabgp_reload_all() { - if [ -z "$rc_fast" -a -n "$rc_pid" ]; then - echo 1>&2 "${name} already running? (pid=$rc_pid)." - return 1 + echo "Reloading exabgp configuration and processes." + kill -USR2 $rc_pid +} + +exabgp_configtest() +{ + echo "Performing sanity check on ${name} configuration." + result=$(env exabgp.log.configuration=true exabgp.daemon.daemonize=false exabgp.log.level=ERR exabgp.log.destination=stdout ${command} -m ${name} --folder /usr/local/etc/exabgp -t ${exabgp_conf} 2>&1) + if [ ! -z "${result}" ]; then + echo "${result}" + err 1 "Failed to validate configuration file, aborting." fi +} - echo "Starting ${name}." - +exabgp_precmd() +{ + exabgp_configtest install -d -o _bgpd -g _bgpd -m 755 /var/run/${name} install -d -o _bgpd -g _bgpd -m 755 /var/log/${name} rm -f ${pidfile} - - ${procname} ${command} --folder %%ETCDIR%% ${exabgp_conf} -} - -exabgp_reload_all() -{ - echo "Reloading exabgp configuration and processes." - kill -USR2 $rc_pid } run_rc_command "$1" Index: head/net/exabgp/files/exabgp.sh.in =================================================================== --- head/net/exabgp/files/exabgp.sh.in (revision 490391) +++ head/net/exabgp/files/exabgp.sh.in (revision 490392) @@ -1,16 +1,16 @@ #!/bin/sh export PYTHONPATH=%%PYTHON_LIBDIR%%:%%PYTHON_SITELIBDIR%%/exabgp INTERPRETER=%%PYTHON_CMD%% APPLICATIONS=`$INTERPRETER -c "import sys,os; print ' '.join(os.path.join(_,'exabgp','application','bgp.py') for _ in sys.path if os.path.isfile('/'.join((_,'exabgp','application','bgp.py'))))"` APPLICATION=`echo $APPLICATIONS | awk '{ print $1; }'` if [ $# -eq 0 ]; then - $INTERPRETER -m exabgp.debug $APPLICATION --folder %%PREFIX%%/etc/exabgp --help + $INTERPRETER -m exabgp $APPLICATION --folder %%PREFIX%%/etc/exabgp --help echo "===> To start exabgp, you should use:" echo "===> service exabgp start" else - exec $INTERPRETER -m exabgp.debug $APPLICATION --folder %%PREFIX%%/etc/exabgp $* + exec $INTERPRETER -m exabgp $APPLICATION --folder %%PREFIX%%/etc/exabgp $* fi