diff --git a/.gitignore b/.gitignore index 01b0bad7d2..6592b34004 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,10 @@ cscope.* *.pb.h *.pb-c.h *.pb-c.c +TAGS +tags +GTAGS +GSYMS +GRTAGS +GPATH + diff --git a/ChangeLog b/ChangeLog index 2ed5061be4..a201bb6819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -ChangeLog information for Quagga is now recorded in our source-code +ChangeLog information for FreeRangeRouting is for now recorded in source-code management system. Please see: - http://www.quagga.net/devel.php + http://www.freerangerouting.org/ diff --git a/Makefile.am b/Makefile.am index d9b57a5eae..63dedeac06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,11 +3,11 @@ SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \ @BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \ @ISISD@ @PIMD@ @WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \ - redhat @SOLARIS@ tests tools cumulus + redhat @SOLARIS@ tests tools cumulus snapcraft DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \ isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \ - solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus + solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus snapcraft EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \ update-autotools \ diff --git a/REPORTING-BUGS b/REPORTING-BUGS index 83f4eb990a..ea36ff5eed 100644 --- a/REPORTING-BUGS +++ b/REPORTING-BUGS @@ -1,5 +1,5 @@ -This file describes the procedure for reporting Quagga bugs. You are not -obliged to follow this format, but it would be great help for Quagga developers +This file describes the procedure for reporting FreeRangeRouting bugs. You are not +obliged to follow this format, but it would be great help for FreeRangeRouting developers if you report a bug as described below. Bugs submitted with woefully incomplete information may be summarily @@ -9,23 +9,24 @@ additional information. Bugs may be closed after 30 days of non-response to requests to reconfirm or supply additional information. -Report bugs http://bugzilla.quagga.net +Report bugs on Github Issue Tracker at + https://github.com/freerangerouting/frr/issues Please supply the following information: -1. Your Quagga version or if it is from git then the commit reference. +1. Your FreeRangeRouting version or if it is from git then the commit reference. Please try to report bugs against git master or the latest release. -2. Quagga daemons you run e.g. bgpd or ripd and full name of your OS. Any +2. FRR daemons you run e.g. bgpd or ripd and full name of your OS. Any specific options you compiled Quagga with. 3. Problem description. Copy and paste relative commands and their output to describe your network setup e.g. "zebra>show ip route". Please, also give your simple network layout and output of relative OS commands (e.g., ifconfig (BSD) or ip (Linux)). -4. All Quagga configuration files you use. If you don't want to publish your +4. All FRR configuration files you use. If you don't want to publish your network numbers change 2 middle bytes in IPv4 address to be XXX (e.g. 192.XXX.XXX.32/24). Similar could be done with IPv6. -5. If any Quagga daemon core dumped, please, supply stack trace using the +5. If any FRR daemon core dumped, please, supply stack trace using the following commands: host> gdb exec_file core_file , (gdb) bt . -6. Run all Quagga daemons with full debugging on (see documentation on +6. Run all FRR daemons with full debugging on (see documentation on debugging) and send _only_ part of logs which are relative to your problem. 7. If the problem is difficult to reproduce please send a shell script to reproduce it. diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 7892005f08..b8158dc31e 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -171,6 +171,9 @@ bgp_bfd_deregister_peer (struct peer *peer) if (!CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_REG)) return; + bfd_info->status = BFD_STATUS_DOWN; + bfd_info->last_update = bgp_clock(); + bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER); } @@ -311,14 +314,14 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, prefix2str(&dp, buf[0], sizeof(buf[0])); if (ifp) { - zlog_debug("Zebra: interface %s bfd destination %s %s", - ifp->name, buf[0], bfd_get_status_str(status)); + zlog_debug("Zebra: vrf %d interface %s bfd destination %s %s", + vrf_id, ifp->name, buf[0], bfd_get_status_str(status)); } else { prefix2str(&sp, buf[1], sizeof(buf[1])); - zlog_debug("Zebra: source %s bfd destination %s %s", - buf[1], buf[0], bfd_get_status_str(status)); + zlog_debug("Zebra: vrf %d source %s bfd destination %s %s", + vrf_id, buf[1], buf[0], bfd_get_status_str(status)); } } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 8dd753d272..84ece48850 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -91,7 +91,7 @@ struct bgp_dump struct thread *t_interval; }; -static int bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump); +static int bgp_dump_unset (struct bgp_dump *bgp_dump); static int bgp_dump_interval_func (struct thread *); /* BGP packet dump output buffer. */ @@ -657,7 +657,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, } /* Removing previous config */ - bgp_dump_unset(vty, bgp_dump); + bgp_dump_unset(bgp_dump); if (interval_str) { @@ -696,7 +696,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, } static int -bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump) +bgp_dump_unset (struct bgp_dump *bgp_dump) { /* Removing file name. */ if (bgp_dump->filename) @@ -817,7 +817,7 @@ DEFUN (no_dump_bgp_all, break; } - return bgp_dump_unset (vty, bgp_dump_struct); + return bgp_dump_unset (bgp_dump_struct); } /* BGP node structure. */ @@ -919,6 +919,10 @@ bgp_dump_init (void) void bgp_dump_finish (void) { + bgp_dump_unset (&bgp_dump_all); + bgp_dump_unset (&bgp_dump_updates); + bgp_dump_unset (&bgp_dump_routes); + stream_free (bgp_dump_obuf); bgp_dump_obuf = NULL; } diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 23514dece4..9607d381d9 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -40,6 +40,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "queue.h" #include "vrf.h" #include "bfd.h" +#include "sockopt.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" @@ -60,6 +61,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #endif /* bgpd options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 static const struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -70,6 +72,7 @@ static const struct option longopts[] = { "listenon", required_argument, NULL, 'l'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK }, { "retain", no_argument, NULL, 'r'}, { "no_kernel", no_argument, NULL, 'n'}, { "user", required_argument, NULL, 'u'}, @@ -112,6 +115,9 @@ static struct quagga_signal_t bgp_signals[] = /* Configuration file and directory. */ char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = BGP_VTYSH_PATH; + /* Route retain mode flag. */ static int retain_mode = 0; @@ -124,6 +130,7 @@ static const char *pid_file = PATH_BGPD_PID; /* VTY port number and address. */ int vty_port = BGP_VTY_PORT; char *vty_addr = NULL; +char *vty_sock_name; /* privileges */ static zebra_capabilities_t _caps_p [] = @@ -166,6 +173,7 @@ redistribution between different routing protocols.\n\n\ -l, --listenon Listen on specified address (implies -n)\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -r, --retain When program terminates, retain added route by bgpd.\n\ -n, --no_kernel Do not install route to kernel.\n\ -u, --user User to run as\n\ @@ -196,7 +204,7 @@ sighup (void) vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -303,6 +311,8 @@ bgp_exit (int status) if (zlog_default) closezlog (zlog_default); + memset (bm, 0, sizeof (*bm)); + if (bgp_debug_count()) log_memstats_stderr ("bgpd"); exit (status); @@ -470,6 +480,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = BGP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, BGP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -545,7 +558,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Make bgp vty socket. */ - vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT, diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 15d26af0b5..52a27e51e4 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4271,6 +4271,7 @@ peer_update_source_vty (struct vty *vty, const char *peer_str, const char *source_str) { struct peer *peer; + struct prefix p; peer = peer_and_group_lookup_vty (vty, peer_str); if (! peer) @@ -4287,7 +4288,16 @@ peer_update_source_vty (struct vty *vty, const char *peer_str, if (ret == 0) peer_update_source_addr_set (peer, &su); else - peer_update_source_if_set (peer, source_str); + { + if (str2prefix (source_str, &p)) + { + vty_out (vty, "%% Invalid update-source, remove prefix length %s", + VTY_NEWLINE); + return CMD_WARNING; + } + else + peer_update_source_if_set (peer, source_str); + } } else peer_update_source_unset (peer); @@ -8217,11 +8227,19 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js tm = gmtime(&uptime); json_object_int_add(json_neigh, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); json_object_string_add(json_neigh, "lastResetDueTo", peer_down_str[(int) p->last_reset]); - if (p->last_reset_cause_size) + if (p->last_reset == PEER_DOWN_NOTIFY_SEND || + p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) { char errorcodesubcode_hexstr[5]; + char errorcodesubcode_str[256]; + + code_str = bgp_notify_code_str(p->notify.code); + subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); + sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); json_object_string_add(json_neigh, "lastErrorCodeSubcode", errorcodesubcode_hexstr); + snprintf(errorcodesubcode_str, 255, "%s%s", code_str, subcode_str); + json_object_string_add(json_neigh, "lastNotificationReason", errorcodesubcode_str); } } else diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index b0c163f1e3..fc6968e9d9 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6723,26 +6723,27 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp, } /* advertisement-interval */ - if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) - && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV - && ! peer_group_active (peer)) + if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) && + ((! peer_group_active (peer) && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV) || + (peer_group_active (peer) && peer->v_routeadv != g_peer->v_routeadv))) { vty_out (vty, " neighbor %s advertisement-interval %d%s", addr, peer->v_routeadv, VTY_NEWLINE); } /* timers */ - if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER) - && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME) - && ! peer_group_active (peer)) + if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER) && + ((! peer_group_active (peer) && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME)) || + (peer_group_active (peer) && (peer->keepalive != g_peer->keepalive || peer->holdtime != g_peer->holdtime)))) { vty_out (vty, " neighbor %s timers %d %d%s", addr, peer->keepalive, peer->holdtime, VTY_NEWLINE); } if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) && - peer->connect != BGP_DEFAULT_CONNECT_RETRY && - ! peer_group_active (peer)) + ((! peer_group_active (peer) && peer->connect != BGP_DEFAULT_CONNECT_RETRY) || + (peer_group_active (peer) && peer->connect != g_peer->connect))) + { vty_out (vty, " neighbor %s timers connect %d%s", addr, peer->connect, VTY_NEWLINE); diff --git a/buildtest.sh b/buildtest.sh index eafd57dbf3..cbe6962a43 100755 --- a/buildtest.sh +++ b/buildtest.sh @@ -4,7 +4,7 @@ # builds some git commit of Quagga in some different configurations # usage: buildtest.sh [commit [configurations...]] -basecfg="--prefix=/usr --enable-user=quagga --enable-group=quagga --enable-vty-group=quagga --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/quagga --enable-exampledir=/etc/quagga/samples --localstatedir=/var/run/quagga --libdir=/usr/lib64/quagga --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror" +basecfg="--prefix=/usr --enable-user=frr --enable-group=frr --enable-vty-group=frr --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/frr --enable-exampledir=/etc/frr/samples --localstatedir=/var/run/frr --libdir=/usr/lib64/frr --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror" configs_base="gcc|$basecfg" @@ -36,7 +36,7 @@ trap errfunc ERR COMMITREF="$1" COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`" -TEMP="`mktemp -t -d quaggabuild.XXXXXX`" +TEMP="`mktemp -t -d frrbuild.XXXXXX`" BASE="`pwd`" CONFIGS="$2" diff --git a/common.am b/common.am index ac7a3230da..c6da3d75e8 100644 --- a/common.am +++ b/common.am @@ -30,9 +30,9 @@ Q_PROTOBUF_SRCS = $(Q_PROTOBUF_CFILES) $(Q_PROTOBUF_HFILES) # # Information about how to link to various libraries. # -Q_QUAGGA_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libquagga_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) +Q_FRR_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libfrr_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) -Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfpm_pb.la $(Q_QUAGGA_PB_CLIENT_LDOPTS) +Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfpm_pb.la $(Q_FRR_PB_CLIENT_LDOPTS) endif # HAVE_PROTOBUF diff --git a/configure.ac b/configure.ac index 0ddde90e86..e7ff01f300 100755 --- a/configure.ac +++ b/configure.ac @@ -493,6 +493,7 @@ dnl ----------------------------------- if test "x${EXTRAVERSION}" != "x" ; then VERSION="${VERSION}${EXTRAVERSION}" PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}" + AC_SUBST(PACKAGE_EXTRAVERSION, ["${EXTRAVERSION}"]) PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}" fi @@ -1694,6 +1695,8 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile pkgsrc/Makefile fpm/Makefile redhat/frr.spec + snapcraft/Makefile + snapcraft/snapcraft.yaml lib/version.h doc/defines.texi doc/bgpd.8 diff --git a/debian/README.Debian b/debian/README.Debian index fb481eb456..893c1decaa 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -14,39 +14,26 @@ available forcing you to explicitly type "apt-get install frr" to upgrade it. * What is frr? ================= -http://www.freerangerouting.net/ -> Frr is a routing software suite, providing implementations of OSPFv2, -> OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms, particularly -> FreeBSD and Linux and also NetBSD, to mention a few. Frr is a fork of GNU -> Zebra which was developed by Kunihiro Ishiguro. Development of GNU Zebra -> slowed dramatically to the point where eventually GNU Zebra was forked into -> Frr. - -> The Frr tree is an attempt to provide a zebra tree with at least the -> bug-fixes, which have accumulated, applied, while tracking any significant -> changes made to the zebra.org tree. Ultimately, this tree hopes to revitalise -> development of this code base. - -I packaged zebra-pj which was then renamed to frr to get people used to it -and offer Debian users the choice which versions they like to use. I hope this -brings frr some feedback and helps it evolving to a good successor of the -orphaned zebra. - - -- Christian Hammers , Jul/Aug 2003 +http://www.freerangerouting.org/ +FRR is a routing software suite, providing implementations of OSPFv2, +OSPFv3, RIP v1 and v2, RIPng, ISIS, PIM, BGP and LDP for Unix platforms, particularly +FreeBSD and Linux and also NetBSD, to mention a few. FRR is a fork of Quagga +which itself is a fork of Zebra. +Zebra was developed by Kunihiro Ishiguro. * Why has SNMP support been disabled? ===================================== -Frr used to link against the NetSNMP libraries to provide SNMP +FRR used to link against the NetSNMP libraries to provide SNMP support. Those libraries sadly link against the OpenSSL libraries to provide crypto support for SNMPv3 among others. OpenSSL now is not compatible with the GNU GENERAL PUBLIC LICENSE (GPL) -licence that Frr is distributed under. For more explanation read: +licence that FRR is distributed under. For more explanation read: http://www.gnome.org/~markmc/openssl-and-the-gpl.html http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs Updating the licence to explecitly allow linking against OpenSSL would requite the affirmation of all people that ever contributed -a significant part to Zebra or Frr and thus are the collective +a significant part to Zebra / Quagga or FRR and thus are the collective "copyright holder". That's too much work. Using a shrinked down version of NetSNMP without OpenSSL or convincing the NetSNMP people to change to GnuTLS are maybe good solutions but not reachable @@ -55,7 +42,7 @@ during the last days before the Sarge release :-( *BUT* It is allowed by the used licence mix that you fetch the sources and -build Frr yourself with SNMP with +build FRR yourself with SNMP with # export WANT_SNMP=1 # apt-get -b source frr @@ -73,9 +60,9 @@ Default is not to start anything, since it can hose your system's routing table if not set up properly. Priorities were suggested by Dancer . -They're used to start the Frr daemons in more than one step +They're used to start the FRR daemons in more than one step (for example start one or two at network initialization and the -rest later). The number of Frr daemons being small, priorities +rest later). The number of FRR daemons being small, priorities must be between 1 and 9, inclusive (or the initscript has to be changed). /etc/init.d/frr then can be started as @@ -99,7 +86,7 @@ If this message occurs the receive buffer should be increased by adding the following to /etc/sysctl.conf and "--nl-bufsize" to /etc/frr/debian.conf. > net.core.rmem_default = 262144 > net.core.rmem_max = 262144 -See message #4525 from 2005-05-09 in the frr-users mailing list. +See message #4525 from 2005-05-09 in the quagga-users mailing list. * vtysh immediately exists: diff --git a/debian/changelog b/debian/changelog index 88cb8df28a..8302af4b4c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ frr (2.1) Released; urgency=medium * Switchover to FRR + -- frr Mon, 23 Jan 2017 16:30:22 -0400 + quagga (0.99.24+cl3u5) RELEASED; urgency=medium * Closes: CM-12846 - Resolve Memory leaks in 'show ip bgp neighbor json' diff --git a/debian/copyright b/debian/copyright index ab392027c8..6a5ed98f91 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Frr -Upstream-Contact: maintainers@freerangerouting.net, security@freerangerouting.net -Source: http://www.freerangerouting.net/ +Upstream-Contact: maintainers@freerangerouting.org, security@freerangerouting.org +Source: http://www.freerangerouting.org/ Files: * Copyright: 1996-2003 by the original Zebra authors: diff --git a/doc/frr.texi b/doc/frr.texi index 360acebe16..d4a78b7b81 100644 --- a/doc/frr.texi +++ b/doc/frr.texi @@ -7,7 +7,7 @@ @setfilename frr.info @c Set variables - sourced from defines.texi @include defines.texi -@settitle @uref{http://www.freerangerouting.net,,@value{PACKAGE_NAME}} +@settitle @uref{http://www.freerangerouting.org,,@value{PACKAGE_NAME}} @c %**end of header @c automake will automatically generate version.texi @@ -48,16 +48,16 @@ This file documents the Frr Software Routing Suite which manages common TCP/IP routing protocols. This is Edition @value{EDITION}, last updated @value{UPDATED} of -@cite{The Frr Manual}, for @uref{http://www.freerangerouting.net/,,@value{PACKAGE_NAME}} +@cite{The Frr Manual}, for @uref{http://www.freerangerouting.org/,,@value{PACKAGE_NAME}} Version @value{VERSION}. @insertcopying @end ifinfo @titlepage -@title @uref{http://www.freerangerouting.net,,Frr} +@title @uref{http://www.freerangerouting.org,,Frr} @subtitle A routing software package for TCP/IP networks -@subtitle @uref{http://www.freerangerouting.net,,@value{PACKAGE_NAME}} @value{VERSION} +@subtitle @uref{http://www.freerangerouting.org,,@value{PACKAGE_NAME}} @value{VERSION} @subtitle @value{UPDATED-MONTH} @author @value{AUTHORS} @@ -72,9 +72,9 @@ Version @value{VERSION}. @node Top @top Frr -- With Virtual Network Control -@uref{http://www.freerangerouting.net,,Frr} is an advanced routing software package +@uref{http://www.freerangerouting.org,,Frr} is an advanced routing software package that provides a suite of TCP/IP based routing protocols. This is the Manual -for @value{PACKAGE_STRING}. @uref{http://www.freerangerouting.net,,Frr} is a fork of +for @value{PACKAGE_STRING}. @uref{http://www.freerangerouting.org,,Frr} is a fork of @uref{http://www.quagga.net,,Quagga}. @insertcopying diff --git a/doc/overview.texi b/doc/overview.texi index d1e8ea48b2..370ada3f8a 100644 --- a/doc/overview.texi +++ b/doc/overview.texi @@ -2,7 +2,7 @@ @chapter Overview @cindex Overview - @uref{http://www.freerangerouting.net,,Frr} is a routing software package that + @uref{http://www.freerangerouting.org,,Frr} is a routing software package that provides TCP/IP based routing services with routing protocols support such as RIPv1, RIPv2, RIPng, OSPFv2, OSPFv3, IS-IS, BGP-4, and BGP-4+ (@pxref{Supported RFCs}). Frr also supports special BGP Route Reflector and Route Server @@ -275,12 +275,12 @@ November 1995.} The official Frr web-site is located at: -@uref{http://www.freerangerouting.net/} +@uref{http://www.freerangerouting.org/} and contains further information, as well as links to additional resources. -@uref{http://www.freerangerouting.net/,Frr} is a fork of Quagga, whose +@uref{http://www.freerangerouting.org/,Frr} is a fork of Quagga, whose web-site is located at: @uref{http://www.quagga.net/}. @@ -298,7 +298,7 @@ comments or suggestions to Frr, please subscribe to: @uref{http://lists.nox.tf/listinfo/frr-users}. -The @uref{http://www.freerangerouting.net/,,Frr} site has further information on +The @uref{http://www.freerangerouting.org/,,Frr} site has further information on the available mailing lists, see: @uref{http://lists.nox.tf/lists.php} diff --git a/isisd/isis_main.c b/isisd/isis_main.c index f34be99eca..1b9fa68051 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -38,6 +38,7 @@ #include "plist.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "qobj.h" #include "isisd/dict.h" @@ -81,6 +82,7 @@ struct zebra_privs_t isisd_privs = { }; /* isisd options */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { {"daemon", no_argument, NULL, 'd'}, {"config_file", required_argument, NULL, 'f'}, @@ -88,6 +90,7 @@ struct option longopts[] = { {"socket", required_argument, NULL, 'z'}, {"vty_addr", required_argument, NULL, 'A'}, {"vty_port", required_argument, NULL, 'P'}, + {"vty_socket", required_argument, NULL, OPTION_VTYSOCK}, {"user", required_argument, NULL, 'u'}, {"group", required_argument, NULL, 'g'}, {"version", no_argument, NULL, 'v'}, @@ -103,6 +106,9 @@ char *config_file = NULL; /* isisd program name. */ char *progname; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = ISIS_VTYSH_PATH; + int daemon_mode = 0; /* Master of threads. */ @@ -144,6 +150,7 @@ Daemon which manages IS-IS routing\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -305,6 +312,9 @@ main (int argc, char **argv, char **envp) vty_port = atoi (optarg); vty_port = (vty_port ? vty_port : ISISD_VTY_PORT); break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, ISIS_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': isisd_privs.user = optarg; break; @@ -379,7 +389,7 @@ main (int argc, char **argv, char **envp) pid_output (pid_file); /* Make isis vty socket. */ - vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("Quagga-ISISd %s starting: vty@%d", FRR_VERSION, vty_port); diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index c1526af314..4192fff9a8 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -610,12 +610,32 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, if (!tlvs->te_ipv4_reachs) tlvs->te_ipv4_reachs = list_new (); listnode_add (tlvs->te_ipv4_reachs, te_ipv4_reach); - /* this trickery is permitable since no subtlvs are defined */ - value_len += 5 + ((te_ipv4_reach->control & 0x3F) ? - ((((te_ipv4_reach->control & 0x3F) - - 1) >> 3) + 1) : 0); - pnt += 5 + ((te_ipv4_reach->control & 0x3F) ? - ((((te_ipv4_reach->control & 0x3F) - 1) >> 3) + 1) : 0); + + /* Metric + Control-Byte + Prefix */ + unsigned int entry_len = 5 + PSIZE(te_ipv4_reach->control & 0x3F); + value_len += entry_len; + pnt += entry_len; + + if (te_ipv4_reach->control & TE_IPV4_HAS_SUBTLV) + { + if (length <= value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv4 extended reachability SubTLV missing", + areatag); + retval = ISIS_WARNING; + break; + } + u_char subtlv_len = *pnt; + value_len += subtlv_len + 1; + pnt += subtlv_len + 1; + if (length < value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv4 extended reachability SubTLVs have oversize", + areatag); + retval = ISIS_WARNING; + break; + } + } } } @@ -682,6 +702,27 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, prefix_octets = ((ipv6_reach->prefix_len + 7) / 8); value_len += prefix_octets + 6; pnt += prefix_octets + 6; + + if (ipv6_reach->control_info & CTRL_INFO_SUBTLVS) + { + if (length <= value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv6 extended reachability SubTLV missing", + areatag); + retval = ISIS_WARNING; + break; + } + u_char subtlv_len = *pnt; + value_len += subtlv_len + 1; + pnt += subtlv_len + 1; + if (length < value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv6 extended reachability SubTLVs have oversize", + areatag); + retval = ISIS_WARNING; + break; + } + } /* FIXME: sub-tlvs */ if (!tlvs->ipv6_reachs) tlvs->ipv6_reachs = list_new (); @@ -752,6 +793,9 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, pnt += length; break; } + /* Abort Parsing if error occured */ + if (retval != ISIS_OK) + return retval; } return retval; diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h index bf2d51daa1..f899b9e9db 100644 --- a/isisd/isis_tlv.h +++ b/isisd/isis_tlv.h @@ -223,7 +223,7 @@ struct te_ipv4_reachability u_char prefix_start; /* since this is variable length by nature it only */ }; /* points to an approximate location */ - +#define TE_IPV4_HAS_SUBTLV (0x40) struct idrp_info { diff --git a/ldpd/control.c b/ldpd/control.c index ba303cc12c..8a2280be07 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -51,28 +51,28 @@ control_init(void) memset(&s_un, 0, sizeof(s_un)); s_un.sun_family = AF_UNIX; - strlcpy(s_un.sun_path, LDPD_SOCKET, sizeof(s_un.sun_path)); + strlcpy(s_un.sun_path, ctl_sock_path, sizeof(s_un.sun_path)); - if (unlink(LDPD_SOCKET) == -1) + if (unlink(ctl_sock_path) == -1) if (errno != ENOENT) { - log_warn("%s: unlink %s", __func__, LDPD_SOCKET); + log_warn("%s: unlink %s", __func__, ctl_sock_path); close(fd); return (-1); } old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH); if (bind(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) { - log_warn("%s: bind: %s", __func__, LDPD_SOCKET); + log_warn("%s: bind: %s", __func__, ctl_sock_path); close(fd); umask(old_umask); return (-1); } umask(old_umask); - if (chmod(LDPD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) { + if (chmod(ctl_sock_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) { log_warn("%s: chmod", __func__); close(fd); - (void)unlink(LDPD_SOCKET); + (void)unlink(ctl_sock_path); return (-1); } @@ -97,7 +97,7 @@ control_cleanup(void) { accept_del(control_fd); close(control_fd); - unlink(LDPD_SOCKET); + unlink(ctl_sock_path); } /* ARGSUSED */ diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index afc709ff49..56a64c84f3 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -809,9 +809,9 @@ ldp_vty_connect(struct imsgbuf *ibuf) memset(&s_un, 0, sizeof(s_un)); s_un.sun_family = AF_UNIX; - strlcpy(s_un.sun_path, LDPD_SOCKET, sizeof(s_un.sun_path)); + strlcpy(s_un.sun_path, ctl_sock_path, sizeof(s_un.sun_path)); if (connect(ctl_sock, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) { - log_warn("%s: connect: %s", __func__, LDPD_SOCKET); + log_warn("%s: connect: %s", __func__, ctl_sock_path); close(ctl_sock); return (-1); } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 76eb66d926..4e79f8b8ab 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -40,11 +40,12 @@ #include "zclient.h" #include "vrf.h" #include "filter.h" +#include "sockopt.h" #include "qobj.h" static void ldpd_shutdown(void); static pid_t start_child(enum ldpd_process, char *, int, int, - const char *, const char *); + const char *, const char *, const char *); static int main_dispatch_ldpe(struct thread *); static int main_dispatch_lde(struct thread *); static int main_imsg_send_ipc_sockets(struct imsgbuf *, @@ -116,7 +117,15 @@ struct zebra_privs_t ldpd_privs = .cap_num_i = 0 }; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = LDP_VTYSH_PATH; + +/* CTL Socket path */ +char ctl_sock_path[MAXPATHLEN] = LDPD_SOCKET; + /* LDPd options. */ +#define OPTION_VTYSOCK 1000 +#define OPTION_CTLSOCK 1001 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -127,6 +136,8 @@ static struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, + { "ctl_socket", required_argument, NULL, OPTION_CTLSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "version", no_argument, NULL, 'v'}, @@ -149,6 +160,8 @@ Daemon which manages LDP.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ + --ctl_socket Override ctl socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -213,6 +226,8 @@ main(int argc, char *argv[]) char *p; char *vty_addr = NULL; int vty_port = LDP_VTY_PORT; + char *ctl_sock_custom_path = NULL; + char *ctl_sock_name; int daemon_mode = 0; const char *user = NULL; const char *group = NULL; @@ -273,6 +288,28 @@ main(int argc, char *argv[]) if (vty_port <= 0 || vty_port > 0xffff) vty_port = LDP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, LDP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; + case OPTION_CTLSOCK: + ctl_sock_name = strrchr(LDPD_SOCKET, '/'); + if (ctl_sock_name) + /* skip '/' */ + ctl_sock_name++; + else + /* + * LDPD_SOCKET configured as relative path + * during config? Should really never happen for + * sensible config + */ + ctl_sock_name = (char *)LDPD_SOCKET; + ctl_sock_custom_path = optarg; + strlcpy(ctl_sock_path, ctl_sock_custom_path, + sizeof(ctl_sock_path)); + strlcat(ctl_sock_path, "/", sizeof(ctl_sock_path)); + strlcat(ctl_sock_path, ctl_sock_name, + sizeof(ctl_sock_path)); + break; case 'u': user = optarg; break; @@ -319,7 +356,7 @@ main(int argc, char *argv[]) if (lflag) lde(user, group); else if (eflag) - ldpe(user, group); + ldpe(user, group, ctl_sock_path); master = thread_master_create(); @@ -374,9 +411,11 @@ main(int argc, char *argv[]) /* start children */ lde_pid = start_child(PROC_LDE_ENGINE, saved_argv0, - pipe_parent2lde[1], pipe_parent2lde_sync[1], user, group); + pipe_parent2lde[1], pipe_parent2lde_sync[1], + user, group, ctl_sock_custom_path); ldpe_pid = start_child(PROC_LDP_ENGINE, saved_argv0, - pipe_parent2ldpe[1], pipe_parent2ldpe_sync[1], user, group); + pipe_parent2ldpe[1], pipe_parent2ldpe_sync[1], + user, group, ctl_sock_custom_path); /* drop privileges */ if (user) @@ -436,7 +475,7 @@ main(int argc, char *argv[]) pid_output(pid_file); /* Create VTY socket */ - vty_serv_sock(vty_addr, vty_port, LDP_VTYSH_PATH); + vty_serv_sock(vty_addr, vty_port, vty_sock_path); /* Print banner. */ log_notice("LDPd %s starting: vty@%d", FRR_VERSION, vty_port); @@ -494,9 +533,9 @@ ldpd_shutdown(void) static pid_t start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync, - const char *user, const char *group) + const char *user, const char *group, const char *ctl_sock_custom_path) { - char *argv[7]; + char *argv[9]; int argc = 0; pid_t pid; @@ -535,6 +574,10 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync, argv[argc++] = (char *)"-g"; argv[argc++] = (char *)group; } + if (ctl_sock_custom_path) { + argv[argc++] = (char *)"--ctl_socket"; + argv[argc++] = (char *)ctl_sock_custom_path; + } argv[argc++] = NULL; execvp(argv0, argv); diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index 506891ff07..fa3789a839 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -715,6 +715,7 @@ int sock_set_ipv6_mcast_loop(int); /* quagga */ extern struct thread_master *master; +extern char ctl_sock_path[MAXPATHLEN]; /* ldp_zebra.c */ void ldp_zebra_init(struct thread_master *); diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 0b441c1813..7dcc8fbe16 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -99,7 +99,7 @@ static struct quagga_signal_t ldpe_signals[] = /* label distribution protocol engine */ void -ldpe(const char *user, const char *group) +ldpe(const char *user, const char *group, const char *ctl_path) { struct thread thread; @@ -128,6 +128,7 @@ ldpe(const char *user, const char *group) ldpe_privs.group = group; zprivs_init(&ldpe_privs); + strlcpy(ctl_sock_path, ctl_path, sizeof(ctl_sock_path)); if (control_init() == -1) fatalx("control socket setup failed"); diff --git a/ldpd/ldpe.h b/ldpd/ldpe.h index 7f7ccd1f96..052439df88 100644 --- a/ldpd/ldpe.h +++ b/ldpd/ldpe.h @@ -187,7 +187,7 @@ int tlv_decode_fec_elm(struct nbr *, struct ldp_msg *, char *, uint16_t, struct map *); /* ldpe.c */ -void ldpe(const char *, const char *); +void ldpe(const char *, const char *, const char *); int ldpe_imsg_compose_parent(int, pid_t, void *, uint16_t); int ldpe_imsg_compose_lde(int, uint32_t, pid_t, void *, diff --git a/lib/plist.c b/lib/plist.c index 279c85d6d6..41cae020de 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -326,6 +326,9 @@ prefix_list_get (afi_t afi, int orf, const char *name) return plist; } +static void prefix_list_trie_del (struct prefix_list *plist, + struct prefix_list_entry *pentry); + /* Delete prefix-list from prefix_list_master and free it. */ static void prefix_list_delete (struct prefix_list *plist) @@ -339,6 +342,7 @@ prefix_list_delete (struct prefix_list *plist) for (pentry = plist->head; pentry; pentry = next) { next = pentry->next; + prefix_list_trie_del (plist, pentry); prefix_list_entry_free (pentry); plist->count--; } diff --git a/lib/privs.c b/lib/privs.c index ac2a8454c5..376d6f3365 100644 --- a/lib/privs.c +++ b/lib/privs.c @@ -251,7 +251,8 @@ zprivs_caps_init (struct zebra_privs_t *zprivs) } /* we have caps, we have no need to ever change back the original user */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { @@ -531,7 +532,8 @@ zprivs_caps_init (struct zebra_privs_t *zprivs) /* we have caps, we have no need to ever change back the original user * change real, effective and saved to the specified user. */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { @@ -602,7 +604,8 @@ zprivs_caps_terminate (void) int zprivs_change_uid (zebra_privs_ops_t op) { - + if (zprivs_state.zsuid == zprivs_state.zuid) + return 0; if (op == ZPRIVS_RAISE) return seteuid (zprivs_state.zsuid); else if (op == ZPRIVS_LOWER) @@ -766,7 +769,8 @@ zprivs_init(struct zebra_privs_t *zprivs) } } - if (ngroups) + /* add groups only if we changed uid - otherwise skip */ + if ((ngroups) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setgroups (ngroups, groups) ) { @@ -776,7 +780,8 @@ zprivs_init(struct zebra_privs_t *zprivs) } } - if (zprivs_state.zgid) + /* change gid only if we changed uid - otherwise skip */ + if ((zprivs_state.zgid) && (zprivs_state.zsuid != zprivs_state.zuid)) { /* change group now, forever. uid we do later */ if ( setregid (zprivs_state.zgid, zprivs_state.zgid) ) @@ -797,7 +802,8 @@ zprivs_init(struct zebra_privs_t *zprivs) * This is not worth that much security wise, but all we can do. */ zprivs_state.zsuid = geteuid(); - if ( zprivs_state.zuid ) + /* only change uid if we don't have the correct one */ + if (( zprivs_state.zuid ) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (-1, zprivs_state.zuid) ) { @@ -824,7 +830,8 @@ zprivs_terminate (struct zebra_privs_t *zprivs) #ifdef HAVE_CAPABILITIES zprivs_caps_terminate(); #else /* !HAVE_CAPABILITIES */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { diff --git a/lib/sockopt.c b/lib/sockopt.c index 2a9f907cb3..91b0602b3a 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -29,6 +29,29 @@ #include "sockopt.h" #include "sockunion.h" +/* Replace the path of given defaultpath with newpath, but keep filename */ +void +set_socket_path (char *path, const char *defaultpath, char *newpath, int maxsize) +{ + const char *sock_name; + + sock_name = strrchr(defaultpath, '/'); + if (sock_name) + /* skip '/' */ + sock_name++; + else + /* + * VTYSH_PATH configured as relative path + * during config? Should really never happen for + * sensible config + */ + sock_name = defaultpath; + + strlcpy (path, newpath, maxsize); + strlcat (path, "/", maxsize); + strlcat (path, sock_name, maxsize); +} + void setsockopt_so_recvbuf (int sock, int size) { diff --git a/lib/sockopt.h b/lib/sockopt.h index 1b7be1e49f..d5724ce60f 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -24,6 +24,10 @@ #include "sockunion.h" +/* Override (vty) socket paths, but keep the filename */ +extern void set_socket_path (char *path, const char *defaultpath, + char *newpath, int maxsize); + extern void setsockopt_so_recvbuf (int sock, int size); extern void setsockopt_so_sendbuf (const int sock, int size); extern int getsockopt_so_sendbuf (const int sock); diff --git a/lib/vty.c b/lib/vty.c index 9e0625e3cb..b6f493b6c9 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2022,7 +2022,10 @@ vty_serv_un (const char *path) zprivs_get_ids(&ids); - if (ids.gid_vty > 0) + /* Hack: ids.gid_vty is actually a uint, but we stored -1 in it + earlier for the case when we don't need to chown the file + type casting it here to make a compare */ + if ((int)ids.gid_vty > 0) { /* set group of socket */ if ( chown (path, -1, ids.gid_vty) ) diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index bd3a2faa5d..f85580fa59 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -39,6 +39,7 @@ #include "zclient.h" #include "vrf.h" #include "bfd.h" +#include "sockopt.h" #include "ospf6d.h" #include "ospf6_top.h" @@ -51,6 +52,9 @@ /* Default configuration file name for ospf6d. */ #define OSPF6_DEFAULT_CONFIG "ospf6d.conf" +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = OSPF6_VTYSH_PATH; + /* Default port values. */ #define OSPF6_VTY_PORT 2606 @@ -78,6 +82,7 @@ struct zebra_privs_t ospf6d_privs = }; /* ospf6d options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -86,6 +91,7 @@ struct option longopts[] = { "socket", required_argument, NULL, 'z'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "version", no_argument, NULL, 'v'}, @@ -125,6 +131,7 @@ Daemon which manages OSPF version 3.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -285,6 +292,9 @@ main (int argc, char *argv[], char *envp[]) if (vty_port <= 0 || vty_port > 0xffff) vty_port = OSPF6_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, OSPF6_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': ospf6d_privs.user = optarg; break; @@ -357,7 +367,7 @@ main (int argc, char *argv[], char *envp[]) /* Make ospf6 vty socket. */ if (!vty_port) vty_port = OSPF6_VTY_PORT; - vty_serv_sock (vty_addr, vty_port, OSPF6_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print start message */ zlog_notice ("OSPF6d (Quagga-%s ospf6d-%s) starts: vty@%d", diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index e0719b397a..845d96032b 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -41,6 +41,7 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" @@ -79,6 +80,7 @@ struct zebra_privs_t ospfd_privs = char config_default[100]; /* OSPFd options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -90,6 +92,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "apiserver", no_argument, NULL, 'a'}, @@ -99,6 +102,9 @@ struct option longopts[] = /* OSPFd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = OSPF_VTYSH_PATH; + /* Master of threads. */ struct thread_master *master; @@ -126,6 +132,7 @@ Daemon which manages OSPF.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -a. --apiserver Enable OSPF apiserver\n\ @@ -253,6 +260,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = OSPF_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, OSPF_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': ospfd_privs.user = optarg; break; @@ -357,19 +367,48 @@ main (int argc, char **argv) exit (1); } - /* Create VTY socket */ + /* Create PID file */ if (instance) { - sprintf(pid_file, "%s/ospfd-%d.pid", DAEMON_VTY_DIR, instance); - sprintf(vty_path, "%s/ospfd-%d.vty", DAEMON_VTY_DIR, instance); - } - else - { - strcpy(vty_path, OSPF_VTYSH_PATH); + char pidfile_temp[100]; + + /* Override the single file with file including instance + number in case of multi-instance */ + if (strrchr(pid_file, '/') != NULL) + /* cut of pid_file at last / char * to get directory */ + *strrchr(pid_file, '/') = '\0'; + else + /* pid_file contains no directory - should never happen, but deal with it anyway */ + /* throw-away all pid_file and assume it's only the filename */ + pid_file[0] = '\0'; + + snprintf(pidfile_temp, sizeof(pidfile_temp), "%s/ospfd-%d.pid", pid_file, instance ); + strncpy(pid_file, pidfile_temp, sizeof(pid_file)); } /* Process id file create. */ pid_output (pid_file); + /* Create VTY socket */ + if (instance) + { + /* Multi-Instance. Use only path section of vty_sock_path with new file incl instance */ + if (strrchr(vty_sock_path, '/') != NULL) + { + /* cut of pid_file at last / char * to get directory */ + *strrchr(vty_sock_path, '/') = '\0'; + } + else + { + /* pid_file contains no directory - should never happen, but deal with it anyway */ + /* throw-away all pid_file and assume it's only the filename */ + vty_sock_path[0] = '\0'; + } + snprintf(vty_path, sizeof(vty_path), "%s/ospfd-%d.vty", vty_sock_path, instance ); + } + else + { + strcpy(vty_path, vty_sock_path); + } vty_serv_sock (vty_addr, vty_port, vty_path); /* Print banner. */ diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 0749d60b05..2e81ac53fd 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -38,6 +38,7 @@ #include "prefix.h" #include "plist.h" #include "vrf.h" +#include "sockopt.h" #include "pimd.h" #include "pim_version.h" @@ -51,18 +52,25 @@ extern struct host host; char config_default[] = SYSCONFDIR PIMD_DEFAULT_CONFIG; +/* pimd options */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, + { "socket", required_argument, NULL, 'z'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "version", no_argument, NULL, 'v'}, { "debug_zclient", no_argument, NULL, 'Z'}, { "help", no_argument, NULL, 'h'}, { 0 } }; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = PIM_VTYSH_PATH; + /* pimd privileges */ zebra_capabilities_t _caps_p [] = { @@ -103,6 +111,7 @@ Daemon which manages PIM.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -v, --version Print program version\n\ -h, --help Display this help and exit\n\ \n\ @@ -163,6 +172,9 @@ int main(int argc, char** argv, char** envp) { case 'P': vty_port = atoi (optarg); break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, PIM_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'v': printf(PIMD_PROGNAME " version %s\n", PIMD_VERSION); print_version(progname); @@ -228,7 +240,7 @@ int main(int argc, char** argv, char** envp) { /* Create pimd VTY socket */ if (vty_port < 0) vty_port = PIMD_VTY_PORT; - vty_serv_sock(vty_addr, vty_port, PIM_VTYSH_PATH); + vty_serv_sock(vty_addr, vty_port, vty_sock_path); zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting, VTY interface at port TCP %d", FRR_VERSION, PIMD_VERSION, vty_port); diff --git a/qpb/Makefile.am b/qpb/Makefile.am index 0fbda61f3c..e5951b2be9 100644 --- a/qpb/Makefile.am +++ b/qpb/Makefile.am @@ -5,8 +5,8 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib $(Q PROTOBUF_INCLUDES=-I$(top_srcdir) PROTOBUF_PACKAGE = qpb -lib_LTLIBRARIES = libquagga_pb.la -libquagga_pb_la_LDFLAGS = -version-info 0:0:0 +lib_LTLIBRARIES = libfrr_pb.la +libfrr_pb_la_LDFLAGS = -version-info 0:0:0 if HAVE_PROTOBUF protobuf_srcs = \ @@ -16,14 +16,14 @@ protobuf_srcs_nodist = \ qpb.pb-c.c endif -libquagga_pb_la_SOURCES = \ +libfrr_pb_la_SOURCES = \ linear_allocator.h \ qpb.h \ qpb.c \ qpb_allocator.h \ $(protobuf_srcs) -nodist_libquagga_pb_la_SOURCES = $(protobuf_srcs_nodist) +nodist_libfrr_pb_la_SOURCES = $(protobuf_srcs_nodist) CLEANFILES = $(Q_CLEANFILES) BUILT_SOURCES = $(Q_PROTOBUF_SRCS) diff --git a/qpb/README.txt b/qpb/README.txt index 99ccd05511..7a09452c6f 100644 --- a/qpb/README.txt +++ b/qpb/README.txt @@ -1 +1 @@ -Protobuf definitions and code that is applicable to all of quagga. +Protobuf definitions and code that is applicable to all of Quagga/FRR. diff --git a/qpb/qpb.proto b/qpb/qpb.proto index 8323d3ed73..a1595a9abd 100644 --- a/qpb/qpb.proto +++ b/qpb/qpb.proto @@ -21,7 +21,7 @@ */ /* - * Protobuf definitions pertaining to the Quagga Protobuf component. + * Protobuf definitions pertaining to the Quagga/FRR Protobuf component. */ package qpb; diff --git a/qpb/qpb_allocator.h b/qpb/qpb_allocator.h index 83ddf56cbc..bb7dcf38f3 100644 --- a/qpb/qpb_allocator.h +++ b/qpb/qpb_allocator.h @@ -24,7 +24,7 @@ */ /* - * Header file for quagga protobuf memory management code. + * Header file for Quagga/FRR protobuf memory management code. */ #ifndef _QPB_ALLOCATOR_H_ diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a815e151df..c53e8459c9 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -570,10 +570,10 @@ rm -rf %{buildroot} %endif %changelog -* Fri Jan 6 2017 Martin Winter +* Fri Jan 6 2017 Martin Winter - %{version} - Renamed to frr for FreeRangeRouting fork of Quagga -* Thu Feb 11 2016 Paul Jakma - %{version} +* Thu Feb 11 2016 Paul Jakma - remove with_ipv6 conditionals, always build v6 - Fix UTF-8 char in spec changelog - remove quagga.pam.stack, long deprecated. diff --git a/ripd/rip_main.c b/ripd/rip_main.c index cfcb60168a..58dd2df6fa 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -35,10 +35,12 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "ripd/ripd.h" /* ripd options. */ +#define OPTION_VTYSOCK 1000 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -49,6 +51,7 @@ static struct option longopts[] = { "dryrun", no_argument, NULL, 'C'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "retain", no_argument, NULL, 'r'}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, @@ -85,6 +88,9 @@ char *config_file = NULL; /* ripd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIP_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -116,6 +122,7 @@ Daemon which manages RIP version 1 and 2.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -C, --dryrun Check configuration for validity and exit\n\ -r, --retain When program terminates, retain added route by ripd.\n\ -u, --user User to run as\n\ @@ -142,7 +149,7 @@ sighup (void) vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -251,6 +258,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -311,7 +321,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("RIPd %s starting: vty@%d", FRR_VERSION, vty_port); diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 14711a1a65..a90dffce14 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -36,6 +36,7 @@ #include "privs.h" #include "sigevent.h" #include "vrf.h" +#include "sockopt.h" #include "ripngd/ripngd.h" @@ -44,6 +45,7 @@ char config_default[] = SYSCONFDIR RIPNG_DEFAULT_CONFIG; char *config_file = NULL; /* RIPngd options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -54,6 +56,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "retain", no_argument, NULL, 'r'}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, @@ -87,6 +90,9 @@ struct zebra_privs_t ripngd_privs = /* RIPngd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIPNG_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -118,6 +124,7 @@ Daemon which manages RIPng.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -r, --retain When program terminates, retain added route by ripngd.\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ @@ -141,7 +148,7 @@ sighup (void) /* Reload config file. */ vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -249,6 +256,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIPNG_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIPNG_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -303,7 +313,7 @@ main (int argc, char **argv) } /* Create VTY socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Process id file create. */ pid_output (pid_file); diff --git a/snapcraft/.gitignore b/snapcraft/.gitignore new file mode 100644 index 0000000000..e050ff0c8d --- /dev/null +++ b/snapcraft/.gitignore @@ -0,0 +1,6 @@ +snapcraft.yaml +parts +prime +stage +quagga*.snap +!*/Makefile diff --git a/snapcraft/Makefile.am b/snapcraft/Makefile.am new file mode 100644 index 0000000000..15813be72f --- /dev/null +++ b/snapcraft/Makefile.am @@ -0,0 +1,11 @@ +EXTRA_DIST = snapcraft.yaml \ + scripts/Makefile scripts/zebra-service scripts/bgpd-service \ + scripts/isisd-service scripts/ripd-service scripts/ripngd-service \ + scripts/ospf6d-service scripts/ospfd-service \ + scripts/isisd-service scripts/pimd-service \ + scripts/ldpd-service \ + defaults/bgpd.conf.default defaults/isisd.conf.default \ + defaults/ospf6d.conf.default defaults/ospfd.conf.default \ + defaults/pimd.conf.default defaults/zebra.conf.default \ + defaults/ripd.conf.default defaults/ripngd.conf.default \ + defaults/ldpd.conf.default defaults/vtysh.conf.default diff --git a/snapcraft/README.snap_build.md b/snapcraft/README.snap_build.md new file mode 100644 index 0000000000..341b210f71 --- /dev/null +++ b/snapcraft/README.snap_build.md @@ -0,0 +1,93 @@ +Building your own FreeRangeRouting Snap +======================================== +(Tested on Ubuntu 16.04 with Snap Version 2, does not work on Ubuntu 15.x +which uses earlier versions of snaps) + +1. Install snapcraft: + + sudo apt-get install snapcraft + +2. Checkout FreeRangeRouting under a **unpriviledged** user account + + git clone https://github.com/freerangerouting/frr.git + cd frr + +3. Run Bootstrap and make distribution tar.gz + + ./bootstrap.sh + ./configure --with-pkg-extra-version=-MySnapVersion + make dist + + Note: configure parameters are not important for the Snap building, + except the `with-pkg-extra-version` if you want to give the Snap + a specific name to mark your own unoffical build + + This will build `frr-something.tar.gz` - the distribution tar and + the snapcraft/snapcraft.yaml with the matching version number + +4. Create snap + + cd snapcraft + snapcraft + + You should now end up with `frr_something.snap` + +Installing the snap +=================== +(This can be done on a different system) + +1. Install snapd + + sudo apt-get install snapd + +2. Install self-built frr snap. (`--force-dangerous` is required to + install a unsigned self-built snap) + + snap install --force-dangerous ./frr*.snap + + Connect the priviledged `network-control` plug to the snap: + + snap connect frr:network-control ubuntu-core:network-control + +DONE. + +The Snap will be auto-started and running. + +Operations +========== + +### FreeRangeRouting Daemons +At this time, all FreeRangeRouting daemons are auto-started. + +A daemon can be stopped/started with (ie ospf6d) + + systemctl stop snap.frr.ospf6d.service + systemctl start snap.frr.ospf6d.service + +or disabled/enabled with + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +### FreeRangeRouting Commands +All the commands are prefixed with frr. + + frr.vtysh -> vtysh + frr.version -> Just gives version output (zebra --version) + frr.readme -> Returns simple README with hints on using FRR + + frr.bgpd-debug -> Directly start each daemon (without service) + frr.isisd-debug + frr.ospf6d-debug + frr.ospfd-debug + frr.pimd-debug + frr.ripd-debug + frr.ripngd-debug + frr.ldp-debug + frr.zebra-debug + +vtysh can be accessed as frr.vtysh (Make sure you have /snap/bin in your +path). If access as `vtysh` instead of `frr.vtysh` is needed, a symlink +can be created: + + sudo ln -s /snap/bin/frr.vtysh /usr/local/bin/vtysh diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md new file mode 100644 index 0000000000..2d2b32b6b7 --- /dev/null +++ b/snapcraft/README.usage.md @@ -0,0 +1,77 @@ +Using the FreeRangeRouting Snap +=============================== + +After installing the Snap, the priviledged plug need to be connected: + + snap connect frr:network-control ubuntu-core:network-control + +Enabling/Disabling FreeRangeRouting Daemons +------------------------------------------- + +By default (at this time), all FreeRangeRouting daemons will be enabled +on installation. If you want to disable a specific daemon, then use +the systemctl commands + +ie for `ospf6d` (OSPFv3): + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +The daemons are: `ripd`, `ripngd`, `ospfd`, `ospf6d`, `isisd`, `bgpd`, +`pimd`, `zebra` + +Commands defined by this snap +----------------------------- + +- `frr.vtysh`: + FreeRangeRouting VTY Shell (configuration tool) +- `frr.version`: + Returns output of `zebra --version` to display version and configured + options +- `frr.readme`: + Returns this document `cat README_usage.md` + +and for debugging defined at this time (May get removed later - do not +depend on them). These are mainly intended to debug the Snap + +- `frr.zebra-debug`: + Starts zebra daemon in foreground +- `frr.ripd-debug`: + Starts ripd daemon in foreground +- `frr.ripngd-debug`: + Starts ripng daemon in foreground +- `frr.ospfd-debug`: + Starts ospfd daemon in foreground +- `frr.ospf6d-debug`: + Starts ospf6d daemon in foreground +- `frr.isisd-debug`: + Starts isisd daemon in foreground +- `frr.bgpd-debug`: + Starts bgpd daemon in foreground +- `frr.pimd-debug`: + Starts pimd daemon in foreground +- `frr.ldpd-debug`: + Starts ldpd daemon in foreground + +FAQ +--- +- frr.vtysh displays `--MORE--` on long output. How to suppress this? + - Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add + `export VTYSH_PAGER=cat` to the end of your `.profile`) + +Sourcecode available +==================== + +The source for this SNAP is available as part of the FreeRangeRouting +Source Code Distribution. + + https://github.com/freerangerouting/frr.git + +Instructions for rebuilding the snap are in `README.snap_build.md` + +Feedback welcome +================ + +Please send Feedback about this snap to Martin Winter at +`mwinter@opensourcerouting.org` + diff --git a/snapcraft/defaults/bgpd.conf.default b/snapcraft/defaults/bgpd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/isisd.conf.default b/snapcraft/defaults/isisd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ldpd.conf.default b/snapcraft/defaults/ldpd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ospf6d.conf.default b/snapcraft/defaults/ospf6d.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ospfd.conf.default b/snapcraft/defaults/ospfd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/pimd.conf.default b/snapcraft/defaults/pimd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ripd.conf.default b/snapcraft/defaults/ripd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ripngd.conf.default b/snapcraft/defaults/ripngd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/vtysh.conf.default b/snapcraft/defaults/vtysh.conf.default new file mode 100644 index 0000000000..5c15e6bc4a --- /dev/null +++ b/snapcraft/defaults/vtysh.conf.default @@ -0,0 +1 @@ +no service integrated-vtysh-config diff --git a/snapcraft/defaults/zebra.conf.default b/snapcraft/defaults/zebra.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/helpers/Makefile b/snapcraft/helpers/Makefile new file mode 100644 index 0000000000..c44bee7b4e --- /dev/null +++ b/snapcraft/helpers/Makefile @@ -0,0 +1,7 @@ +all: + +install: + install -D -m 0755 $(DESTDIR)/usr/bin/telnet.netkit $(DESTDIR)/bin/telnet + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute.db $(DESTDIR)/bin/traceroute + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute6.db $(DESTDIR)/bin/traceroute6 + diff --git a/snapcraft/scripts/Makefile b/snapcraft/scripts/Makefile new file mode 100644 index 0000000000..00984c2afa --- /dev/null +++ b/snapcraft/scripts/Makefile @@ -0,0 +1,14 @@ +all: + +install: + mkdir -p $(DESTDIR)/bin + install -D -m 0755 zebra-service $(DESTDIR)/bin/ + install -D -m 0755 bgpd-service $(DESTDIR)/bin/ + install -D -m 0755 ospfd-service $(DESTDIR)/bin/ + install -D -m 0755 ospf6d-service $(DESTDIR)/bin/ + install -D -m 0755 ripd-service $(DESTDIR)/bin/ + install -D -m 0755 ripngd-service $(DESTDIR)/bin/ + install -D -m 0755 isisd-service $(DESTDIR)/bin/ + install -D -m 0755 pimd-service $(DESTDIR)/bin/ + install -D -m 0755 ldpd-service $(DESTDIR)/bin/ + diff --git a/snapcraft/scripts/bgpd-service b/snapcraft/scripts/bgpd-service new file mode 100644 index 0000000000..4072031eda --- /dev/null +++ b/snapcraft/scripts/bgpd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/bgpd.conf ]; then + cp $SNAP/etc/frr/bgpd.conf.default $SNAP_DATA/bgpd.conf +fi +exec $SNAP/sbin/bgpd \ + -f $SNAP_DATA/bgpd.conf \ + --pid_file $SNAP_DATA/bgpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/isisd-service b/snapcraft/scripts/isisd-service new file mode 100644 index 0000000000..aef92e997a --- /dev/null +++ b/snapcraft/scripts/isisd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/isisd.conf ]; then + cp $SNAP/etc/frr/isisd.conf.default $SNAP_DATA/isisd.conf +fi +exec $SNAP/sbin/isisd \ + -f $SNAP_DATA/isisd.conf \ + --pid_file $SNAP_DATA/isisd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ldpd-service b/snapcraft/scripts/ldpd-service new file mode 100644 index 0000000000..4c4a8ebae7 --- /dev/null +++ b/snapcraft/scripts/ldpd-service @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ldpd.conf ]; then + cp $SNAP/etc/frr/ldpd.conf.default $SNAP_DATA/ldpd.conf +fi +exec $SNAP/sbin/ldpd \ + -f $SNAP_DATA/ldpd.conf \ + --pid_file $SNAP_DATA/ldpd.pid \ + --socket $SNAP_DATA/zsock \ + --ctl_socket $SNAP_DATA \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ospf6d-service b/snapcraft/scripts/ospf6d-service new file mode 100644 index 0000000000..4dc3cb0849 --- /dev/null +++ b/snapcraft/scripts/ospf6d-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospf6d.conf ]; then + cp $SNAP/etc/frr/ospf6d.conf.default $SNAP_DATA/ospf6d.conf +fi +exec $SNAP/sbin/ospf6d \ + -f $SNAP_DATA/ospf6d.conf \ + --pid_file $SNAP_DATA/ospf6d.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ospfd-service b/snapcraft/scripts/ospfd-service new file mode 100644 index 0000000000..7cac34b510 --- /dev/null +++ b/snapcraft/scripts/ospfd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospfd.conf ]; then + cp $SNAP/etc/frr/ospfd.conf.default $SNAP_DATA/ospfd.conf +fi +exec $SNAP/sbin/ospfd \ + -f $SNAP_DATA/ospfd.conf \ + --pid_file $SNAP_DATA/ospfd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/pimd-service b/snapcraft/scripts/pimd-service new file mode 100644 index 0000000000..3ddd394ee0 --- /dev/null +++ b/snapcraft/scripts/pimd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pimd.conf ]; then + cp $SNAP/etc/frr/pimd.conf.default $SNAP_DATA/pimd.conf +fi +exec $SNAP/sbin/pimd \ + -f $SNAP_DATA/pimd.conf \ + --pid_file $SNAP_DATA/pimd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripd-service b/snapcraft/scripts/ripd-service new file mode 100644 index 0000000000..f9959be4cb --- /dev/null +++ b/snapcraft/scripts/ripd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripd.conf ]; then + cp $SNAP/etc/frr/ripd.conf.default $SNAP_DATA/ripd.conf +fi +exec $SNAP/sbin/ripd \ + -f $SNAP_DATA/ripd.conf \ + --pid_file $SNAP_DATA/ripd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripngd-service b/snapcraft/scripts/ripngd-service new file mode 100644 index 0000000000..bd06e6bae5 --- /dev/null +++ b/snapcraft/scripts/ripngd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripngd.conf ]; then + cp $SNAP/etc/frr/ripngd.conf.default $SNAP_DATA/ripngd.conf +fi +exec $SNAP/sbin/ripngd \ + -f $SNAP_DATA/ripngd.conf \ + --pid_file $SNAP_DATA/ripngd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/zebra-service b/snapcraft/scripts/zebra-service new file mode 100644 index 0000000000..9119a4055d --- /dev/null +++ b/snapcraft/scripts/zebra-service @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/zebra.conf ]; then + cp $SNAP/etc/frr/zebra.conf.default $SNAP_DATA/zebra.conf +fi +if ! [ -e $SNAP_DATA/vtysh.conf ]; then + cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf +fi +exec $SNAP/sbin/zebra \ + -f $SNAP_DATA/zebra.conf \ + --pid_file $SNAP_DATA/zebra.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/setup/gui/icon.png b/snapcraft/setup/gui/icon.png new file mode 100644 index 0000000000..e8f68e6dde Binary files /dev/null and b/snapcraft/setup/gui/icon.png differ diff --git a/snapcraft/snapcraft.yaml.in b/snapcraft/snapcraft.yaml.in new file mode 100644 index 0000000000..a703766f0b --- /dev/null +++ b/snapcraft/snapcraft.yaml.in @@ -0,0 +1,235 @@ +name: frr +version: @VERSION@ +summary: FreeRangeRouting BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM/LDP routing daemon +description: BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM routing daemon + FreeRangeRouting (FRR) is free software which manages TCP/IP based routing + protocols. It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, + RIPng, PIM and LDP as well as the IPv6 versions of these. + FreeRangeRouting (frr) is a fork of Quagga. +confinement: strict +grade: devel + +apps: + vtysh: + command: bin/vtysh --vty_socket $SNAP_DATA --config_dir $SNAP_DATA + plugs: + - network + - network-bind + - network-control + version: + command: sbin/zebra --version + readme: + command: bin/cat $SNAP/doc/README.usage.md + zebra: + command: bin/zebra-service + daemon: simple + plugs: + - network + - network-bind + - network-control + bgpd: + command: bin/bgpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospfd: + command: bin/ospfd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospf6d: + command: bin/ospf6d-service + daemon: simple + plugs: + - network + - network-bind + - network-control + isisd: + command: bin/isisd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripd: + command: bin/ripd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripngd: + command: bin/ripngd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pimd: + command: bin/pimd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ldpd: + command: bin/ldpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + zebra-debug: + command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + bgpd-debug: + command: sbin/bgpd -f $SNAP_DATA/bgpd.conf --pid_file $SNAP_DATA/bgpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ospfd-debug: + command: sbin/ospfd -f $SNAP_DATA/ospfd.conf --pid_file $SNAP_DATA/ospfd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ospf6d-debug: + command: sbin/ospf6d -f $SNAP_DATA/ospf6d.conf --pid_file $SNAP_DATA/ospf6d.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + isisd-debug: + command: sbin/isisd -f $SNAP_DATA/isisd.conf --pid_file $SNAP_DATA/isisd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripd-debug: + command: sbin/ripd -f $SNAP_DATA/ripd.conf --pid_file $SNAP_DATA/ripd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripngd-debug: + command: sbin/ripngd -f $SNAP_DATA/ripngd.conf --pid_file $SNAP_DATA/ripngd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pimd-debug: + command: sbin/pimd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ldpd-debug: + command: sbin/ldpd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + +parts: + frr: + build-packages: + - autoconf + - automake + - libtool + - make + - gawk + - libreadline-dev + - texinfo + - dejagnu + - libncurses5-dev + - texlive-latex-base + - texlive-generic-recommended + - libcap-dev + - imagemagick + - ghostscript + - groff + - hardening-wrapper + - libpcre3-dev + - chrpath + - pkg-config + - libjson-c-dev + stage-packages: + - coreutils + - iproute2 + - logrotate + - libcap2 + - libc6 + - libtinfo5 + - libreadline6 + - libjson-c2 + plugin: autotools + source: ../frr-@PACKAGE_VERSION@.tar.gz + configflags: + - --with-cflags=-g + - --with-cflags=-O0 + - --with-cflags=-std=gnu99 + - --with-cflags=-fpie + - --with-cflags=-fno-omit-frame-pointer + - --with-cflags=-Wall + - --enable-vtysh + - --enable-isisd + - --enable-watchfrr + - --enable-ospfclient=yes + - --enable-ospfapi=yes + - --enable-multipath=64 + - --enable-rtadv + - --enable-irdp + - --enable-gcc-rdynamic + - --enable-user=root + - --enable-group=root + - --enable-pimd + - --enable-ldpd + - --enable-configfile-mask=0640 + - --enable-logfile-mask=0640 + - --localstatedir=/var/run + - --sbindir=/sbin + - --bindir=/bin + - --sysconfdir=/etc/frr + - --with-pkg-extra-version=@PACKAGE_EXTRAVERSION@ + frr-defaults: + plugin: dump + source: defaults + organize: + zebra.conf.default: etc/frr/zebra.conf.default + bgpd.conf.default: etc/frr/bgpd.conf.default + isisd.conf.default: etc/frr/isisd.conf.default + ospf6d.conf.default: etc/frr/ospf6d.conf.default + ospfd.conf.default: etc/frr/ospfd.conf.default + pimd.conf.default: etc/frr/pimd.conf.default + ripd.conf.default: etc/frr/ripd.conf.default + ripngd.conf.default: etc/frr/ripngd.conf.default + ldpd.conf.default: etc/frr/ldpd.conf.default + vtysh.conf.default: etc/frr/vtysh.conf.default + frr-scripts: + plugin: make + source: scripts + helpers: + stage-packages: + - telnet + - traceroute + plugin: make + source: helpers + prime: + - bin/telnet + - bin/traceroute + - bin/traceroute6 + docs: + plugin: dump + source: . + organize: + README.usage.md: doc/README.usage.md + README.snap_build.md: doc/README.snap_build.md + diff --git a/solaris/Makefile.am b/solaris/Makefile.am index dcee240c62..5633991d1a 100644 --- a/solaris/Makefile.am +++ b/solaris/Makefile.am @@ -7,13 +7,13 @@ # the names of the various subpackages, and some convenient # derived variables. pkg_names = daemons dev doc libs smf -pkg_quagga_daemons = zebra bgpd ospfd ospf6d ripd ripngd +pkg_frr_daemons = zebra bgpd ospfd ospf6d ripd ripngd pkg_name_rev = @PACKAGE_VERSION@-@CONFDATE@-@target_os@-@target_cpu@ pkg_depends = $(pkg_names:%=depend.%) pkg_packages = $(pkg_names:%=@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg) pkg_pkginfos = $(pkg_names:%=pkginfo.%.full) pkg_prototypes = $(pkg_names:%=prototype.%) -pkg_manifests = quagga.xml +pkg_manifests = frr.xml # pkgmk variable substitutions wont grok ${variable} in prototype # file, so we cant let autoconf generate the file sadly @@ -35,7 +35,7 @@ edit = $(SED) \ -e 's,@enable_user\@,$(enable_user),g' \ -e 's,@enable_group\@,$(enable_group),g' \ -e 's,@enable_vty_group\@,$(enable_vty_group),g' \ - -e 's,@quagga_statedir\@,$(quagga_statedir),g' \ + -e 's,@frr_statedir\@,$(frr_statedir),g' \ -e 's,[@]PACKAGE_NAME[@],@PACKAGE_NAME@,g' \ -e 's,[@]PACKAGE_TARNAME[@],@PACKAGE_TARNAME@,g' \ -e 's,[@]PACKAGE_VERSION[@],@PACKAGE_VERSION@,g' \ @@ -90,15 +90,15 @@ depend.%: $(srcdir)/depend.%.in Makefile $(edit) $< > $@ # method file (bit like init script) -quagga.init: $(srcdir)/quagga.init.in Makefile +frr.init: $(srcdir)/frr.init.in Makefile rm -f $@ $(edit) $< > $@ # construct the pkg @PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg: prototype.% \ - depend.% quagga.init pkginfo.%.full + depend.% frr.init pkginfo.%.full ($(pkg_make) && \ - $(pkg_trans) "QUAGGA$*") + $(pkg_trans) "FRR$*") %.pkg.gz : %.pkg (gzip -c $< > $@) @@ -107,17 +107,17 @@ quagga.init: $(srcdir)/quagga.init.in Makefile #BUILT_SOURCES = pkginfo.daemons pkginfo.dev pkginfo.doc pkginfo.libs \ # prototype.daemons prototype.dev prototype.doc prototype.libs BUILT_SOURCES = $(pkg_pkginfos) pkginfo.tmpl $(pkg_prototypes) \ - $(pkg_manifests) $(pkg_depends) quagga.init + $(pkg_manifests) $(pkg_depends) frr.init CLEANFILES = $(BUILT_SOURCES) $(pkg_packages) EXTRA_DIST = $(pkg_manifests:%=%.in) $(pkg_prototypes:%=%.in) \ $(pkg_names:%=pkginfo.%.tmpl.in) $(srcdir)/pkginfo.tmpl.in \ - $(pkg_depends:%=%.in) quagga.init.in README.txt + $(pkg_depends:%=%.in) frr.init.in README.txt pkg-root-install: (cd $(top_builddir) && \ - $(MAKE) DESTDIR=$(abs_builddir)/quagga-root install) + $(MAKE) DESTDIR=$(abs_builddir)/frr-root install) packages: $(pkg_packages) diff --git a/solaris/README.txt b/solaris/README.txt index 811e9d0fd4..01f725b8fa 100644 --- a/solaris/README.txt +++ b/solaris/README.txt @@ -15,21 +15,20 @@ Requirements: i.manifest must be at least version 1.5. Place these scripts in this directory if you are using Solaris 10 GA (which does not ship with - these scripts), or in the solaris/ directory in the Quagga source. + these scripts), or in the solaris/ directory in the FreeRangeRouting source. Package creation instructions: ------------------------------ -1. Configure and build Quagga in the top level build directory as per -normal, eg: +1. Configure and build FreeRangeRouting (frr) in the top level build directory as per normal, eg: - ./configure --prefix=/usr/local/quagga \ - --localstatedir=/var/run/quagga + ./configure --prefix=/usr/local/frr \ + --localstatedir=/var/run/frr \ --enable-gcc-rdynamic --enable-opaque-lsa --enable-ospf-te \ - --enable-multipath=64 --enable-user=quagga \ + --enable-multipath=64 --enable-user=frr \ --enable-ospfclient=yes --enable-ospfapi=yes \ - --enable-group=quagga --enable-nssa --enable-opaque-lsa + --enable-group=frr --enable-nssa --enable-opaque-lsa You will need /usr/sfw/bin and /usr/ccs/bin in your path. @@ -45,13 +44,13 @@ appropriate, eg: This should result in 4 packages being created: - quagga-libs-...-$ARCH.pkg - QUAGGAlibs - quagga-daemons-...-$ARCH.pkg - QUAGGAdaemons - quagga-doc-...-$ARCH.pkg - QUAGGAdoc - quagga-dev-...-$ARCH.pkg - QUAGGAdev - quagga-smf-...-$ARCH.pkg - QUAGGAsmf + frr-libs-...-$ARCH.pkg - FRRlibs + frr-daemons-...-$ARCH.pkg - FRRdaemons + frr-doc-...-$ARCH.pkg - FRRdoc + frr-dev-...-$ARCH.pkg - FRRdev + frr-smf-...-$ARCH.pkg - FRRsmf -QUAGGAlibs and QUAGGAdaemons are needed for daemon runtime. QUAGGAsmf +FRRlibs and FRRdaemons are needed for daemon runtime. FRRsmf provides the required bits for Solaris 10+ SMF support. @@ -59,7 +58,7 @@ Install and post-install configuration notes: --------------------------------------------- - If you specified a user/group which does not exist per default on Solaris - (eg quagga/quagga) you *must* create these before installing these on a + (eg frr/frr) you *must* create these before installing these on a system. The packages do *not* create the users. - The configuration files are not created. You must create the configuration @@ -69,107 +68,107 @@ Install and post-install configuration notes: password whatever - The user which quagga runs as must have write permissions on this file, no + The user which frr runs as must have write permissions on this file, no other user should have read permissions, and you would also have to enable the telnet interface (see below). - SMF notes: - - QUAGGAsmf installs a svc:/network/routing/quagga service, with an + - FRRsmf installs a svc:/network/routing/frr service, with an instance for each daemon - - The state of all instances of quagga service can be inspected with: + - The state of all instances of frr service can be inspected with: - svcs -l svc:/network/routing/quagga + svcs -l svc:/network/routing/frr - or typically just with a shortcut of 'quagga': + or typically just with a shortcut of 'frr': - svcs -l quagga + svcs -l frr - - A specific instance of the quagga service can be inspected by specifying - the daemon name as the instance, ie quagga:: + - A specific instance of the frr service can be inspected by specifying + the daemon name as the instance, ie frr:: - svcs -l svc:/network/routing/quagga:zebra - svcs -l svc:/network/routing/quagga:ospfd + svcs -l svc:/network/routing/frr:zebra + svcs -l svc:/network/routing/frr:ospfd - or typically just with the shortcut of 'quagga:' or even + or typically just with the shortcut of 'frr:' or even : - svcs -l quagga:zebra + svcs -l frr:zebra svcs -l ospfd Eg: # # svcs -l ripd - fmri svc:/network/routing/quagga:ripd - name Quagga: ripd, RIPv1/2 IPv4 routing protocol daemon. + fmri svc:/network/routing/frr:ripd + name FreeRangeRouting: ripd, RIPv1/2 IPv4 routing protocol daemon. enabled true state online next_state none state_time Wed Jun 15 16:21:02 2005 - logfile /var/svc/log/network-routing-quagga:ripd.log + logfile /var/svc/log/network-routing-frr:ripd.log restarter svc:/system/svc/restarter:default contract_id 93 - dependency require_all/restart svc:/network/routing/quagga:zebra (online) - dependency require_all/restart file://localhost//usr/local/quagga/etc/ripd.conf (online) + dependency require_all/restart svc:/network/routing/frr:zebra (online) + dependency require_all/restart file://localhost//usr/local/frr/etc/ripd.conf (online) dependency require_all/none svc:/system/filesystem/usr:default (online) dependency require_all/none svc:/network/loopback (online) - Configuration of startup options is by way of SMF properties in a - property group named 'quagga'. The defaults should automatically be - inline with how you configured Quagga in Step 1 above. + property group named 'frr'. The defaults should automatically be + inline with how you configured FreeRangeRouting in Step 1 above. - By default the VTY interface is disabled. To change this, see below for - how to set the 'quagga/vty_port' property as appropriate for + how to set the 'frr/vty_port' property as appropriate for /each/ service. Also, the VTY is set to listen only to localhost by - default, you may change the 'quagga/vty_addr' property as appropriate - for both of the 'quagga' service and specific individual instances of - the 'quagga' service (ie quagga:zebra, quagga:ospfd, etc..). + default, you may change the 'frr/vty_addr' property as appropriate + for both of the 'frr' service and specific individual instances of + the 'frr' service (ie frr:zebra, frr:ospfd, etc..). - - Properties belonging to the 'quagga' service are inherited by all + - Properties belonging to the 'frr' service are inherited by all instances. Eg: - # svcprop -p quagga svc:/network/routing/quagga - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_addr astring 127.1 - quagga/vty_port integer 0 + # svcprop -p frr svc:/network/routing/frr + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_addr astring 127.1 + frr/vty_port integer 0 - # svcprop -p quagga svc:/network/routing/quagga:ospfd - quagga/retain_routes boolean false - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_addr astring 127.1 - quagga/vty_port integer 0 + # svcprop -p frr svc:/network/routing/frr:ospfd + frr/retain_routes boolean false + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_addr astring 127.1 + frr/vty_port integer 0 All instances will inherit these properties, unless the instance itself overrides these defaults. This also implies one can modify properties of - the 'quagga' service and have them apply to all daemons. + the 'frr' service and have them apply to all daemons. - # svccfg -s svc:/network/routing/quagga \ - setprop quagga/vty_addr = astring: ::1 + # svccfg -s svc:/network/routing/frr \ + setprop frr/vty_addr = astring: ::1 - # svcprop -p quagga svc:/network/routing/quagga - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_port integer 0 - quagga/vty_addr astring ::1 + # svcprop -p frr svc:/network/routing/frr + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_port integer 0 + frr/vty_addr astring ::1 # # You *must* refresh instances to have the property change # # take affect for the 'running snapshot' of service state. - # svcadm refresh quagga:ospfd + # svcadm refresh frr:ospfd - # svcprop -p quagga svc:/network/routing/quagga:ospfd - quagga/retain_routes boolean false - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_port integer 0 - quagga/vty_addr astring ::1 + # svcprop -p frr svc:/network/routing/frr:ospfd + frr/retain_routes boolean false + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_port integer 0 + frr/vty_addr astring ::1 Other daemon-specific options/properties may be available, however they are not yet honoured/used (eg ospfd/apiserver on svc:/network/ospf). @@ -177,12 +176,11 @@ Install and post-install configuration notes: - As SMF is dependency aware, restarting network/zebra will restart all the other daemons. - - To upgrade from one set of Quagga packages to a newer release, one must - first pkgrm the installed packages. When one pkgrm's QUAGGAsmf all + - To upgrade from one set of FreeRangeRouting packages to a newer release, + one must first pkgrm the installed packages. When one pkgrm's FRRsmf all property configuration will be lost, and any customisations will have to - redone after installing the updated QUAGGAsmf package. + redone after installing the updated FRRsmf package. - These packages are not supported by Sun Microsystems, report bugs via the - usual Quagga channels, ie Bugzilla. Improvements/contributions of course - would be greatly appreciated. + usual FreeRangeRouting channels, ie Issue Tracker. Improvements/contributions of course would be greatly appreciated. diff --git a/solaris/depend.daemons.in b/solaris/depend.daemons.in index 3430e8c964..64fb03ac19 100644 --- a/solaris/depend.daemons.in +++ b/solaris/depend.daemons.in @@ -1,4 +1,4 @@ -P QUAGGAlibs Quagga common runtime libraries +P FRRlibs FreeRangeRouting common runtime libraries @PACKAGE_VERSION@,REV=@CONFDATE@ P SUNWcsu Core Solaris, (Usr) P SUNWcsr Core Solaris Libraries (Root) diff --git a/solaris/depend.dev.in b/solaris/depend.dev.in index 8f234826b2..5d8bf16ed6 100644 --- a/solaris/depend.dev.in +++ b/solaris/depend.dev.in @@ -1,2 +1,2 @@ -P QUAGGAlibs Quagga common runtime libraries +P FRRlibs FreeRangeRouting common runtime libraries @PACKAGE_VERSION@,REV=@CONFDATE@ diff --git a/solaris/depend.libs.in b/solaris/depend.libs.in index 41859770a8..6ead0b2867 100644 --- a/solaris/depend.libs.in +++ b/solaris/depend.libs.in @@ -1,5 +1,5 @@ P SUNWcslr Core Solaris Libraries (Root) P SUNWcsl Core Solaris, (Shared Libs) P SUNWlibmsr Math & Microtasking Libraries (Root) -R QUAGGAdaemons Quagga daemons -R QUAGGAdev +R FRRdaemons FreeRangeRouting daemons +R FRRdev diff --git a/solaris/depend.smf.in b/solaris/depend.smf.in index 6d928d2df7..66b11eba2a 100644 --- a/solaris/depend.smf.in +++ b/solaris/depend.smf.in @@ -1,4 +1,4 @@ -P QUAGGAdaemons Quagga daemons +P FRRaemons FreeRangeRouting daemons @PACKAGE_VERSION@,REV=@CONFDATE@ P SUNWcsu Core Solaris, (Usr) P SUNWcsr Core Solaris Libraries (Root) diff --git a/solaris/quagga.init.in b/solaris/frr.init.in similarity index 79% rename from solaris/quagga.init.in rename to solaris/frr.init.in index ee3a987f33..580fd9b35c 100755 --- a/solaris/quagga.init.in +++ b/solaris/frr.init.in @@ -3,22 +3,22 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This file is part of Quagga. +# This file is part of FreeRangeRouting. # -# Quagga is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the +# FreeRangeRouting is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # -# Quagga is distributed in the hope that it will be useful, but +# FreeRangeRouting is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Quagga; see the file COPYING. If not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# along with FreeRangeRouting; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. # # Starts/stops the given daemon @@ -74,36 +74,36 @@ handle_routeadm_upgrade () { upgrade_config () { DAEMON=$1 - # handle upgrade of SUNWzebra to Quagga - if [ -d "/etc/quagga" -a ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + # handle upgrade of SUNWzebra to FreeRangeRouting + if [ -d "/etc/frr" -a ! -f "/etc/frr/${DAEMON}.conf" ] ; then if [ -f "/etc/sfw/zebra/${DAEMON}.conf" ] ; then cp "/etc/sfw/zebra/${DAEMON}.conf" \ - "/etc/quagga/${DAEMON}.conf.upgrade" \ + "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.upgrade" \ + chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - chmod 0600 "/etc/quagga/${DAEMON}.conf.upgrade" \ + chmod 0600 "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - mv "/etc/quagga/${DAEMON}.conf.upgrade" "/etc/quagga/${DAEMON}.conf" \ + mv "/etc/frr/${DAEMON}.conf.upgrade" "/etc/frr/${DAEMON}.conf" \ || exit $SMF_EXIT_ERR_FATAL fi fi - if [ ! -f "/etc/quagga/${DAEMON}.conf" ] ; then - touch "/etc/quagga/${DAEMON}.conf.new" \ + if [ ! -f "/etc/frr/${DAEMON}.conf" ] ; then + touch "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.new" \ + chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - chmod 0600 "/etc/quagga/${DAEMON}.conf.new" \ + chmod 0600 "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - mv "/etc/quagga/${DAEMON}.conf.new" "/etc/quagga/${DAEMON}.conf" \ + mv "/etc/frr/${DAEMON}.conf.new" "/etc/frr/${DAEMON}.conf" \ || exit $SMF_EXIT_ERR_FATAL fi } # Relevant to S10+ -quagga_is_globalzone () { - if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ +frr_is_globalzone () { + if [ "${FRR_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ -o `/sbin/zonename -t` = "exclusive" ]; then return 0 else @@ -188,9 +188,9 @@ case $1 in esac if smf_present ; then - QUAGGA_METHOD="start" + FRR_METHOD="start" else - QUAGGA_METHOD="$1" + FRR_METHOD="$1" shift; fi @@ -208,7 +208,7 @@ case "${DAEMON}" in bgpd) ;; zebra | ospfd | ospf6d | ripd | ripngd ) - quagga_is_globalzone || exit $SMF_EXIT_OK + frr_is_globalzone || exit $SMF_EXIT_OK ;; *) usage @@ -216,7 +216,7 @@ case "${DAEMON}" in ;; esac -# Older Quagga SMF packages pass daemon args on the commandline +# Older FreeRangeRouting SMF packages pass daemon args on the commandline # Newer SMF routeadm model uses properties for each argument # so we must handle that. if [ smf_present -a -f "$ROUTEADMINCLUDE" ]; then @@ -236,14 +236,14 @@ if [ ! -f "@sysconfdir@/${DAEMON}.conf" ] ; then exit $SMF_EXIT_ERR_CONFIG fi -# we need @quagga_statedir@ to exist, it probably is on tmpfs. -if [ ! -d @quagga_statedir@ ] ; then - mkdir -p @quagga_statedir@ - chown @enable_user@:@enable_group@ @quagga_statedir@ - chmod 751 @quagga_statedir@ +# we need @frr_statedir@ to exist, it probably is on tmpfs. +if [ ! -d @frr_statedir@ ] ; then + mkdir -p @frr_statedir@ + chown @enable_user@:@enable_group@ @frr_statedir@ + chmod 751 @frr_statedir@ fi -PIDFILE="@quagga_statedir@/${DAEMON}.pid" +PIDFILE="@frr_statedir@/${DAEMON}.pid" start () { if [ ! -x "$DAEMON_PATH/$DAEMON" ] ; then @@ -259,7 +259,7 @@ stop_by_pidfile () { fi } -case "$QUAGGA_METHOD" in +case "$FRR_METHOD" in 'start') start ;; diff --git a/solaris/quagga.xml.in b/solaris/frr.xml.in similarity index 88% rename from solaris/quagga.xml.in rename to solaris/frr.xml.in index 60427b06e9..5ac7e52721 100644 --- a/solaris/quagga.xml.in +++ b/solaris/frr.xml.in @@ -1,32 +1,32 @@ - + - + - + option name, consult FreeRangeRouting documentation --> + @frr_statedir@ --> @@ -142,14 +142,14 @@ @@ -161,7 +161,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -273,14 +273,14 @@ @@ -292,7 +292,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -402,14 +402,14 @@ @@ -421,7 +421,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -533,14 +533,14 @@ @@ -552,7 +552,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -659,14 +659,14 @@ @@ -679,7 +679,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -812,14 +812,14 @@ diff --git a/solaris/pkginfo.daemons.tmpl.in b/solaris/pkginfo.daemons.tmpl.in index cab0e3c231..7070d6dc97 100644 --- a/solaris/pkginfo.daemons.tmpl.in +++ b/solaris/pkginfo.daemons.tmpl.in @@ -1,2 +1,2 @@ -PKG="QUAGGAdaemons" +PKG="FRRdaemons" NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ daemons" diff --git a/solaris/pkginfo.dev.tmpl.in b/solaris/pkginfo.dev.tmpl.in index 9c5d23e28b..23796ba226 100644 --- a/solaris/pkginfo.dev.tmpl.in +++ b/solaris/pkginfo.dev.tmpl.in @@ -1,3 +1,3 @@ -PKG=QUAGGAdev +PKG=FRRdev NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ development files" diff --git a/solaris/pkginfo.doc.tmpl.in b/solaris/pkginfo.doc.tmpl.in index 809ec77518..727fbb526f 100644 --- a/solaris/pkginfo.doc.tmpl.in +++ b/solaris/pkginfo.doc.tmpl.in @@ -1,2 +1,2 @@ -PKG=QUAGGAdoc +PKG=FRRdoc NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ documentation" diff --git a/solaris/pkginfo.libs.tmpl.in b/solaris/pkginfo.libs.tmpl.in index 42adc6e1b7..adf945862c 100644 --- a/solaris/pkginfo.libs.tmpl.in +++ b/solaris/pkginfo.libs.tmpl.in @@ -1,2 +1,2 @@ -PKG=QUAGGAlibs +PKG=FRRlibs NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ common runtime libraries" diff --git a/solaris/pkginfo.smf.tmpl.in b/solaris/pkginfo.smf.tmpl.in index 4aa03936e4..a90cb1bdee 100644 --- a/solaris/pkginfo.smf.tmpl.in +++ b/solaris/pkginfo.smf.tmpl.in @@ -1,2 +1,2 @@ -PKG="QUAGGAsmf" +PKG="FRRsmf" NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ SMF support" diff --git a/solaris/pkginfo.tmpl.in b/solaris/pkginfo.tmpl.in index 2dd27fd2cf..02abb0f96b 100644 --- a/solaris/pkginfo.tmpl.in +++ b/solaris/pkginfo.tmpl.in @@ -1,9 +1,9 @@ ARCH="@target_cpu@" CATEGORY="system" VERSION="@PACKAGE_VERSION@,REV=@CONFDATE@" -VENDOR="http://www.quagga.net/" +VENDOR="http://www.freerangerouting.org/" HOTLINE="@PACKAGE_BUGREPORT@" -EMAIL=paul@quagga.net +EMAIL=maintainers@freerangerouting.org DESC="@PACKAGE_NAME@ Routing Protocols" MAXINST=1 CLASSES="none preserve renamenew manifest" diff --git a/solaris/prototype.daemons.in b/solaris/prototype.daemons.in index 8a906c9d0a..9af275a17f 100644 --- a/solaris/prototype.daemons.in +++ b/solaris/prototype.daemons.in @@ -17,4 +17,4 @@ f none @sysconfdir@/ripd.conf.sample=$DESTDIR/@sysconfdir@/ripd.conf.sample 0644 f none @sysconfdir@/ripngd.conf.sample=$DESTDIR/@sysconfdir@/ripngd.conf.sample 0644 root bin f none @sysconfdir@/ospfd.conf.sample=$DESTDIR/@sysconfdir@/ospfd.conf.sample 0644 root bin f none @sysconfdir@/ospf6d.conf.sample=$DESTDIR/@sysconfdir@/ospf6d.conf.sample 0644 root bin -d none @quagga_statedir@=$DESTDIR/@quagga_statedir@ 0711 @enable_user@ @enable_group@ +d none @frr_statedir@=$DESTDIR/@frr_statedir@ 0711 @enable_user@ @enable_group@ diff --git a/solaris/prototype.dev.in b/solaris/prototype.dev.in index 2ad937b78a..dd3ae399ae 100644 --- a/solaris/prototype.dev.in +++ b/solaris/prototype.dev.in @@ -8,50 +8,50 @@ f none @libdir@/libospf.a=$DESTDIR/@libdir@/libospf.a 0644 root bin f none @libdir@/libospfapiclient.la=$DESTDIR/@libdir@/libospfapiclient.la 0755 root bin f none @libdir@/libospfapiclient.a=$DESTDIR/@libdir@/libospfapiclient.a 0644 root bin d none @includedir@=$DESTDIR/@includedir@ 0755 root bin -d none @includedir@/quagga=$DESTDIR/@includedir@/quagga 0755 root bin -d none @includedir@/quagga/ospfd=$DESTDIR/@includedir@/quagga/ospfd 0755 root bin -f none @includedir@/quagga/ospfd/ospf_api.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_api.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_asbr.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_asbr.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_dump.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_dump.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_lsa.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_lsa.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_lsdb.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_lsdb.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_nsm.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_nsm.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_ism.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_ism.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_opaque.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_opaque.h 0644 root bin -f none @includedir@/quagga/ospfd/ospfd.h=$DESTDIR/@includedir@/quagga/ospfd/ospfd.h 0644 root bin -f none @includedir@/quagga/buffer.h=$DESTDIR/@includedir@/quagga/buffer.h 0644 root bin -f none @includedir@/quagga/command.h=$DESTDIR/@includedir@/quagga/command.h 0644 root bin -f none @includedir@/quagga/filter.h=$DESTDIR/@includedir@/quagga/filter.h 0644 root bin -f none @includedir@/quagga/getopt.h=$DESTDIR/@includedir@/quagga/getopt.h 0644 root bin -f none @includedir@/quagga/hash.h=$DESTDIR/@includedir@/quagga/hash.h 0644 root bin -f none @includedir@/quagga/if.h=$DESTDIR/@includedir@/quagga/if.h 0644 root bin -f none @includedir@/quagga/linklist.h=$DESTDIR/@includedir@/quagga/linklist.h 0644 root bin -f none @includedir@/quagga/log.h=$DESTDIR/@includedir@/quagga/log.h 0644 root bin -f none @includedir@/quagga/memory.h=$DESTDIR/@includedir@/quagga/memory.h 0644 root bin -f none @includedir@/quagga/network.h=$DESTDIR/@includedir@/quagga/network.h 0644 root bin -f none @includedir@/quagga/prefix.h=$DESTDIR/@includedir@/quagga/prefix.h 0644 root bin -f none @includedir@/quagga/routemap.h=$DESTDIR/@includedir@/quagga/routemap.h 0644 root bin -f none @includedir@/quagga/distribute.h=$DESTDIR/@includedir@/quagga/distribute.h 0644 root bin -f none @includedir@/quagga/sockunion.h=$DESTDIR/@includedir@/quagga/sockunion.h 0644 root bin -f none @includedir@/quagga/str.h=$DESTDIR/@includedir@/quagga/str.h 0644 root bin -f none @includedir@/quagga/stream.h=$DESTDIR/@includedir@/quagga/stream.h 0644 root bin -f none @includedir@/quagga/table.h=$DESTDIR/@includedir@/quagga/table.h 0644 root bin -f none @includedir@/quagga/thread.h=$DESTDIR/@includedir@/quagga/thread.h 0644 root bin -f none @includedir@/quagga/vector.h=$DESTDIR/@includedir@/quagga/vector.h 0644 root bin -f none @includedir@/quagga/version.h=$DESTDIR/@includedir@/quagga/version.h 0644 root bin -f none @includedir@/quagga/vty.h=$DESTDIR/@includedir@/quagga/vty.h 0644 root bin -f none @includedir@/quagga/zebra.h=$DESTDIR/@includedir@/quagga/zebra.h 0644 root bin -f none @includedir@/quagga/plist.h=$DESTDIR/@includedir@/quagga/plist.h 0644 root bin -f none @includedir@/quagga/zclient.h=$DESTDIR/@includedir@/quagga/zclient.h 0644 root bin -f none @includedir@/quagga/sockopt.h=$DESTDIR/@includedir@/quagga/sockopt.h 0644 root bin -f none @includedir@/quagga/smux.h=$DESTDIR/@includedir@/quagga/smux.h 0644 root bin -f none @includedir@/quagga/md5.h=$DESTDIR/@includedir@/quagga/md5.h 0644 root bin -f none @includedir@/quagga/if_rmap.h=$DESTDIR/@includedir@/quagga/if_rmap.h 0644 root bin -f none @includedir@/quagga/keychain.h=$DESTDIR/@includedir@/quagga/keychain.h 0644 root bin -f none @includedir@/quagga/privs.h=$DESTDIR/@includedir@/quagga/privs.h 0644 root bin -f none @includedir@/quagga/sigevent.h=$DESTDIR/@includedir@/quagga/sigevent.h 0644 root bin -f none @includedir@/quagga/pqueue.h=$DESTDIR/@includedir@/quagga/pqueue.h 0644 root bin -f none @includedir@/quagga/jhash.h=$DESTDIR/@includedir@/quagga/jhash.h 0644 root bin -f none @includedir@/quagga/zassert.h=$DESTDIR/@includedir@/quagga/zassert.h 0644 root bin -d none @includedir@/quagga/ospfapi=$DESTDIR/@includedir@/quagga/ospfapi 0755 root bin -f none @includedir@/quagga/ospfapi/ospf_apiclient.h=$DESTDIR/@includedir@/quagga/ospfapi/ospf_apiclient.h 0644 root bin +d none @includedir@/frr=$DESTDIR/@includedir@/frr 0755 root bin +d none @includedir@/frr/ospfd=$DESTDIR/@includedir@/frr/ospfd 0755 root bin +f none @includedir@/frr/ospfd/ospf_api.h=$DESTDIR/@includedir@/frr/ospfd/ospf_api.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_asbr.h=$DESTDIR/@includedir@/frr/ospfd/ospf_asbr.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_dump.h=$DESTDIR/@includedir@/frr/ospfd/ospf_dump.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_lsa.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsa.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_lsdb.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsdb.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_nsm.h=$DESTDIR/@includedir@/frr/ospfd/ospf_nsm.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_ism.h=$DESTDIR/@includedir@/frr/ospfd/ospf_ism.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_opaque.h=$DESTDIR/@includedir@/frr/ospfd/ospf_opaque.h 0644 root bin +f none @includedir@/frr/ospfd/ospfd.h=$DESTDIR/@includedir@/frr/ospfd/ospfd.h 0644 root bin +f none @includedir@/frr/buffer.h=$DESTDIR/@includedir@/frr/buffer.h 0644 root bin +f none @includedir@/frr/command.h=$DESTDIR/@includedir@/frr/command.h 0644 root bin +f none @includedir@/frr/filter.h=$DESTDIR/@includedir@/frr/filter.h 0644 root bin +f none @includedir@/frr/getopt.h=$DESTDIR/@includedir@/frr/getopt.h 0644 root bin +f none @includedir@/frr/hash.h=$DESTDIR/@includedir@/frr/hash.h 0644 root bin +f none @includedir@/frr/if.h=$DESTDIR/@includedir@/frr/if.h 0644 root bin +f none @includedir@/frr/linklist.h=$DESTDIR/@includedir@/frr/linklist.h 0644 root bin +f none @includedir@/frr/log.h=$DESTDIR/@includedir@/frr/log.h 0644 root bin +f none @includedir@/frr/memory.h=$DESTDIR/@includedir@/frr/memory.h 0644 root bin +f none @includedir@/frr/network.h=$DESTDIR/@includedir@/frr/network.h 0644 root bin +f none @includedir@/frr/prefix.h=$DESTDIR/@includedir@/frr/prefix.h 0644 root bin +f none @includedir@/frr/routemap.h=$DESTDIR/@includedir@/frr/routemap.h 0644 root bin +f none @includedir@/frr/distribute.h=$DESTDIR/@includedir@/frr/distribute.h 0644 root bin +f none @includedir@/frr/sockunion.h=$DESTDIR/@includedir@/frr/sockunion.h 0644 root bin +f none @includedir@/frr/str.h=$DESTDIR/@includedir@/frr/str.h 0644 root bin +f none @includedir@/frr/stream.h=$DESTDIR/@includedir@/frr/stream.h 0644 root bin +f none @includedir@/frr/table.h=$DESTDIR/@includedir@/frr/table.h 0644 root bin +f none @includedir@/frr/thread.h=$DESTDIR/@includedir@/frr/thread.h 0644 root bin +f none @includedir@/frr/vector.h=$DESTDIR/@includedir@/frr/vector.h 0644 root bin +f none @includedir@/frr/version.h=$DESTDIR/@includedir@/frr/version.h 0644 root bin +f none @includedir@/frr/vty.h=$DESTDIR/@includedir@/frr/vty.h 0644 root bin +f none @includedir@/frr/zebra.h=$DESTDIR/@includedir@/frr/zebra.h 0644 root bin +f none @includedir@/frr/plist.h=$DESTDIR/@includedir@/frr/plist.h 0644 root bin +f none @includedir@/frr/zclient.h=$DESTDIR/@includedir@/frr/zclient.h 0644 root bin +f none @includedir@/frr/sockopt.h=$DESTDIR/@includedir@/frr/sockopt.h 0644 root bin +f none @includedir@/frr/smux.h=$DESTDIR/@includedir@/frr/smux.h 0644 root bin +f none @includedir@/frr/md5.h=$DESTDIR/@includedir@/frr/md5.h 0644 root bin +f none @includedir@/frr/if_rmap.h=$DESTDIR/@includedir@/frr/if_rmap.h 0644 root bin +f none @includedir@/frr/keychain.h=$DESTDIR/@includedir@/frr/keychain.h 0644 root bin +f none @includedir@/frr/privs.h=$DESTDIR/@includedir@/frr/privs.h 0644 root bin +f none @includedir@/frr/sigevent.h=$DESTDIR/@includedir@/frr/sigevent.h 0644 root bin +f none @includedir@/frr/pqueue.h=$DESTDIR/@includedir@/frr/pqueue.h 0644 root bin +f none @includedir@/frr/jhash.h=$DESTDIR/@includedir@/frr/jhash.h 0644 root bin +f none @includedir@/frr/zassert.h=$DESTDIR/@includedir@/frr/zassert.h 0644 root bin +d none @includedir@/frr/ospfapi=$DESTDIR/@includedir@/frr/ospfapi 0755 root bin +f none @includedir@/frr/ospfapi/ospf_apiclient.h=$DESTDIR/@includedir@/frr/ospfapi/ospf_apiclient.h 0644 root bin diff --git a/solaris/prototype.doc.in b/solaris/prototype.doc.in index 42b076d0ec..a8644b3145 100644 --- a/solaris/prototype.doc.in +++ b/solaris/prototype.doc.in @@ -3,7 +3,7 @@ i depend=$abs_builddir/depend.doc i copying=$abs_top_srcdir/COPYING d none @infodir@=$DESTDIR/@infodir@ 0755 root bin #f none @infodir@/dir=$DESTDIR/@infodir@/dir 0644 root bin -f none @infodir@/quagga.info=$DESTDIR/@infodir@/quagga.info 0644 root bin +f none @infodir@/frr.info=$DESTDIR/@infodir@/frr.info 0644 root bin d none @mandir@=$DESTDIR/@mandir@ 0755 root bin d none @mandir@/man1=$DESTDIR/@mandir@/man1 0755 root bin f none @mandir@/man1/vtysh.1=$DESTDIR/@mandir@/man1/vtysh.1 0644 root bin diff --git a/solaris/prototype.smf.in b/solaris/prototype.smf.in index 3c80f39b1e..5755a8827d 100644 --- a/solaris/prototype.smf.in +++ b/solaris/prototype.smf.in @@ -3,6 +3,6 @@ i depend=$abs_builddir/depend.smf i copying=$abs_top_srcdir/COPYING i i.manifest i r.manifest -f manifest var/svc/manifest/network/quagga.xml 0444 root bin +f manifest var/svc/manifest/network/frr.xml 0444 root bin #f none var/svc/profile/@PACKAGE_TARNAME@_options.xml=$abs_builddir/options.xml 0755 root sys -f none lib/svc/method/quagga=$abs_builddir/quagga.init 0755 root bin +f none lib/svc/method/frr=$abs_builddir/frr.init 0755 root bin diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 463784de11..1cad55ac34 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -38,7 +38,7 @@ import string import subprocess import sys from collections import OrderedDict -from ipaddr import IPv6Address +from ipaddr import IPv6Address, IPNetwork from pprint import pformat @@ -173,6 +173,100 @@ class Config(object): if not key: return + ''' + IP addresses specified in "network" statements, "ip prefix-lists" + etc. can differ in the host part of the specification the user + provides and what the running config displays. For example, user + can specify 11.1.1.1/24, and the running config displays this as + 11.1.1.0/24. Ensure we don't do a needless operation for such + lines. IS-IS & OSPFv3 have no "network" support. + ''' + re_key_rt = re.match(r'(ip|ipv6)\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0]) + if re_key_rt: + addr = re_key_rt.group(2) + if '/' in addr: + try: + newaddr = IPNetwork(addr) + key[0] = '%s route %s/%s%s' % (re_key_rt.group(1), + newaddr.network, + newaddr.prefixlen, + re_key_rt.group(3)) + except ValueError: + pass + + re_key_rt = re.match( + r'(ip|ipv6)\s+prefix-list(.*)(permit|deny)\s+([A-Fa-f:.0-9/]+)(.*)$', + key[0] + ) + if re_key_rt: + addr = re_key_rt.group(4) + if '/' in addr: + try: + newaddr = '%s/%s' % (IPNetwork(addr).network, + IPNetwork(addr).prefixlen) + except ValueError: + newaddr = addr + else: + newaddr = addr + + legestr = re_key_rt.group(5) + re_lege = re.search(r'(.*)le\s+(\d+)\s+ge\s+(\d+)(.*)', legestr) + if re_lege: + legestr = '%sge %s le %s%s' % (re_lege.group(1), + re_lege.group(3), + re_lege.group(2), + re_lege.group(4)) + re_lege = re.search(r'(.*)ge\s+(\d+)\s+le\s+(\d+)(.*)', legestr) + + if (re_lege and ((re_key_rt.group(1) == "ip" and + re_lege.group(3) == "32") or + (re_key_rt.group(1) == "ipv6" and + re_lege.group(3) == "128"))): + legestr = '%sge %s%s' % (re_lege.group(1), + re_lege.group(2), + re_lege.group(4)) + + key[0] = '%s prefix-list%s%s %s%s' % (re_key_rt.group(1), + re_key_rt.group(2), + re_key_rt.group(3), + newaddr, + legestr) + + if lines and key[0].startswith('router bgp'): + newlines = [] + for line in lines: + re_net = re.match(r'network\s+([A-Fa-f:.0-9/]+)(.*)$', line) + if re_net: + addr = re_net.group(1) + if '/' not in addr and key[0].startswith('router bgp'): + # This is most likely an error because with no + # prefixlen, BGP treats the prefixlen as 8 + addr = addr + '/8' + + try: + newaddr = IPNetwork(addr) + line = 'network %s/%s %s' % (newaddr.network, + newaddr.prefixlen, + re_net.group(2)) + newlines.append(line) + except ValueError: + # Really this should be an error. Whats a network + # without an IP Address following it ? + newlines.append(line) + else: + newlines.append(line) + lines = newlines + + ''' + More fixups in user specification and what running config shows. + "null0" in routes must be replaced by Null0, and "blackhole" must + be replaced by Null0 as well. + ''' + if (key[0].startswith('ip route') or key[0].startswith('ipv6 route') and + 'null0' in key[0] or 'blackhole' in key[0]): + key[0] = re.sub(r'\s+null0(\s*$)', ' Null0', key[0]) + key[0] = re.sub(r'\s+blackhole(\s*$)', ' Null0', key[0]) + if lines: if tuple(key) not in self.contexts: ctx = Context(tuple(key), lines) @@ -437,16 +531,25 @@ def get_normalized_ipv6_line(line): """ Return a normalized IPv6 line as produced by frr, with all letters in lower case and trailing and leading - zeros removed + zeros removed, and only the network portion present if + the IPv6 word is a network """ norm_line = "" words = line.split(' ') for word in words: if ":" in word: - try: - norm_word = str(IPv6Address(word)).lower() - except: - norm_word = word + norm_word = None + if "/" in word: + try: + v6word = IPNetwork(word) + norm_word = '%s/%s' % (v6word.network, v6word.prefixlen) + except ValueError: + pass + if not norm_word: + try: + norm_word = '%s' % IPv6Address(word) + except ValueError: + norm_word = word else: norm_word = word norm_line = norm_line + " " + norm_word @@ -579,6 +682,60 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del): lines_to_add_to_del.append((ctx_keys, swpx_interface)) lines_to_add_to_del.append((tmp_ctx_keys, swpx_remoteas)) + ''' + In 3.0, we made bgp bestpath multipath as-relax command + automatically assume no-as-set since the lack of this option caused + weird routing problems and this problem was peculiar to this + implementation. When the running config is shown in relases after + 3.0, the no-as-set is not shown as its the default. This causes + reload to unnecessarily unapply this option to only apply it back + again, causing unnecessary session resets. Handle this. + ''' + if ctx_keys[0].startswith('router bgp') and line and 'multipath-relax' in line: + re_asrelax_new = re.search('^bgp\s+bestpath\s+as-path\s+multipath-relax$', line) + old_asrelax_cmd = 'bgp bestpath as-path multipath-relax no-as-set' + found_asrelax_old = line_exist(lines_to_add, ctx_keys, old_asrelax_cmd) + + if re_asrelax_new and found_asrelax_old: + deleted = True + lines_to_del_to_del.append((ctx_keys, line)) + lines_to_add_to_del.append((ctx_keys, old_asrelax_cmd)) + + ''' + More old-to-new config handling. ip import-table no longer accepts + distance, but we honor the old syntax. But 'show running' shows only + the new syntax. This causes an unnecessary 'no import-table' followed + by the same old 'ip import-table' which causes perturbations in + announced routes leading to traffic blackholes. Fix this issue. + ''' + re_importtbl = re.search('^ip\s+import-table\s+(\d+)$', ctx_keys[0]) + if re_importtbl: + table_num = re_importtbl.group(1) + for ctx in lines_to_add: + if ctx[0][0].startswith('ip import-table %s distance' % table_num): + lines_to_del_to_del.append((('ip import-table %s' % table_num,), None)) + lines_to_add_to_del.append((ctx[0], None)) + + ''' + ip/ipv6 prefix-list can be specified without a seq number. However, + the running config always adds 'seq x', where x is a number incremented + by 5 for every element, to the prefix list. So, ignore such lines as + well. Sample prefix-list lines: + ip prefix-list PR-TABLE-2 seq 5 permit 20.8.2.0/24 le 32 + ip prefix-list PR-TABLE-2 seq 10 permit 20.8.2.0/24 le 32 + ipv6 prefix-list vrfdev6-12 permit 2000:9:2::/64 gt 64 + ''' + re_ip_pfxlst = re.search('^(ip|ipv6)(\s+prefix-list\s+)(\S+\s+)(seq \d+\s+)(permit|deny)(.*)$', + ctx_keys[0]) + if re_ip_pfxlst: + tmpline = (re_ip_pfxlst.group(1) + re_ip_pfxlst.group(2) + + re_ip_pfxlst.group(3) + re_ip_pfxlst.group(5) + + re_ip_pfxlst.group(6)) + for ctx in lines_to_add: + if ctx[0][0] == tmpline: + lines_to_del_to_del.append((ctx_keys, None)) + lines_to_add_to_del.append(((tmpline,), None)) + if not deleted: found_add_line = line_exist(lines_to_add, ctx_keys, line) @@ -646,6 +803,11 @@ def compare_context_objects(newconf, running): delete_bgpd = True lines_to_del.append((running_ctx_keys, None)) + # We cannot do 'no interface' in quagga, and so deal with it + elif running_ctx_keys[0].startswith('interface'): + for line in running_ctx.lines: + lines_to_del.append((running_ctx_keys, line)) + # If this is an address-family under 'router bgp' and we are already deleting the # entire 'router bgp' context then ignore this sub-context elif "router bgp" in running_ctx_keys[0] and len(running_ctx_keys) > 1 and delete_bgpd: @@ -697,6 +859,7 @@ if __name__ == '__main__': parser.add_argument('--debug', action='store_true', help='Enable debugs', default=False) parser.add_argument('--stdout', action='store_true', help='Log to STDOUT', default=False) parser.add_argument('filename', help='Location of new frr config file') + parser.add_argument('--overwrite', action='store_true', help='Overwrite Quagga.conf with running config output', default=False) args = parser.parse_args() # Logging @@ -904,5 +1067,6 @@ if __name__ == '__main__': subprocess.call(['/usr/bin/vtysh', '-f', filename]) os.unlink(filename) - # Make these changes persistent + # Make these changes persistent + if args.overwrite or args.filename != '/etc/quagga/Quagga.conf': subprocess.call(['/usr/bin/vtysh', '-c', 'write']) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 5b23b2440a..c1b1d705a4 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -62,6 +62,9 @@ $ignore{'"address-family vpnv4 unicast"'} = "ignore"; $ignore{'"address-family ipv4 vrf NAME"'} = "ignore"; $ignore{'"address-family "'} = "ignore"; $ignore{'"address-family encapv6"'} = "ignore"; +$ignore{'"address-family ipv4 encap"'} = "ignore"; +$ignore{'"address-family ipv6 encap"'} = "ignore"; +$ignore{'"address-family ipv6 vpn"'} = "ignore"; $ignore{'"address-family vpnv6"'} = "ignore"; $ignore{'"address-family vpnv6 unicast"'} = "ignore"; $ignore{'"exit-address-family"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index f15f051e69..bc95dbb133 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2842,13 +2842,34 @@ vtysh_connect (struct vtysh_client *vclient) int sock, len; struct sockaddr_un addr; struct stat s_stat; + char path[MAXPATHLEN]; + + if (vty_sock_path == NULL) + strlcpy (path, vclient->path, sizeof (path)); + else { + /* Different path for VTY Socket specified + overriding the default path, but keep the filename */ + strlcpy (path, vty_sock_path, sizeof (path)); + + if (strrchr (vclient->path, '/') != NULL) + strlcat (path, strrchr (vclient->path, '/'), sizeof (path)); + else { + /* + * vclient->path configured as relative path during config? Should + * really never happen for sensible config + */ + strlcat (path, "/", sizeof (path)); + strlcat (path, vclient->path, sizeof (path)); + } + } + path[sizeof(path)-1] = '\0'; /* Stat socket to see if we have permission to access it. */ - ret = stat (vclient->path, &s_stat); + ret = stat (path, &s_stat); if (ret < 0 && errno != ENOENT) { fprintf (stderr, "vtysh_connect(%s): stat = %s\n", - vclient->path, safe_strerror(errno)); + path, safe_strerror(errno)); exit(1); } @@ -2857,7 +2878,7 @@ vtysh_connect (struct vtysh_client *vclient) if (! S_ISSOCK(s_stat.st_mode)) { fprintf (stderr, "vtysh_connect(%s): Not a socket\n", - vclient->path); + path); exit (1); } @@ -2867,7 +2888,7 @@ vtysh_connect (struct vtysh_client *vclient) if (sock < 0) { #ifdef DEBUG - fprintf(stderr, "vtysh_connect(%s): socket = %s\n", vclient->path, + fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path, safe_strerror(errno)); #endif /* DEBUG */ return -1; @@ -2875,7 +2896,7 @@ vtysh_connect (struct vtysh_client *vclient) memset (&addr, 0, sizeof (struct sockaddr_un)); addr.sun_family = AF_UNIX; - strncpy (addr.sun_path, vclient->path, strlen (vclient->path)); + strncpy (addr.sun_path, path, strlen (path)); #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN len = addr.sun_len = SUN_LEN(&addr); #else @@ -2886,7 +2907,7 @@ vtysh_connect (struct vtysh_client *vclient) if (ret < 0) { #ifdef DEBUG - fprintf(stderr, "vtysh_connect(%s): connect = %s\n", vclient->path, + fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path, safe_strerror(errno)); #endif /* DEBUG */ close (sock); @@ -2937,14 +2958,23 @@ vtysh_update_all_insances(struct vtysh_client * head_client) { struct vtysh_client *client; char *ptr; + char vty_dir[MAXPATHLEN]; DIR *dir; struct dirent *file; int n = 0; if (head_client->flag != VTYSH_OSPFD) return; - /* ls DAEMON_VTY_DIR and look for all files ending in .vty */ - dir = opendir(DAEMON_VTY_DIR "/"); + if (vty_sock_path == NULL) + /* ls DAEMON_VTY_DIR and look for all files ending in .vty */ + strlcpy(vty_dir, DAEMON_VTY_DIR "/", MAXPATHLEN); + else + { + /* ls vty_sock_dir and look for all files ending in .vty */ + strlcpy(vty_dir, vty_sock_path, MAXPATHLEN); + strlcat(vty_dir, "/", MAXPATHLEN); + } + dir = opendir(vty_dir); if (dir) { while ((file = readdir(dir)) != NULL) @@ -2954,8 +2984,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client) if (n == MAXIMUM_INSTANCES) { fprintf(stderr, - "Parsing %s/, client limit(%d) reached!\n", - DAEMON_VTY_DIR, n); + "Parsing %s, client limit(%d) reached!\n", + vty_dir, n); break; } client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client)); @@ -2963,7 +2993,7 @@ vtysh_update_all_insances(struct vtysh_client * head_client) client->name = "ospfd"; client->flag = VTYSH_OSPFD; ptr = (char *) malloc(100); - sprintf(ptr, "%s/%s", DAEMON_VTY_DIR, file->d_name); + sprintf(ptr, "%s%s", vty_dir, file->d_name); client->path = (const char *)ptr; client->next = NULL; vtysh_client_sorted_insert(head_client, client); diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index 46ed001919..537f944a7a 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -96,4 +96,6 @@ extern int execute_flag; extern struct vty *vty; +extern char * vty_sock_path; + #endif /* VTYSH_H */ diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 6b33fca39b..78b17be058 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -45,14 +45,17 @@ char *progname; /* Configuration file name and directory. */ -static char vtysh_config_always[] = SYSCONFDIR VTYSH_DEFAULT_CONFIG; -static char quagga_config_default[] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG; +static char vtysh_config_always[MAXPATHLEN] = SYSCONFDIR VTYSH_DEFAULT_CONFIG; +static char quagga_config_default[MAXPATHLEN] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG; char *quagga_config = quagga_config_default; char history_file[MAXPATHLEN]; /* Flag for indicate executing child command. */ int execute_flag = 0; +/* VTY Socket prefix */ +char * vty_sock_path = NULL; + /* For sigsetjmp() & siglongjmp(). */ static sigjmp_buf jmpbuf; @@ -144,8 +147,11 @@ usage (int status) "-f, --inputfile Execute commands from specific file and exit\n" \ "-E, --echo Echo prompt and command in -c mode\n" \ "-C, --dryrun Check configuration for validity and exit\n" \ - "-m, --markfile Mark input file with context end\n" - "-w, --writeconfig Write integrated config (Quagga.conf) and exit\n" + " --vty_socket Override vty socket path\n" \ + "-m, --markfile Mark input file with context end\n" \ + " --vty_socket Override vty socket path\n" \ + " --config_dir Override config directory path\n" \ + "-w, --writeconfig Write integrated config (Quagga.conf) and exit\n" \ "-h, --help Display this help and exit\n\n" \ "Note that multiple commands may be executed from the command\n" \ "line by passing multiple -c args, or by embedding linefeed\n" \ @@ -156,6 +162,8 @@ usage (int status) } /* VTY shell options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 +#define OPTION_CONFDIR 1001 struct option longopts[] = { { "boot", no_argument, NULL, 'b'}, @@ -163,6 +171,8 @@ struct option longopts[] = { "eval", required_argument, NULL, 'e'}, { "command", required_argument, NULL, 'c'}, { "daemon", required_argument, NULL, 'd'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, + { "config_dir", required_argument, NULL, OPTION_CONFDIR}, { "inputfile", required_argument, NULL, 'f'}, { "echo", no_argument, NULL, 'E'}, { "dryrun", no_argument, NULL, 'C'}, @@ -262,6 +272,7 @@ main (int argc, char **argv, char **env) int boot_flag = 0; const char *daemon_name = NULL; const char *inputfile = NULL; + const char *vtysh_configfile_name; struct cmd_rec { const char *line; struct cmd_rec *next; @@ -274,6 +285,9 @@ main (int argc, char **argv, char **env) int ret = 0; char *homedir = NULL; + /* check for restricted functionality if vtysh is run setuid */ + int restricted = (getuid() != geteuid()) || (getgid() != getegid()); + /* Preserve name of myself. */ progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]); @@ -310,6 +324,55 @@ main (int argc, char **argv, char **env) tail = cr; } break; + case OPTION_VTYSOCK: + vty_sock_path = optarg; + break; + case OPTION_CONFDIR: + /* + * Skip option for Config Directory if setuid + */ + if (restricted) + { + fprintf (stderr, "Overriding of Config Directory blocked for vtysh with setuid"); + return 1; + } + /* + * Overwrite location for vtysh.conf + */ + vtysh_configfile_name = strrchr(VTYSH_DEFAULT_CONFIG, '/'); + if (vtysh_configfile_name) + /* skip '/' */ + vtysh_configfile_name++; + else + /* + * VTYSH_DEFAULT_CONFIG configured with relative path + * during config? Should really never happen for + * sensible config + */ + vtysh_configfile_name = (char *) VTYSH_DEFAULT_CONFIG; + strlcpy(vtysh_config_always, optarg, sizeof(vtysh_config_always)); + strlcat(vtysh_config_always, "/", sizeof(vtysh_config_always)); + strlcat(vtysh_config_always, vtysh_configfile_name, + sizeof(vtysh_config_always)); + /* + * Overwrite location for Quagga.conf + */ + vtysh_configfile_name = strrchr(QUAGGA_DEFAULT_CONFIG, '/'); + if (vtysh_configfile_name) + /* skip '/' */ + vtysh_configfile_name++; + else + /* + * QUAGGA_DEFAULT_CONFIG configured with relative path + * during config? Should really never happen for + * sensible config + */ + vtysh_configfile_name = (char *) QUAGGA_DEFAULT_CONFIG; + strlcpy(quagga_config_default, optarg, sizeof(vtysh_config_always)); + strlcat(quagga_config_default, "/", sizeof(vtysh_config_always)); + strlcat(quagga_config_default, vtysh_configfile_name, + sizeof(quagga_config_default)); + break; case 'd': daemon_name = optarg; break; diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 132eaede27..cce797c932 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -220,7 +220,12 @@ char * vtysh_get_home (void) { struct passwd *passwd; + char * homedir; + if ((homedir = getenv("HOME")) != 0) + return homedir; + + /* Fallback if HOME is undefined */ passwd = getpwuid (getuid ()); return passwd ? passwd->pw_dir : NULL; diff --git a/zebra/main.c b/zebra/main.c index 9abc8f87ff..a68e8adeb6 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -35,6 +35,7 @@ #include "privs.h" #include "sigevent.h" #include "vrf.h" +#include "sockopt.h" #include "zebra/rib.h" #include "zebra/zserv.h" @@ -59,6 +60,9 @@ struct zebra_t zebrad = /* process id. */ pid_t pid; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = ZEBRA_VTYSH_PATH; + /* Pacify zclient.o in libzebra, which expects this variable. */ struct thread_master *master; @@ -77,6 +81,7 @@ u_int32_t nl_rcvbufsize = 4194304; #endif /* HAVE_NETLINK */ /* Command line options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "batch", no_argument, NULL, 'b'}, @@ -90,6 +95,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK }, { "retain", no_argument, NULL, 'r'}, { "dryrun", no_argument, NULL, 'C'}, #ifdef HAVE_NETLINK @@ -152,6 +158,7 @@ usage (char *progname, int status) "-C, --dryrun Check configuration for validity and exit\n"\ "-A, --vty_addr Set vty's bind address\n"\ "-P, --vty_port Set vty's port number\n"\ + " --vty_socket Override vty socket path\n"\ "-r, --retain When program terminates, retain added route "\ "by zebra.\n"\ "-u, --user User to run as\n"\ @@ -339,6 +346,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = ZEBRA_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, ZEBRA_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -463,7 +473,7 @@ main (int argc, char **argv) zebra_zserv_socket_init (zserv_path); /* Make vty server socket. */ - vty_serv_sock (vty_addr, vty_port, ZEBRA_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("Zebra %s starting: vty@%d", FRR_VERSION, vty_port); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 17b5a6e6d8..d88dc05b28 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -868,8 +868,10 @@ _netlink_route_build_singlepath( if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { - _netlink_route_nl_add_gateway_info (rtmsg->rtm_family, AF_INET, nlmsg, - req_size, bytelen, nexthop); + /* Send deletes to the kernel without specifying the next-hop */ + if (cmd != RTM_DELROUTE) + _netlink_route_nl_add_gateway_info (rtmsg->rtm_family, AF_INET, nlmsg, + req_size, bytelen, nexthop); if (cmd == RTM_NEWROUTE) { diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index f3f849a6f4..446eb4953b 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -459,6 +459,7 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) char vrf_str[64]; struct prefix dest_prefix; struct prefix src_prefix; + vrf_id_t vrf_id; ptm_lib_find_key_in_msg(in_ctxt, ZEBRA_PTM_BFDSTATUS_STR, bfdst_str); @@ -491,7 +492,8 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) } if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s] peer [%s] local [%s]", + zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s]" + " peer [%s] local [%s]", __func__, ifp ? ifp->name : "N/A", bfdst_str, vrf_str, dest_str, src_str); @@ -510,12 +512,18 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) } } + if (!strcmp(ZEBRA_PTM_INVALID_VRF, vrf_str) && ifp) { + vrf_id = ifp->vrf_id; + } else { + vrf_id = vrf_name_to_id(vrf_str); + } + if (!strcmp (bfdst_str, ZEBRA_PTM_BFDSTATUS_DOWN_STR)) { if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_DOWN, - vrf_name_to_id(vrf_str)); + vrf_id); } else { if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_UP, - vrf_name_to_id(vrf_str)); + vrf_id); } return 0;