From 826d8beff51174fa1abee9696d02320b1a27331f Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 12 Apr 2017 18:54:40 -0700 Subject: [PATCH 01/25] redhat: Replace tab's with spaces in README Signed-off-by: Martin Winter --- redhat/README.rpm_build.md | 140 ++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 71 deletions(-) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index 6bec5d65cd..d3fd271c62 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -4,71 +4,69 @@ Building your own FRRouting RPM 1. Install the following packages to build the RPMs: - yum install git autoconf automake libtool make gawk readline-devel \ - texinfo dejagnu net-snmp-devel groff rpm-build net-snmp-devel \ - libcap-devel texi2html + yum install git autoconf automake libtool make gawk readline-devel \ + texinfo dejagnu net-snmp-devel groff rpm-build net-snmp-devel \ + libcap-devel texi2html - (use `dnf install` on new Fedora instead of `yum install `) - + (use `dnf install` on new Fedora instead of `yum install`) + 2. Checkout FRR under a **unpriviledged** user account - git clone https://github.com/frrouting/frr.git frr + git clone https://github.com/frrouting/frr.git frr 3. Run Bootstrap and make distribution tar.gz - cd frr - ./bootstrap.sh - ./configure --with-pkg-extra-version=-MyRPMVersion - make dist - - Note: configure parameters are not important for the RPM building - except the - `with-pkg-extra-version` if you want to give the RPM a specific name to - mark your own unoffical build + cd frr + ./bootstrap.sh + ./configure --with-pkg-extra-version=-MyRPMVersion + make dist + + Note: configure parameters are not important for the RPM building - except the `with-pkg-extra-version` if you want to give the RPM a specific name to + mark your own unoffical build 4. Create RPM directory structure and populate with sources - mkdir rpmbuild - mkdir rpmbuild/SOURCES - mkdir rpmbuild/SPECS - cp redhat/*.spec rpmbuild/SPECS/ - cp frr*.tar.gz rpmbuild/SOURCES/ + mkdir rpmbuild + mkdir rpmbuild/SOURCES + mkdir rpmbuild/SPECS + cp redhat/*.spec rpmbuild/SPECS/ + cp frr*.tar.gz rpmbuild/SOURCES/ 5. Edit rpm/SPECS/frr.spec with configuration as needed - Look at the beginning of the file and adjust the following parameters to enable - or disable features as required: - - ################# frr configure options #################### - # with-feature options + Look at the beginning of the file and adjust the following parameters to enable or disable features as required: + + ################# frr configure options #################### + # with-feature options %{!?with_snmp: %global with_snmp 1 } %{!?with_vtysh: %global with_vtysh 1 } %{!?with_ospf_te: %global with_ospf_te 1 } - %{!?with_opaque_lsa: %global with_opaque_lsa 1 } - %{!?with_tcp_zebra: %global with_tcp_zebra 0 } - %{!?with_vtysh: %global with_vtysh 1 } - %{!?with_pam: %global with_pam 1 } + %{!?with_opaque_lsa: %global with_opaque_lsa 1 } + %{!?with_tcp_zebra: %global with_tcp_zebra 0 } + %{!?with_vtysh: %global with_vtysh 1 } + %{!?with_pam: %global with_pam 1 } %{!?with_ospfclient: %global with_ospfclient 1 } - %{!?with_ospfapi: %global with_ospfapi 1 } - %{!?with_irdp: %global with_irdp 1 } - %{!?with_rtadv: %global with_rtadv 1 } - %{!?with_isisd: %global with_isisd 1 } - %{!?with_pimd: %global with_pimd 1 } - %{!?with_mpls: %global with_mpls 0 } - %{!?with_ldpd: %global with_ldpd 0 } - %{!?with_shared: %global with_shared 1 } - %{!?with_multipath: %global with_multipath 64 } - %{!?frr_user: %global frr_user frr } - %{!?vty_group: %global vty_group frrvt } - %{!?with_fpm: %global with_fpm 0 } - %{!?with_watchfrr: %global with_watchfrr 1 } + %{!?with_ospfapi: %global with_ospfapi 1 } + %{!?with_irdp: %global with_irdp 1 } + %{!?with_rtadv: %global with_rtadv 1 } + %{!?with_isisd: %global with_isisd 1 } + %{!?with_pimd: %global with_pimd 1 } + %{!?with_mpls: %global with_mpls 0 } + %{!?with_ldpd: %global with_ldpd 0 } + %{!?with_shared: %global with_shared 1 } + %{!?with_multipath: %global with_multipath 64 } + %{!?frr_user: %global frr_user frr } + %{!?vty_group: %global vty_group frrvt } + %{!?with_fpm: %global with_fpm 0 } + %{!?with_watchfrr: %global with_watchfrr 1 } 6. Build the RPM - rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/frr.spec + rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/frr.spec DONE. -If all works correctly, then you should end up with the RPMs under `rpmbuild/RPMS` -and the Source RPM under `rpmbuild/SRPMS` +If all works correctly, then you should end up with the RPMs under +`rpmbuild/RPMS` and the Source RPM under `rpmbuild/SRPMS` Enabling daemons after installation of the package: @@ -77,54 +75,54 @@ Enabling daemons after installation of the package: ### init.d based systems (ie CentOS 6): 1. Enable the daemons as needed to run after boot (Zebra is mandatory) - - chkconfig zebra on - chkconfig ospfd on - chkconfig ospf6d on - chkconfig bgpd on - ... etc + + chkconfig zebra on + chkconfig ospfd on + chkconfig ospf6d on + chkconfig bgpd on + ... etc 2. If you want to run `watchfrr`, then configure `/etc/sysconfig/frr` and uncomment the line with the daemons for `watchfrr` to monitor, then enable watchfrr - chkconfig watchfrr on + chkconfig watchfrr on 3. Check your firewall / IPtables to make sure the routing protocols are allowed. - + 4. Start the daemons (or reboot) - service zebra start - service bgpd start - service ospfd start - ... etc - + service zebra start + service bgpd start + service ospfd start + ... etc + Configuration is stored in `/etc/frr/*.conf` files. ### systemd based systems (ie CentOS 7, Fedora 22) 1. Enable the daemons as needed to run after boot (Zebra is mandatory) - - systemctl enable zebra - systemctl enable ospfd - systemctl enable ospf6d - systemctl enable bgpd - ... etc + + systemctl enable zebra + systemctl enable ospfd + systemctl enable ospf6d + systemctl enable bgpd + ... etc - Note: There is no watchfrr on systemd based systems. Systemd contains - the functionality of monitoring and restarting daemons. + Note: There is no watchfrr on systemd based systems. Systemd contains + the functionality of monitoring and restarting daemons. 2. Check your firewall / IPtables to make sure the routing protocols are allowed. - + 3. Start the daemons (or reboot) - systemctl start zebra - systemctl start bgpd - systemctl start ospfd - ... etc - + systemctl start zebra + systemctl start bgpd + systemctl start ospfd + ... etc + Configuration is stored in `/etc/frr/*.conf` files. From 192c13ac27d397d6e4169bb0e33bdafbb192257c Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 12 Apr 2017 19:10:35 -0700 Subject: [PATCH 02/25] redhat: Remove tab's with spaces in frr.spec.in to make it better readable Signed-off-by: Martin Winter --- redhat/frr.spec.in | 452 ++++++++++++++++++++++----------------------- 1 file changed, 226 insertions(+), 226 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index c32e3e3af8..a6f8caa9d2 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -10,34 +10,34 @@ ####################### FRRouting (FRR) configure options ######################### # with-feature options -%{!?with_tcp_zebra: %global with_tcp_zebra 0 } -%{!?with_pam: %global with_pam 0 } -%{!?with_ospfclient: %global with_ospfclient 1 } -%{!?with_ospfapi: %global with_ospfapi 1 } -%{!?with_irdp: %global with_irdp 1 } -%{!?with_rtadv: %global with_rtadv 1 } -%{!?with_mpls: %global with_mpls 0 } -%{!?with_ldpd: %global with_ldpd 0 } -%{!?with_nhrpd: %global with_nhrpd 1 } -%{!?with_shared: %global with_shared 1 } -%{!?with_multipath: %global with_multipath 256 } -%{!?frr_user: %global frr_user frr } -%{!?vty_group: %global vty_group frrvty } -%{!?with_fpm: %global with_fpm 0 } -%{!?with_watchfrr: %global with_watchfrr 1 } -%{!?with_bgp_vnc: %global with_bgp_vnc 0 } +%{!?with_tcp_zebra: %global with_tcp_zebra 0 } +%{!?with_pam: %global with_pam 0 } +%{!?with_ospfclient: %global with_ospfclient 1 } +%{!?with_ospfapi: %global with_ospfapi 1 } +%{!?with_irdp: %global with_irdp 1 } +%{!?with_rtadv: %global with_rtadv 1 } +%{!?with_mpls: %global with_mpls 0 } +%{!?with_ldpd: %global with_ldpd 0 } +%{!?with_nhrpd: %global with_nhrpd 1 } +%{!?with_shared: %global with_shared 1 } +%{!?with_multipath: %global with_multipath 256 } +%{!?frr_user: %global frr_user frr } +%{!?vty_group: %global vty_group frrvty } +%{!?with_fpm: %global with_fpm 0 } +%{!?with_watchfrr: %global with_watchfrr 1 } +%{!?with_bgp_vnc: %global with_bgp_vnc 0 } # path defines -%define _sysconfdir /etc/frr -%define _sbindir /usr/lib/frr -%define zeb_src %{_builddir}/%{name}-%{frrversion} -%define zeb_rh_src %{zeb_src}/redhat -%define zeb_docs %{zeb_src}/doc -%define frr_tools %{zeb_src}/tools -%define cumulus_dir %{zeb_src}/cumulus/etc +%define _sysconfdir /etc/frr +%define _sbindir /usr/lib/frr +%define zeb_src %{_builddir}/%{name}-%{frrversion} +%define zeb_rh_src %{zeb_src}/redhat +%define zeb_docs %{zeb_src}/doc +%define frr_tools %{zeb_src}/tools +%define cumulus_dir %{zeb_src}/cumulus/etc # defines for configure -%define _localstatedir /var/run/frr +%define _localstatedir /var/run/frr ############################################################################ #### Version String tweak @@ -56,29 +56,29 @@ # If init system is systemd, then always disable watchfrr # %if "%{initsystem}" == "systemd" - # Note: For systems with systemd, watchfrr will NOT be built. Systemd - # takes over the role of restarting crashed processes. Value will - # be overwritten with 0 below for systemd independent on the setting here - %global with_watchfrr 1 + # Note: For systems with systemd, watchfrr will NOT be built. Systemd + # takes over the role of restarting crashed processes. Value will + # be overwritten with 0 below for systemd independent on the setting here + %global with_watchfrr 1 %endif # if FPM is enabled, then enable tcp_zebra as well # %if %{with_fpm} - %global with_tcp_zebra 1 + %global with_tcp_zebra 1 %endif # misc internal defines -%{!?frr_uid: %global frr_uid 92 } -%{!?frr_gid: %global frr_gid 92 } -%{!?vty_gid: %global vty_gid 85 } +%{!?frr_uid: %global frr_uid 92 } +%{!?frr_gid: %global frr_gid 92 } +%{!?vty_gid: %global vty_gid 85 } -%define daemon_list zebra ripd ospfd bgpd isisd pimd ripngd ospf6d +%define daemon_list zebra ripd ospfd bgpd isisd pimd ripngd ospfd6d %if %{with_ldpd} -%define daemon_ldpd ldpd +%define daemon_ldpd ldpd %else -%define daemon_ldpd "" +%define daemon_ldpd "" %endif %if %{with_nhrpd} @@ -88,51 +88,51 @@ %endif %if %{with_watchfrr} -%define daemon_watchfrr watchfrr +%define daemon_watchfrr watchfrr %else -%define daemon_watchfrr "" +%define daemon_watchfrr "" %endif -%define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_nhrpd} %{daemon_watchfrr} +%define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_nhrpd} %{daemon_watchfrr} # allow build dir to be kept -%{!?keep_build: %global keep_build 0 } +%{!?keep_build: %global keep_build 0 } #release sub-revision (the two digits after the CONFDATE) -%{!?release_rev: %global release_rev 01 } +%{!?release_rev: %global release_rev 01 } Summary: Routing daemon -Name: frr -Version: %{rpmversion} -Release: @CONFDATE@%{release_rev}%{?dist} -License: GPLv2+ -Group: System Environment/Daemons -Source0: http://www.frrouting.org/releases/frr/%{name}-%{frrversion}.tar.gz -URL: http://www.frrouting.org -Requires: ncurses json-c -Requires(pre): /sbin/install-info +Name: frr +Version: %{rpmversion} +Release: @CONFDATE@%{release_rev}%{?dist} +License: GPLv2+ +Group: System Environment/Daemons +Source0: http://www.frrouting.org/releases/frr/%{name}-%{frrversion}.tar.gz +URL: http://www.frrouting.org +Requires: ncurses json-c +Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info -Requires(post): /sbin/install-info -BuildRequires: texi2html texinfo autoconf patch libcap-devel groff -BuildRequires: readline readline-devel ncurses ncurses-devel -BuildRequires: json-c-devel bison flex -Requires: ncurses initscripts +Requires(post): /sbin/install-info +BuildRequires: texi2html texinfo autoconf patch libcap-devel groff +BuildRequires: readline readline-devel ncurses ncurses-devel +BuildRequires: json-c-devel bison flex +Requires: ncurses initscripts %if %{with_pam} -BuildRequires: pam-devel -Requires: pam +BuildRequires: pam-devel +Requires: pam %endif %if "%{initsystem}" == "systemd" -BuildRequires: systemd -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %else # Initscripts > 5.60 is required for IPv6 support -Requires(pre): initscripts >= 5.60 +Requires(pre): initscripts >= 5.60 %endif -Provides: routingdaemon = %{version}-%{release} -BuildRoot: %{_tmppath}/%{name}-%{version}-root -Obsoletes: bird gated mrt zebra frr-sysvinit +Provides: routingdaemon = %{version}-%{release} +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Obsoletes: bird gated mrt zebra frr-sysvinit %description FRRouting is a free software that manages TCP/IP based routing @@ -181,46 +181,46 @@ developing OSPF-API and frr applications. --libdir=%{_libdir} \ --libexecdir=%{_libexecdir} \ --localstatedir=%{_localstatedir} \ - --disable-werror \ + --disable-werror \ %if !%{with_shared} - --disable-shared \ + --disable-shared \ %endif %if %{with_multipath} - --enable-multipath=%{with_multipath} \ + --enable-multipath=%{with_multipath} \ %endif %if %{with_tcp_zebra} - --enable-tcp-zebra \ + --enable-tcp-zebra \ %endif - --enable-vtysh \ + --enable-vtysh \ %if %{with_ospfclient} - --enable-ospfclient=yes \ + --enable-ospfclient=yes \ %else - --enable-ospfclient=no\ + --enable-ospfclient=no\ %endif %if %{with_ospfapi} - --enable-ospfapi=yes \ + --enable-ospfapi=yes \ %else - --enable-ospfapi=no \ + --enable-ospfapi=no \ %endif %if %{with_irdp} - --enable-irdp=yes \ + --enable-irdp=yes \ %else - --enable-irdp=no \ + --enable-irdp=no \ %endif %if %{with_rtadv} - --enable-rtadv=yes \ + --enable-rtadv=yes \ %else - --enable-rtadv=no \ + --enable-rtadv=no \ %endif %if %{with_mpls} - --enable-mpls=yes \ + --enable-mpls=yes \ %else - --disable-mpls \ + --disable-mpls \ %endif %if %{with_ldpd} - --enable-ldpd \ + --enable-ldpd \ %else - --disable-ldpd \ + --disable-ldpd \ %endif %if %{with_nhrpd} --enable-nhrpd \ @@ -228,34 +228,34 @@ developing OSPF-API and frr applications. --disable-nhrpd \ %endif %if %{with_pam} - --with-libpam \ + --with-libpam \ %endif %if 0%{?frr_user:1} - --enable-user=%frr_user \ - --enable-group=%frr_user \ + --enable-user=%frr_user \ + --enable-group=%frr_user \ %endif %if 0%{?vty_group:1} - --enable-vty-group=%vty_group \ + --enable-vty-group=%vty_group \ %endif %if %{with_fpm} - --enable-fpm \ + --enable-fpm \ %else - --disable-fpm \ + --disable-fpm \ %endif %if %{with_watchfrr} - --enable-watchfrr \ + --enable-watchfrr \ %else - --disable-watchfrr \ + --disable-watchfrr \ %endif %if %{with_bgp_vnc} - --enable-bgp-vnc \ + --enable-bgp-vnc \ %else - --disable-bgp-vnc \ + --disable-bgp-vnc \ %endif - --enable-gcc-rdynamic \ - --enable-isisd=yes \ - --enable-systemd=yes \ - --enable-poll=yes + --enable-gcc-rdynamic \ + --enable-isisd=yes \ + --enable-systemd=yes \ + --enable-poll=yes make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" @@ -280,14 +280,14 @@ rm -rf %{buildroot}/usr/share/info/dir %if "%{initsystem}" == "systemd" mkdir -p %{buildroot}%{_unitdir} install %{frr_tools}/frr.service \ - %{buildroot}%{_unitdir}/frr.service + %{buildroot}%{_unitdir}/frr.service %else mkdir -p %{buildroot}/etc/rc.d/init.d for daemon in %{all_daemons} ; do - if [ x"${daemon}" != x"" ] ; then - install %{zeb_rh_src}/${daemon}.init \ - %{buildroot}/etc/rc.d/init.d/${daemon} - fi + if [ x"${daemon}" != x"" ] ; then + install %{zeb_rh_src}/${daemon}.init \ + %{buildroot}/etc/rc.d/init.d/${daemon} + fi done %endif @@ -295,9 +295,9 @@ install %{cumulus_dir}/frr/debian.conf %{buildroot}/etc/frr install %{cumulus_dir}/frr/daemons %{buildroot}/etc/frr install -m644 %{cumulus_dir}/default/frr %{buildroot}/etc/default install -m644 %{zeb_rh_src}/frr.pam \ - %{buildroot}/etc/pam.d/frr + %{buildroot}/etc/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate \ - %{buildroot}/etc/logrotate.d/frr + %{buildroot}/etc/logrotate.d/frr install -d -m750 %{buildroot}/var/run/frr %pre @@ -330,11 +330,11 @@ fi zebra_spec_add_service () { - # Add port /etc/services entry if it isn't already there - if [ -f /etc/services ] && \ - ! %__sed -e 's/#.*$//' /etc/services | %__grep -wq $1 ; then - echo "$1 $2 # $3" >> /etc/services - fi + # Add port /etc/services entry if it isn't already there + if [ -f /etc/services ] && \ + ! %__sed -e 's/#.*$//' /etc/services | %__grep -wq $1 ; then + echo "$1 $2 # $3" >> /etc/services + fi } zebra_spec_add_service zebrasrv 2600/tcp "zebra service" @@ -358,11 +358,11 @@ zebra_spec_add_service ldpd 2612/tcp "LDPd vty" %if "%{initsystem}" == "systemd" for daemon in %all_daemons ; do - %systemd_post frr.service + %systemd_post frr.service done %else for daemon in %all_daemons ; do - /sbin/chkconfig --add ${daemon} + /sbin/chkconfig --add ${daemon} done %endif @@ -370,28 +370,28 @@ done # Create dummy files if they don't exist so basic functions can be used. if [ ! -e %{_sysconfdir}/zebra.conf ]; then - echo "hostname `hostname`" > %{_sysconfdir}/zebra.conf + echo "hostname `hostname`" > %{_sysconfdir}/zebra.conf %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/zebra.conf* + chown %frr_user:%frr_user %{_sysconfdir}/zebra.conf* %endif - chmod 640 %{_sysconfdir}/zebra.conf + chmod 640 %{_sysconfdir}/zebra.conf fi for daemon in %{all_daemons} ; do - if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then - touch %{_sysconfdir}/${daemon}.conf - %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* - %endif - fi + if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then + touch %{_sysconfdir}/${daemon}.conf + %if 0%{?frr_user:1} + chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* + %endif + fi done %if %{with_watchfrr} - # No config for watchfrr - this is part of /etc/sysconfig/frr - rm -f %{_sysconfdir}/watchfrr.* + # No config for watchfrr - this is part of /etc/sysconfig/frr + rm -f %{_sysconfdir}/watchfrr.* %endif if [ ! -e %{_sysconfdir}/vtysh.conf ]; then - touch %{_sysconfdir}/vtysh.conf - chmod 640 %{_sysconfdir}/vtysh.conf + touch %{_sysconfdir}/vtysh.conf + chmod 640 %{_sysconfdir}/vtysh.conf %if 0%{?vty_group:1} chown frr:%{vty_group} %{_sysconfdir}/vtysh.conf* %endif @@ -399,96 +399,96 @@ fi %postun if [ "$1" -ge 1 ]; then - # Find out which daemons need to be restarted. - for daemon in %all_daemons ; do - if [ -f /var/lock/subsys/${daemon} ]; then - eval restart_${daemon}=yes - else - eval restart_${daemon}=no - fi - done - # Rename restart flags for daemons handled specially. - running_zebra="$restart_zebra" - restart_zebra=no - %if %{with_watchfrr} - running_watchfrr="$restart_watchfrr" - restart_watchfrr=no - %endif - - %if "%{initsystem}" == "systemd" - ## - ## Systemd Version - ## - # No watchfrr for systemd version - # - # Stop all daemons other than zebra. - for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_postun ${daemon}.service - done - # Restart zebra. - [ "$running_zebra" = yes ] && \ - %systemd_postun_with_restart $daemon.service - # Start all daemons other than zebra. - for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_post ${daemon}.service - done - %else - ## - ## init.d Version - ## - %if %{with_watchfrr} - # Stop watchfrr first. - [ "$running_watchfrr" = yes ] && \ - /etc/rc.d/init.d/watchfrr stop >/dev/null 2>&1 - %endif - # Stop all daemons other than zebra and watchfrr. - for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 - done - # Restart zebra. - [ "$running_zebra" = yes ] && \ - /etc/rc.d/init.d/zebra restart >/dev/null 2>&1 - # Start all daemons other than zebra and watchfrr. - for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 - done - %if %{with_watchfrr} - # Start watchfrr last. - # Avoid postun scriptlet error if watchfrr is not running. - [ "$running_watchfrr" = yes ] && \ - /etc/rc.d/init.d/watchfrr start >/dev/null 2>&1 || : - %endif - %endif + # Find out which daemons need to be restarted. + for daemon in %all_daemons ; do + if [ -f /var/lock/subsys/${daemon} ]; then + eval restart_${daemon}=yes + else + eval restart_${daemon}=no + fi + done + # Rename restart flags for daemons handled specially. + running_zebra="$restart_zebra" + restart_zebra=no + %if %{with_watchfrr} + running_watchfrr="$restart_watchfrr" + restart_watchfrr=no + %endif + + %if "%{initsystem}" == "systemd" + ## + ## Systemd Version + ## + # No watchfrr for systemd version + # + # Stop all daemons other than zebra. + for daemon in %all_daemons ; do + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + %systemd_postun ${daemon}.service + done + # Restart zebra. + [ "$running_zebra" = yes ] && \ + %systemd_postun_with_restart $daemon.service + # Start all daemons other than zebra. + for daemon in %all_daemons ; do + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + %systemd_post ${daemon}.service + done + %else + ## + ## init.d Version + ## + %if %{with_watchfrr} + # Stop watchfrr first. + [ "$running_watchfrr" = yes ] && \ + /etc/rc.d/init.d/watchfrr stop >/dev/null 2>&1 + %endif + # Stop all daemons other than zebra and watchfrr. + for daemon in %all_daemons ; do + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + done + # Restart zebra. + [ "$running_zebra" = yes ] && \ + /etc/rc.d/init.d/zebra restart >/dev/null 2>&1 + # Start all daemons other than zebra and watchfrr. + for daemon in %all_daemons ; do + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 + done + %if %{with_watchfrr} + # Start watchfrr last. + # Avoid postun scriptlet error if watchfrr is not running. + [ "$running_watchfrr" = yes ] && \ + /etc/rc.d/init.d/watchfrr start >/dev/null 2>&1 || : + %endif + %endif fi %preun %if "%{initsystem}" == "systemd" - ## - ## Systemd Version - ## - if [ "$1" = "0" ]; then - for daemon in %all_daemons ; do - %systemd_preun ${daemon}.service - done - fi + ## + ## Systemd Version + ## + if [ "$1" = "0" ]; then + for daemon in %all_daemons ; do + %systemd_preun ${daemon}.service + done + fi %else - ## - ## init.d Version - ## - if [ "$1" = "0" ]; then - for daemon in %all_daemons ; do - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 - /sbin/chkconfig --del ${daemon} - done - fi + ## + ## init.d Version + ## + if [ "$1" = "0" ]; then + for daemon in %all_daemons ; do + /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + /sbin/chkconfig --del ${daemon} + done + fi %endif /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir @@ -527,7 +527,7 @@ rm -rf %{buildroot} %{_sbindir}/frr-reload.pyc %{_sbindir}/frr-reload.pyo %if %{with_watchfrr} - %{_sbindir}/watchfrr + %{_sbindir}/watchfrr %endif %{_sbindir}/ripngd %{_sbindir}/ospf6d @@ -546,25 +546,25 @@ rm -rf %{buildroot} %{_bindir}/* %config /etc/frr/[!v]* %if "%{initsystem}" == "systemd" - %config %{_unitdir}/frr.service + %config %{_unitdir}/frr.service %else - %config /etc/rc.d/init.d/zebra - %if %{with_watchfrr} - %config /etc/rc.d/init.d/watchfrr - %endif - %config /etc/rc.d/init.d/ripd - %config /etc/rc.d/init.d/ospfd - %config /etc/rc.d/init.d/bgpd - %config /etc/rc.d/init.d/ripngd - %config /etc/rc.d/init.d/ospf6d - %config /etc/rc.d/init.d/isisd - %config /etc/rc.d/init.d/pimd - %if %{with_ldpd} - %config /etc/rc.d/init.d/ldpd - %endif - %if %{with_nhrpd} - %config /etc/rc.d/init.d/nhrpd - %endif + %config /etc/rc.d/init.d/zebra + %if %{with_watchfrr} + %config /etc/rc.d/init.d/watchfrr + %endif + %config /etc/rc.d/init.d/ripd + %config /etc/rc.d/init.d/ospfd + %config /etc/rc.d/init.d/bgpd + %config /etc/rc.d/init.d/ripngd + %config /etc/rc.d/init.d/ospf6d + %config /etc/rc.d/init.d/isisd + %config /etc/rc.d/init.d/pimd + %if %{with_ldpd} + %config /etc/rc.d/init.d/ldpd + %endif + %if %{with_nhrpd} + %config /etc/rc.d/init.d/nhrpd + %endif %endif %config(noreplace) /etc/default/frr %config(noreplace) /etc/pam.d/frr From d75d3b874e776043772d0eee8d550181379b0739 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 12 Apr 2017 20:23:18 -0700 Subject: [PATCH 03/25] redhat: Fix dependencies for rpm package - Add bison, flex & autoconf - Remove systemd for systems without it (i.e. CentOS 6) - Update doc to reflect dependencies Signed-off-by: Martin Winter --- redhat/README.rpm_build.md | 12 ++++++++++-- redhat/frr.spec.in | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index d3fd271c62..fa1d56e0ef 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -6,10 +6,18 @@ Building your own FRRouting RPM yum install git autoconf automake libtool make gawk readline-devel \ texinfo dejagnu net-snmp-devel groff rpm-build net-snmp-devel \ - libcap-devel texi2html + libcap-devel texi2html bison flex + + Additionally, on systems with systemd (CentOS 7, Fedora) + + yum install systemd-devel (use `dnf install` on new Fedora instead of `yum install`) - + + **CentOS 6:** Please check doc/Building_FRR_on_CentOS6.md for details on + how to install required version of autoconf, automake and bison. The + versions in the common Repo are too old. + 2. Checkout FRR under a **unpriviledged** user account git clone https://github.com/frrouting/frr.git frr diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a6f8caa9d2..d34113f13d 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -113,16 +113,16 @@ Requires: ncurses json-c Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info Requires(post): /sbin/install-info -BuildRequires: texi2html texinfo autoconf patch libcap-devel groff +BuildRequires: texi2html texinfo autoconf automake patch libcap-devel groff BuildRequires: readline readline-devel ncurses ncurses-devel -BuildRequires: json-c-devel bison flex +BuildRequires: json-c-devel bison >= 2.7 flex Requires: ncurses initscripts %if %{with_pam} BuildRequires: pam-devel Requires: pam %endif %if "%{initsystem}" == "systemd" -BuildRequires: systemd +BuildRequires: systemd systemd-devel Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -254,7 +254,9 @@ developing OSPF-API and frr applications. %endif --enable-gcc-rdynamic \ --enable-isisd=yes \ +%if "%{initsystem}" == "systemd" --enable-systemd=yes \ +%endif --enable-poll=yes make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" From 7f08aaecdf3c1d75d38373c89e8232dc240dfae5 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 13 Apr 2017 15:00:16 -0700 Subject: [PATCH 04/25] redhat: Fix ospf6d typo in frr.spec.in Signed-off-by: Martin Winter --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index d34113f13d..d110bf9fff 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -73,7 +73,7 @@ %{!?frr_gid: %global frr_gid 92 } %{!?vty_gid: %global vty_gid 85 } -%define daemon_list zebra ripd ospfd bgpd isisd pimd ripngd ospfd6d +%define daemon_list zebra ripd ospfd bgpd isisd pimd ripngd ospf6d %if %{with_ldpd} %define daemon_ldpd ldpd From 167a5efe3c1f330f2b35e1827b8f219dd70e0112 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 13 Apr 2017 17:33:24 -0700 Subject: [PATCH 05/25] redhat: Don't set file attributes for symlinks Signed-off-by: Martin Winter --- redhat/frr.spec.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index d110bf9fff..6a3c75aacb 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -542,8 +542,9 @@ rm -rf %{buildroot} %{_sbindir}/nhrpd %endif %if %{with_shared} -%attr(755,root,root) %{_libdir}/lib*.so -%attr(755,root,root) %{_libdir}/lib*.so.* +%{_libdir}/lib*.so +%{_libdir}/lib*.so.0 +%attr(755,root,root) %{_libdir}/lib*.so.0.* %endif %{_bindir}/* %config /etc/frr/[!v]* From 52134ac67cbb73a7eeb35d86c3b305d1d3049c7b Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 13 Apr 2017 17:34:26 -0700 Subject: [PATCH 06/25] redhat: Move frr-reload python script to it's own sub package to avoid the python2 requirement for main frr package Signed-off-by: Martin Winter --- redhat/frr.spec.in | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 6a3c75aacb..4d213fbb8e 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -151,6 +151,14 @@ Group: System Environment/Daemons %description contrib Contributed/3rd party tools which may be of use with frr. +%package pythontools +Summary: python tools for frr +Requires: python >= 2.7 python-ipaddr +Group: System Environment/Daemons + +%description pythontools +Contributed python 2.7 tools which may be of use with frr. + %package devel Summary: Header and object files for frr development Group: System Environment/Daemons @@ -525,9 +533,6 @@ rm -rf %{buildroot} %{_sbindir}/bgpd %{_sbindir}/ssd %{_sbindir}/frr -%{_sbindir}/frr-reload.py -%{_sbindir}/frr-reload.pyc -%{_sbindir}/frr-reload.pyo %if %{with_watchfrr} %{_sbindir}/watchfrr %endif @@ -577,6 +582,12 @@ rm -rf %{buildroot} %defattr(-,root,root) %doc tools +%files pythontools +%defattr(-,root,root) +%{_sbindir}/frr-reload.py +%{_sbindir}/frr-reload.pyc +%{_sbindir}/frr-reload.pyo + %files devel %defattr(-,root,root) %if %{with_ospfclient} From 63ef966e657468478593ce4ed873f135bd89135a Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 13 Apr 2017 18:54:58 -0700 Subject: [PATCH 07/25] redhat: Always disable PIMd on CentOS 6 and RedHat 6 systems as they are too old to correctly support the protocol Signed-off-by: Martin Winter --- redhat/frr.spec.in | 51 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 4d213fbb8e..32f6b74f7b 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -26,6 +26,7 @@ %{!?with_fpm: %global with_fpm 0 } %{!?with_watchfrr: %global with_watchfrr 1 } %{!?with_bgp_vnc: %global with_bgp_vnc 0 } +%{!?with_pimd: %global with_pimd 1 } # path defines %define _sysconfdir /etc/frr @@ -62,7 +63,16 @@ %global with_watchfrr 1 %endif -# if FPM is enabled, then enable tcp_zebra as well +#### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM. +#### Always disable it on these old systems unconditionally +%{expand: %%global redhat6 %(if [[ `cat /etc/redhat-release 2> /dev/null` =~ release\ 6\. ]]; then echo 6; fi)} +# +# if CentOS 6 / RedHat 6, then disable PIMd +%if "%{redhat6}" == "6" + %global with_pimd 0 +%endif + +# if FPM is enabled, then enable tcp_zebra as well # %if %{with_fpm} %global with_tcp_zebra 1 @@ -73,7 +83,7 @@ %{!?frr_gid: %global frr_gid 92 } %{!?vty_gid: %global vty_gid 85 } -%define daemon_list zebra ripd ospfd bgpd isisd pimd ripngd ospf6d +%define daemon_list zebra ripd ospfd bgpd isisd ripngd ospf6d %if %{with_ldpd} %define daemon_ldpd ldpd @@ -82,9 +92,15 @@ %endif %if %{with_nhrpd} -%define daemon_nhrpd nhrpd +%define daemon_nhrpd nhrpd %else -%define daemon_nhrpd "" +%define daemon_nhrpd "" +%endif + +%if %{with_pimd} +%define daemon_pimd pimd +%else +%define daemon_pimd "" %endif %if %{with_watchfrr} @@ -93,7 +109,7 @@ %define daemon_watchfrr "" %endif -%define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_nhrpd} %{daemon_watchfrr} +%define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_nhrpd} %{daemon_pimd} %{daemon_watchfrr} # allow build dir to be kept %{!?keep_build: %global keep_build 0 } @@ -231,9 +247,14 @@ developing OSPF-API and frr applications. --disable-ldpd \ %endif %if %{with_nhrpd} - --enable-nhrpd \ + --enable-nhrpd \ %else - --disable-nhrpd \ + --disable-nhrpd \ +%endif +%if %{with_pimd} + --enable-pimd \ +%else + --disable-pimd \ %endif %if %{with_pam} --with-libpam \ @@ -361,7 +382,9 @@ zebra_spec_add_service isisd 2608/tcp "ISISd vty" %if %{with_nhrpd} zebra_spec_add_service nhrpd 2610/tcp "NHRPd vty" %endif +%if %{with_pimd} zebra_spec_add_service pimd 2611/tcp "PIMd vty" +%endif %if %{with_ldpd} zebra_spec_add_service ldpd 2612/tcp "LDPd vty" %endif @@ -538,7 +561,9 @@ rm -rf %{buildroot} %endif %{_sbindir}/ripngd %{_sbindir}/ospf6d -%{_sbindir}/pimd +%if %{with_pimd} + %{_sbindir}/pimd +%endif %{_sbindir}/isisd %if %{with_ldpd} %{_sbindir}/ldpd @@ -566,7 +591,9 @@ rm -rf %{buildroot} %config /etc/rc.d/init.d/ripngd %config /etc/rc.d/init.d/ospf6d %config /etc/rc.d/init.d/isisd - %config /etc/rc.d/init.d/pimd + %if %{with_pimd} + %config /etc/rc.d/init.d/pimd + %endif %if %{with_ldpd} %config /etc/rc.d/init.d/ldpd %endif @@ -609,6 +636,12 @@ rm -rf %{buildroot} - add nhrpd * Fri Jan 6 2017 Martin Winter - %{version} +* Thu Apr 13 2017 Martin Winter - %{version} +- new subpackage frr-pythontools with python 2.7 restart script +- remove PIMd from CentOS/RedHat 6 RPM packages (won't work - too old) +- Various other RPM package fixes for FRR 2.0 + +* Fri Jan 6 2017 Martin Winter - Renamed to frr for FRRouting fork of Quagga * Thu Feb 11 2016 Paul Jakma From da69cb8e75f4c543b0cfca089a2ef766faaaa0c5 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 14 Apr 2017 01:28:13 -0700 Subject: [PATCH 08/25] redhat: Fix install (daemon selection) and make postun scripts compatible with fedora Signed-off-by: Martin Winter --- redhat/frr.spec.in | 70 +++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 32f6b74f7b..8ecb63ec94 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -395,7 +395,9 @@ for daemon in %all_daemons ; do done %else for daemon in %all_daemons ; do - /sbin/chkconfig --add ${daemon} + if [ x"${daemon}" != x"" ] ; then + /sbin/chkconfig --add ${daemon} + fi done %endif @@ -410,11 +412,13 @@ if [ ! -e %{_sysconfdir}/zebra.conf ]; then chmod 640 %{_sysconfdir}/zebra.conf fi for daemon in %{all_daemons} ; do - if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then - touch %{_sysconfdir}/${daemon}.conf - %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* - %endif + if [ x"${daemon}" != x"" ] ; then + if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then + touch %{_sysconfdir}/${daemon}.conf + %if 0%{?frr_user:1} + chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* + %endif + fi fi done %if %{with_watchfrr} @@ -434,10 +438,12 @@ fi if [ "$1" -ge 1 ]; then # Find out which daemons need to be restarted. for daemon in %all_daemons ; do - if [ -f /var/lock/subsys/${daemon} ]; then - eval restart_${daemon}=yes - else - eval restart_${daemon}=no + if [ x"${daemon}" != x"" ] ; then + if [ -f /var/lock/subsys/${daemon} ]; then + eval restart_${daemon}=yes + else + eval restart_${daemon}=no + fi fi done # Rename restart flags for daemons handled specially. @@ -456,18 +462,24 @@ if [ "$1" -ge 1 ]; then # # Stop all daemons other than zebra. for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_postun ${daemon}.service + if [ x"${daemon}" != x"" ] ; then + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + %systemd_postun ${daemon}.service + : + fi done # Restart zebra. [ "$running_zebra" = yes ] && \ %systemd_postun_with_restart $daemon.service # Start all daemons other than zebra. for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_post ${daemon}.service + if [ x"${daemon}" != x"" ] ; then + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + %systemd_post ${daemon}.service + : + fi done %else ## @@ -480,18 +492,22 @@ if [ "$1" -ge 1 ]; then %endif # Stop all daemons other than zebra and watchfrr. for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + if [ x"${daemon}" != x"" ] ; then + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + fi done # Restart zebra. [ "$running_zebra" = yes ] && \ /etc/rc.d/init.d/zebra restart >/dev/null 2>&1 # Start all daemons other than zebra and watchfrr. for daemon in %all_daemons ; do - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 + if [ x"${daemon}" != x"" ] ; then + eval restart=\$restart_${daemon} + [ "$restart" = yes ] && \ + /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 + fi done %if %{with_watchfrr} # Start watchfrr last. @@ -509,7 +525,9 @@ fi ## if [ "$1" = "0" ]; then for daemon in %all_daemons ; do - %systemd_preun ${daemon}.service + if [ x"${daemon}" != x"" ] ; then + %systemd_preun ${daemon}.service + fi done fi %else @@ -518,8 +536,10 @@ fi ## if [ "$1" = "0" ]; then for daemon in %all_daemons ; do - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 - /sbin/chkconfig --del ${daemon} + if [ x"${daemon}" != x"" ] ; then + /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + /sbin/chkconfig --del ${daemon} + fi done fi %endif From 414ec6e96e2dc2a76cbb5baa1772c35c544ce07e Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 14 Apr 2017 02:20:31 -0700 Subject: [PATCH 09/25] redhat: Fix previously added centos6/redhat6 check Signed-off-by: Martin Winter --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 8ecb63ec94..1ebb7c16ca 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -65,7 +65,7 @@ #### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM. #### Always disable it on these old systems unconditionally -%{expand: %%global redhat6 %(if [[ `cat /etc/redhat-release 2> /dev/null` =~ release\ 6\. ]]; then echo 6; fi)} +%{expand: %%global redhat6 %(if [[ `cat /etc/redhat-release 2> /dev/null` =~ release\ 6\. ]]; then echo 6; else echo 0; fi)} # # if CentOS 6 / RedHat 6, then disable PIMd %if "%{redhat6}" == "6" From 6e580dc20209270bf7365fa99d66262f94dc23a8 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 14 Apr 2017 02:21:44 -0700 Subject: [PATCH 10/25] redhat: Add python2 build requirement to pythontools sub package Signed-off-by: Martin Winter --- redhat/frr.spec.in | 1 + 1 file changed, 1 insertion(+) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 1ebb7c16ca..dcddd466ce 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -169,6 +169,7 @@ Contributed/3rd party tools which may be of use with frr. %package pythontools Summary: python tools for frr +BuildRequires: python >= 2.7 Requires: python >= 2.7 python-ipaddr Group: System Environment/Daemons From c998e2732d7d48b39b27d45adaaa9092b525ec96 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 15 Apr 2017 02:00:15 -0700 Subject: [PATCH 11/25] watchfrr: Remove the HAVE_CUMULUS around the watchfrr.started file. It's always useful Signed-off-by: Martin Winter --- watchfrr/watchfrr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 6edce242b3..9797b9bd46 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -653,12 +653,10 @@ static void daemon_send_ready(void) { static int sent = 0; if (!sent && gs.numdown == 0) { -#if defined (HAVE_CUMULUS) FILE *fp; fp = fopen(DAEMON_VTY_DIR "/watchfrr.started", "w"); fclose(fp); -#endif zlog_notice ("Watchfrr: Notifying Systemd we are up and running"); systemd_send_started(master, 0); From ba4ec8dc865a5e4ac2ae671e79987b4e80bd0bc5 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 15 Apr 2017 03:13:07 -0700 Subject: [PATCH 12/25] redhat: Add (combined) init.d script for FRR with daemon selection based on /etc/frr/daemons - Provide new frr init script - Remove separate per-deamon init.d scripts Signed-off-by: Martin Winter --- redhat/Makefile.am | 5 +- redhat/bgpd.init | 72 ------ redhat/daemons | 59 +++++ redhat/frr.init | 555 +++++++++++++++++++++++++++++++++++++++++++ redhat/frr.spec.in | 55 +---- redhat/frr.sysconfig | 25 -- redhat/isisd.init | 72 ------ redhat/ldpd.init | 72 ------ redhat/ospf6d.init | 72 ------ redhat/ospfd.init | 72 ------ redhat/pimd.init | 72 ------ redhat/ripd.init | 72 ------ redhat/ripngd.init | 72 ------ redhat/watchfrr.init | 66 ----- redhat/zebra.init | 73 ------ 15 files changed, 626 insertions(+), 788 deletions(-) delete mode 100644 redhat/bgpd.init create mode 100644 redhat/daemons create mode 100755 redhat/frr.init delete mode 100644 redhat/frr.sysconfig delete mode 100644 redhat/isisd.init delete mode 100644 redhat/ldpd.init delete mode 100644 redhat/ospf6d.init delete mode 100644 redhat/ospfd.init delete mode 100644 redhat/pimd.init delete mode 100644 redhat/ripd.init delete mode 100644 redhat/ripngd.init delete mode 100644 redhat/watchfrr.init delete mode 100644 redhat/zebra.init diff --git a/redhat/Makefile.am b/redhat/Makefile.am index f7a143ff73..0a851a38d2 100644 --- a/redhat/Makefile.am +++ b/redhat/Makefile.am @@ -1,8 +1,5 @@ -EXTRA_DIST = bgpd.init isisd.init \ - ospf6d.init ospfd.init ldpd.init \ +EXTRA_DIST = frr.init daemons \ frr.logrotate frr.pam frr.spec \ - frr.sysconfig ripd.init ripngd.init \ - watchfrr.init pimd.init zebra.init \ README.rpm_build.md diff --git a/redhat/bgpd.init b/redhat/bgpd.init deleted file mode 100644 index d200b0baaa..0000000000 --- a/redhat/bgpd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/bgpd.conf - -### BEGIN INIT INFO -# Provides: bgpd -# Short-Description: BGP routing engine -# Description: BGP routing engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="bgpd" -cmd=bgpd -LOCK_FILE=/var/lock/subsys/bgpd -CONF_FILE=/etc/frr/bgpd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $BGPD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/daemons b/redhat/daemons new file mode 100644 index 0000000000..ce0f7747a2 --- /dev/null +++ b/redhat/daemons @@ -0,0 +1,59 @@ +# This file tells the frr package which daemons to start. +# +# Entries are in the format: =(yes|no|priority) +# 0, "no" = disabled +# 1, "yes" = highest priority +# 2 .. 10 = lower priorities +# +# For daemons which support multiple instances, a 2nd line listing +# the instances can be added. Eg for ospfd: +# ospfd=yes +# ospfd_instances="1,2" +# +# Priorities were suggested by Dancer . +# 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 +# must be between 1 and 9, inclusive (or the initscript has to be +# changed). /etc/init.d/frr then can be started as +# +# /etc/init.d/frr > +# +# where priority 0 is the same as 'stop', priority 10 or 'start' +# means 'start all' +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/frr/examples/. +# +# ATTENTION: +# +# When activation a daemon at the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "frr", else +# the daemon will not be started by /etc/init.d/frr. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too. +# +watchfrr_enable=no +watchfrr_options=("-Az" "-b_" "-r/etc/init.d/frr_restart_%s" "-s/etc/init.d/frr_start_%s" "-k/etc/init.d/frr_stop_%s") +# +zebra=no +bgpd=no +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +ldpd=no +# +# Command line options for the daemons +# +zebra_options=("-A 127.0.0.1") +bgpd_options=("-A 127.0.0.1") +ospfd_options=("-A 127.0.0.1") +ospf6d_options=("-A ::1") +ripd_options=("-A 127.0.0.1") +ripngd_options=("-A ::1") +isisd_options=("-A 127.0.0.1") +ldpd_options=("-A 127.0.0.1") + diff --git a/redhat/frr.init b/redhat/frr.init new file mode 100755 index 0000000000..c8c0cee407 --- /dev/null +++ b/redhat/frr.init @@ -0,0 +1,555 @@ +#!/bin/bash +# +# /etc/rc.d/init.d/frr +# +# Start/Stop the FRR Routing daemons +# +# +# chkconfig: 2345 15 85 +# +# description: FRRouting (FRR) is a routing suite for IP routing protocols +# like BGP, OSPF, RIP and others. This script contols the main +# daemon "frr" as well as the individual protocol daemons. +# +### BEGIN INIT INFO +# Provides: frr +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $syslog +# Should-Start: $syslog +# Should-Stop: $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/Stop the FRR Routing daemons +# Description: FRRouting (FRR) is a routing suite for IP routing protocols +# like BGP, OSPF, RIP and others. This script contols the main +# daemon "frr" as well as the individual protocol daemons. +### END INIT INFO + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +D_PATH=/usr/lib/frr +C_PATH=/etc/frr +V_PATH=/var/run/frr + +# Local Daemon selection may be done by using /etc/frr/daemons. +# See /usr/share/doc/frr/README.Debian.gz for further information. +# Keep zebra first and do not list watchfrr! +DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd pimd ldpd" +MAX_INSTANCES=5 +RELOAD_SCRIPT=/usr/lib/frr/frr-reload.py + +. /etc/init.d/functions + +# Print the name of the pidfile. +pidfile() +{ + echo "$V_PATH/$1.pid" +} + +# Print the name of the vtysh. +vtyfile() +{ + echo "$V_PATH/$1.vty" +} + +# Check if daemon is started by using the pidfile. +started() +{ + [ ! -e `pidfile $1` ] && return 3 + if [ -n "$2" ] && [ "$2" == "log" ]; then + status -p `pidfile $1` $1 && return 0 || return $? + else + kill -0 `cat \`pidfile $1\`` 2> /dev/null || return 1 + return 0 + fi +} + +# Loads the config via vtysh -b if configured to do so. +vtysh_b () +{ + # Rember, that all variables have been incremented by 1 in convert_daemon_prios() + if [ "$vtysh_enable" = 2 -a -f $C_PATH/frr.conf ]; then + /usr/bin/vtysh -b -n + fi +} + +# Check if the daemon is activated and if its executable and config files +# are in place. +# params: daemon name +# returns: 0=ok, 1=error +check_daemon() +{ + # If the integrated config file is used the others are not checked. + if [ -r "$C_PATH/frr.conf" ]; then + return 0 + fi + + # vtysh_enable has no config file nor binary so skip check. + # (Not sure why vtysh_enable is in this list but does not hurt) + if [ $1 != "watchfrr" -a $1 != "vtysh_enable" ]; then + # check for daemon binary + if [ ! -x "$D_PATH/$1" ]; then return 1; fi + + # check for config file + if [ -n "$2" ]; then + if [ ! -r "$C_PATH/$1-$2.conf" ]; then + touch "$C_PATH/$1-$2.conf" + chown frr:frr "$C_PATH/$1-$2.conf" + fi + elif [ ! -r "$C_PATH/$1.conf" ]; then + touch "$C_PATH/$1.conf" + chown frr:frr "$C_PATH/$1.conf" + fi + fi + return 0 +} + +# Starts the server if it's not already running according to the pid file. +# The Frr daemons creates the pidfile when starting. +start() +{ + ulimit -n $MAX_FDS > /dev/null 2> /dev/null + if [ "$1" = "watchfrr" ]; then + + # We may need to restart watchfrr if new daemons are added and/or + # removed + if started "$1" ; then + stop watchfrr + else + # Echo only once. watchfrr is printed in the stop above + echo -n " $1" + fi + + if [ -e /var/run/frr/watchfrr.started ] ; then + rm /var/run/frr/watchfrr.started + fi + daemon --pidfile=`pidfile $1` "$D_PATH/$1" -d "${watchfrr_options[@]}" + RETVAL=$? + [ $RETVAL -ne 0 ] && break + for i in `seq 1 10`; + do + if [ -e /var/run/frr/watchfrr.started ] ; then + RETVAL=0 + break + else + sleep 1 + fi + done + RETVAL=1 + elif [ -n "$2" ]; then + echo -n " $1-$2" + if ! check_daemon $1 $2 ; then + echo -n " (binary does not exist)" + return; + fi + daemon --pidfile=`pidfile $1-$2` "$D_PATH/$1" -d `eval echo "$""$1""_options"` -n "$2" + RETVAL=$? + else + echo -n " $1 " + if ! check_daemon $1; then + echo " (binary does not exist)" + return; + fi + daemon --pidfile=`pidfile $1` "$D_PATH/$1" -d `eval echo "$""$1""_options"` + RETVAL=$? + fi + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$1 + return $RETVAL +} + +# Stop the daemon given in the parameter, printing its name to the terminal. +stop() +{ + local inst + + if [ -n "$2" ]; then + inst="$1-$2" + else + inst="$1" + fi + + if ! started "$inst" ; then + # echo -n " ($inst)" + return 0 + else + echo -n " $inst" + PIDFILE=`pidfile $inst` + PID=`cat $PIDFILE 2>/dev/null` + killproc -p "$PIDFILE" "$D_PATH/$1" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile + rm -f `pidfile $inst` + rm -f `vtyfile $inst` + echo + return $RETVAL + fi +} + +# Converts values from /etc/frr/daemons to all-numeric values. +convert_daemon_prios() +{ + for name in $DAEMONS zebra vtysh_enable watchfrr_enable; do + # First, assign the value set by the user to $value + eval value=\${${name}:0:3} + + # Daemon not activated or entry missing? + if [ "$value" = "no" -o "$value" = "" ]; then value=0; fi + + # These strings parsed for backwards compatibility. + if [ "$value" = "yes" -o "$value" = "true" ]; then + value=1; + fi + + # Zebra is threatened special. It must be between 0=off and the first + # user assigned value "1" so we increase all other enabled daemons' values. + if [ "$name" != "zebra" -a "$value" -gt 0 ]; then value=`expr "$value" + 1`; fi + + # If e.g. name is zebra then we set "zebra=yes". + eval $name=$value + done +} + +# Starts watchfrr for all wanted daemons. +start_watchfrr() +{ + local daemon_name + local daemon_prio + local found_one + local daemon_inst + + # Start the monitor daemon only if desired. + if [ 0 -eq "$watchfrr_enable" ]; then + return + fi + + # Check variable type + if ! declare -p watchfrr_options | grep -q '^declare \-a'; then + echo + echo "ERROR: The variable watchfrr_options from /etc/frr/daemons must be a BASH array!" + echo "ERROR: Please convert config file and restart!" + exit 1 + fi + + # Which daemons have been started? + found_one=0 + for daemon_name in $DAEMONS; do + eval daemon_prio=\$$daemon_name + if [ "$daemon_prio" -gt 0 ]; then + eval "daemon_inst=\${${daemon_name}_instances//,/ }" + if [ -n "$daemon_inst" ]; then + for inst in ${daemon_inst}; do + eval "inst_disable=\${${daemon_name}_${inst}}" + if [ -z ${inst_disable} ] || [ ${inst_disable} != 0 ]; then + if check_daemon $daemon_name $inst; then + watchfrr_options+=("${daemon_name}-${inst}") + fi + fi + done + else + if check_daemon $daemon_name; then + watchfrr_options+=($daemon_name) + fi + fi + found_one=1 + fi + done + + # Start if at least one daemon is activated. + if [ $found_one -eq 1 ]; then + echo "Starting FRRouting monitor daemon:" + start watchfrr + fi +} + +# Stopps watchfrr. +stop_watchfrr() +{ + echo "Stopping FRRouting monitor daemon:" + stop watchfrr +} + +# Stops all daemons that have a lower level of priority than the given. +# (technically if daemon_prio >= wanted_prio) +stop_prio() +{ + local wanted_prio + local daemon_prio + local daemon_list + local daemon_inst + local inst + + if [ -n "$2" ] && [[ "$2" =~ (.*)-(.*) ]]; then + daemon=${BASH_REMATCH[1]} + inst=${BASH_REMATCH[2]} + else + daemon="$2" + fi + + wanted_prio=$1 + daemon_list=${daemon:-$DAEMONS} + + echo "Stopping FRRouting daemons (prio:$wanted_prio):" + + for prio_i in `seq 10 -1 $wanted_prio`; do + for daemon_name in $daemon_list; do + eval daemon_prio=\${${daemon_name}:0:3} + daemon_inst="" + if [ $daemon_prio -eq $prio_i ]; then + eval "daemon_inst=\${${daemon_name}_instances//,/ }" + if [ -n "$daemon_inst" ]; then + for i in ${daemon_inst}; do + if [ -n "$inst" ] && [ "$i" == "$inst" ]; then + stop "$daemon_name" "$inst" + elif [ x"$inst" == x ]; then + stop "$daemon_name" "$i" + fi + done + else + stop "$daemon_name" + fi + fi + done + done + + if [ -z "$inst" ]; then + # Now stop other daemons that're prowling, coz the daemons file changed + echo "Stopping other FRRouting daemons" + if [ -n "$daemon" ]; then + eval "file_list_suffix="$V_PATH"/"$daemon*"" + else + eval "file_list_suffix="$V_PATH/*"" + fi + for pidfile in $file_list_suffix.pid; do + if [ -f "$pidfile" ]; then + filename=${pidfile##*/} + daemon=${filename%.*} + echo -n " $daemon" + killproc -p "$pidfile" "$daemon" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile + rm -f "$pidfile" + echo + fi + done + echo -n "Removing remaining .vty files" + for vtyfile in $file_list_suffix.vty; do + rm -rf "$vtyfile" + done + echo + fi +} + +# Starts all daemons that have a higher level of priority than the given. +# (technically if daemon_prio <= wanted_prio) +start_prio() +{ + local wanted_prio + local daemon_prio + local daemon_list + local daemon_name + local daemon_inst + local inst + + if [ -n "$2" ] && [[ "$2" =~ (.*)-(.*) ]]; then + daemon=${BASH_REMATCH[1]} + inst=${BASH_REMATCH[2]} + else + daemon="$2" + fi + + wanted_prio=$1 + daemon_list=${daemon:-$DAEMONS} + + echo "Starting FRRouting daemons (prio:$wanted_prio):" + + for prio_i in `seq 1 $wanted_prio`; do + for daemon_name in $daemon_list; do + eval daemon_prio=\$${daemon_name} + daemon_inst="" + if [ $daemon_prio -eq $prio_i ]; then + eval "daemon_inst=\${${daemon_name}_instances//,/ }" + if [ -n "$daemon_inst" ]; then + if [ `echo "$daemon_inst" | wc -w` -gt ${MAX_INSTANCES} ]; then + echo "Max instances supported is ${MAX_INSTANCES}. Aborting" + exit 1 + fi + # Check if we're starting again by switching from single instance + # to MI version + if started "$daemon_name"; then + PIDFILE=`pidfile $daemon_name` + killproc -p "$PIDFILE" "$daemon_name" + rm -f `pidfile $1` + rm -f `vtyfile $1` + fi + + for i in ${daemon_inst}; do + if [ -n "$inst" ] && [ "$i" == "$inst" ]; then + start "$daemon_name" "$inst" + elif [ x"$inst" == x ]; then + start "$daemon_name" "$i" + fi + done + else + # Check if we're starting again by switching from + # single instance to MI version + eval "file_list_suffix="$V_PATH"/"$daemon_name-*"" + for pidfile in $file_list_suffix.pid; do + if [ -f "$pidfile" ]; then + killproc -p "$pidfile" "$daemon_name" + rm -rf "$pidfile" + fi + done + for vtyfile in $file_list_suffix.vty; do + rm -rf "$vtyfile" + done + + start "$daemon_name" + fi + fi + done + done +} + +check_status() +{ + local daemon_name + local daemon_prio + local daemon_inst + local failed_status=0 + + if [ -n "$1" ] && [[ "$1" =~ (.*)-(.*) ]]; then + daemon=${BASH_REMATCH[1]} + inst=${BASH_REMATCH[2]} + else + daemon="$1" + fi + + daemon_list=${daemon:-$DAEMONS} + + # Which daemons have been started? + for daemon_name in $daemon_list; do + eval daemon_prio=\$$daemon_name + if [ "$daemon_prio" -gt 0 ]; then + eval "daemon_inst=\${${daemon_name}_instances//,/ }" + if [ -n "$daemon_inst" ]; then + for i in ${daemon_inst}; do + if [ -n "$inst" -a "$inst" = "$i" ]; then + started "$1" "log" || failed_status=$? + elif [ -z "$inst" ]; then + started "$daemon_name-$i" "log" || failed_status=$? + fi + done + else + started "$daemon_name" "log" || failed_status=$? + fi + fi + done + + # All daemons that need to have been started are up and running + return $failed_status +} + +######################################################### +# Main program # +######################################################### + +# Config broken but script must exit silently. +[ ! -r "$C_PATH/daemons" ] && exit 0 + +# Load configuration +. "$C_PATH/daemons" + +# Read configuration variable file if it is present +[ -r /etc/sysconfig/frr ] && . /etc/sysconfig/frr + +MAX_INSTANCES=${MAX_INSTANCES:=5} + +# Set priority of un-startable daemons to 'no' and substitute 'yes' to '0' +convert_daemon_prios + +if [ ! -d $V_PATH ]; then + echo "Creating $V_PATH" + mkdir -p $V_PATH + chown frr:frr $V_PATH + chmod 755 /$V_PATH +fi + +if [ -n "$3" ] && [ "$3" != "all" ]; then + dmn="$2"-"$3" +elif [ -n "$2" ] && [ "$2" != "all" ]; then + dmn="$2" +fi + +case "$1" in + start) + # Try to load this necessary (at least for 2.6) module. + if [ -d /lib/modules/`uname -r` ] ; then + echo "Loading capability module if not yet done." + LC_ALL=C modprobe -a capability 2>&1 | egrep -v "(not found|Can't locate)" + fi + + # Start all daemons + cd $C_PATH/ + if [ "$2" != "watchfrr" ]; then + start_prio 10 $dmn + fi + start_watchfrr + vtysh_b + ;; + + 1|2|3|4|5|6|7|8|9|10) + # Stop/start daemons for the appropriate priority level + stop_prio $1 + start_prio $1 + vtysh_b + ;; + + stop|0) + # Stop all daemons at level '0' or 'stop' + stop_watchfrr + if [ "$dmn" != "watchfrr" ]; then + [ -n "${dmn}" ] && eval "${dmn/-/_}=0" + stop_prio 0 $dmn + fi + + if [ -z "$dmn" -o "$dmn" = "zebra" ]; then + echo "Removing all routes made by zebra." + ip route flush proto zebra + else + [ -n "$dmn" ] && eval "${dmn/-/_}=0" + start_watchfrr + fi + ;; + + reload) + # Just apply the commands that have changed, no restart necessary + [ ! -x "$RELOAD_SCRIPT" ] && echo "frr-reload script not available" && exit 0 + NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}" + [ ! -r $NEW_CONFIG_FILE ] && echo "Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1 + echo "Applying only incremental changes to running configuration from frr.conf" + "$RELOAD_SCRIPT" --reload /etc/frr/frr.conf + exit $? + ;; + + status) + check_status $dmn + exit $? + ;; + + restart|force-reload) + $0 stop $dmn + sleep 1 + $0 start $dmn + ;; + + *) + echo "Usage: /etc/init.d/frr {start|stop|status|reload|restart|force-reload|} [daemon]" + echo " E.g. '/etc/init.d/frr 5' would start all daemons with a prio 1-5." + echo " reload applies only modifications from the running config to all daemons." + echo " reload neither restarts starts any daemon nor starts any new ones." + echo " Read /usr/share/doc/frr/README.Debian for details." + exit 1 + ;; +esac + +exit 0 diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index dcddd466ce..e6494756bf 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -35,7 +35,6 @@ %define zeb_rh_src %{zeb_src}/redhat %define zeb_docs %{zeb_src}/doc %define frr_tools %{zeb_src}/tools -%define cumulus_dir %{zeb_src}/cumulus/etc # defines for configure %define _localstatedir /var/run/frr @@ -169,8 +168,8 @@ Contributed/3rd party tools which may be of use with frr. %package pythontools Summary: python tools for frr -BuildRequires: python >= 2.7 -Requires: python >= 2.7 python-ipaddr +BuildRequires: python +Requires: python python-ipaddr Group: System Environment/Daemons %description pythontools @@ -315,17 +314,11 @@ install %{frr_tools}/frr.service \ %{buildroot}%{_unitdir}/frr.service %else mkdir -p %{buildroot}/etc/rc.d/init.d -for daemon in %{all_daemons} ; do - if [ x"${daemon}" != x"" ] ; then - install %{zeb_rh_src}/${daemon}.init \ - %{buildroot}/etc/rc.d/init.d/${daemon} - fi -done +install %{zeb_rh_src}/frr.init \ + %{buildroot}/etc/rc.d/init.d/frr %endif -install %{cumulus_dir}/frr/debian.conf %{buildroot}/etc/frr -install %{cumulus_dir}/frr/daemons %{buildroot}/etc/frr -install -m644 %{cumulus_dir}/default/frr %{buildroot}/etc/default +install %{zeb_rh_src}/daemons %{buildroot}/etc/frr install -m644 %{zeb_rh_src}/frr.pam \ %{buildroot}/etc/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate \ @@ -395,11 +388,7 @@ for daemon in %all_daemons ; do %systemd_post frr.service done %else -for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - /sbin/chkconfig --add ${daemon} - fi -done +/sbin/chkconfig --add frr %endif /sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir @@ -536,12 +525,8 @@ fi ## init.d Version ## if [ "$1" = "0" ]; then - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 - /sbin/chkconfig --del ${daemon} - fi - done + /etc/rc.d/init.d/frr stop >/dev/null 2>&1 + /sbin/chkconfig --del frr fi %endif /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir @@ -587,7 +572,7 @@ rm -rf %{buildroot} %endif %{_sbindir}/isisd %if %{with_ldpd} -%{_sbindir}/ldpd + %{_sbindir}/ldpd %endif %if %{with_nhrpd} %{_sbindir}/nhrpd @@ -602,27 +587,9 @@ rm -rf %{buildroot} %if "%{initsystem}" == "systemd" %config %{_unitdir}/frr.service %else - %config /etc/rc.d/init.d/zebra - %if %{with_watchfrr} - %config /etc/rc.d/init.d/watchfrr - %endif - %config /etc/rc.d/init.d/ripd - %config /etc/rc.d/init.d/ospfd - %config /etc/rc.d/init.d/bgpd - %config /etc/rc.d/init.d/ripngd - %config /etc/rc.d/init.d/ospf6d - %config /etc/rc.d/init.d/isisd - %if %{with_pimd} - %config /etc/rc.d/init.d/pimd - %endif - %if %{with_ldpd} - %config /etc/rc.d/init.d/ldpd - %endif - %if %{with_nhrpd} - %config /etc/rc.d/init.d/nhrpd - %endif + %config /etc/rc.d/init.d/frr %endif -%config(noreplace) /etc/default/frr +%config /etc/frr/daemons %config(noreplace) /etc/pam.d/frr %config(noreplace) %attr(640,root,root) /etc/logrotate.d/* diff --git a/redhat/frr.sysconfig b/redhat/frr.sysconfig deleted file mode 100644 index 97c28c807d..0000000000 --- a/redhat/frr.sysconfig +++ /dev/null @@ -1,25 +0,0 @@ -# -# Default: Bind all daemon vtys to the loopback(s) only -# -BGPD_OPTS="-A 127.0.0.1" -ISISD_OPTS="-A ::1" -OSPF6D_OPTS="-A ::1" -OSPFD_OPTS="-A 127.0.0.1" -RIPD_OPTS="-A 127.0.0.1" -RIPNGD_OPTS="-A ::1" -ZEBRA_OPTS="-A 127.0.0.1" -PIMD_OPTS="-A 127.0.0.1" -LDPD_OPTS="-A 127.0.0.1" - -# Watchfrr configuration for LSB initscripts -# -# (Not needed with systemd: the service files are configured to automatically -# restart any daemon on failure. If zebra fails, all running daemons will be -# stopped; zebra will be started again; and then the previously running daemons -# will be started again.) -# -# Uncomment and edit this line to reflect the daemons you are actually using: -#WATCH_DAEMONS="zebra bgpd ospfd ospf6d ripd ripngd" -# -# Timer values can be adjusting by editing this line: -WATCH_OPTS="-Az -b_ -r/sbin/service_%s_restart -s/sbin/service_%s_start -k/sbin/service_%s_stop" diff --git a/redhat/isisd.init b/redhat/isisd.init deleted file mode 100644 index b309e07542..0000000000 --- a/redhat/isisd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/isisd.conf - -### BEGIN INIT INFO -# Provides: isisd -# Short-Description: IS-IS routing engine -# Description: IS-IS routing engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="isisd" -cmd=isisd -LOCK_FILE=/var/lock/subsys/isisd -CONF_FILE=/etc/frr/isisd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $ISISD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/ldpd.init b/redhat/ldpd.init deleted file mode 100644 index 3ade9bfe9f..0000000000 --- a/redhat/ldpd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/ldpd.conf - -### BEGIN INIT INFO -# Provides: ldpd -# Short-Description: LDP engine -# Description: LDP engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="ldpd" -cmd=ldpd -LOCK_FILE=/var/lock/subsys/ldpd -CONF_FILE=/etc/frr/ldpd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $LDPD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/ospf6d.init b/redhat/ospf6d.init deleted file mode 100644 index 5c5a2af236..0000000000 --- a/redhat/ospf6d.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/ospf6d.conf - -### BEGIN INIT INFO -# Provides: ospf6d -# Short-Description: OSPF routing engine for IPv6 -# Description: OSPF routing engine for use with Zebra and IPv6 -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="ospf6d" -cmd=ospf6d -LOCK_FILE=/var/lock/subsys/ospf6d -CONF_FILE=/etc/frr/ospf6d.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $OSPF6D_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/ospfd.init b/redhat/ospfd.init deleted file mode 100644 index e9cbbc739c..0000000000 --- a/redhat/ospfd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/ospfd.conf - -### BEGIN INIT INFO -# Provides: ospfd -# Short-Description: OSPF routing engine -# Description: OSPF routing engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="ospfd" -cmd=ospfd -LOCK_FILE=/var/lock/subsys/ospfd -CONF_FILE=/etc/frr/ospfd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $OSPFD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/pimd.init b/redhat/pimd.init deleted file mode 100644 index 85cbf8d2b1..0000000000 --- a/redhat/pimd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/pimd.conf - -### BEGIN INIT INFO -# Provides: pimd -# Short-Description: PIM multicast routing engine -# Description: PIM routing engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="pimd" -cmd=pimd -LOCK_FILE=/var/lock/subsys/pimd -CONF_FILE=/etc/frr/pimd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $PIMD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/ripd.init b/redhat/ripd.init deleted file mode 100644 index 8e25a83f4b..0000000000 --- a/redhat/ripd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/ripd.conf - -### BEGIN INIT INFO -# Provides: ripd -# Short-Description: RIP routing engine -# Description: RIP routing engine for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="ripd" -cmd=ripd -LOCK_FILE=/var/lock/subsys/ripd -CONF_FILE=/etc/frr/ripd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $RIPD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/ripngd.init b/redhat/ripngd.init deleted file mode 100644 index 7b9fde4085..0000000000 --- a/redhat/ripngd.init +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# chkconfig: - 16 84 -# config: /etc/frr/ripngd.conf - -### BEGIN INIT INFO -# Provides: ripngd -# Short-Description: RIP routing engine for IPv6 -# Description: RIP routing engine for use with Zebra and IPv6 -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="ripngd" -cmd=ripngd -LOCK_FILE=/var/lock/subsys/ripngd -CONF_FILE=/etc/frr/ripngd.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - daemon $cmd -d $RIPNGD_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/watchfrr.init b/redhat/watchfrr.init deleted file mode 100644 index bc83415167..0000000000 --- a/redhat/watchfrr.init +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# chkconfig: 2345 17 83 - -### BEGIN INIT INFO -# Provides: watchfrr -# Short-Description: Frr watchdog -# Description: Frr watchdog for use with Zebra -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="watchfrr" -cmd=watchfrr -LOCK_FILE=/var/lock/subsys/watchfrr - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # Check that there are daemons to be monitored. - [ -z "$WATCH_DAEMONS" ] && exit 1 - - echo -n $"Starting $PROG: " - daemon $cmd -d $WATCH_OPTS $WATCH_DAEMONS - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL diff --git a/redhat/zebra.init b/redhat/zebra.init deleted file mode 100644 index 1afb785431..0000000000 --- a/redhat/zebra.init +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# chkconfig: - 15 85 -# config: /etc/frr/zebra.conf - -### BEGIN INIT INFO -# Provides: zebra -# Short-Description: GNU Zebra routing manager -# Description: GNU Zebra routing manager -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -# Get network config -. /etc/sysconfig/network - -# frr command line options -. /etc/sysconfig/frr - -RETVAL=0 -PROG="zebra" -cmd=zebra -LOCK_FILE=/var/lock/subsys/zebra -CONF_FILE=/etc/frr/zebra.conf - -case "$1" in - start) - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 1 - - # The process must be configured first. - [ -f $CONF_FILE ] || exit 6 - if [ `id -u` -ne 0 ]; then - echo $"Insufficient privilege" 1>&2 - exit 4 - fi - - echo -n $"Starting $PROG: " - /sbin/ip route flush proto zebra - daemon $cmd -d $ZEBRA_OPTS -f $CONF_FILE - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - echo - ;; - stop) - echo -n $"Shutting down $PROG: " - killproc $cmd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - echo - ;; - restart|reload|force-reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $LOCK_FILE ]; then - $0 stop - $0 start - fi - RETVAL=$? - ;; - status) - status $cmd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 2 -esac - -exit $RETVAL From fc3e243c0adbe9b164e318b0b423bc9025a05f70 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 15 Apr 2017 03:29:34 -0700 Subject: [PATCH 13/25] redhat: /etc/frr/daemons needs to be marked as no replace config to be save from overwriting Signed-off-by: Martin Winter --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index e6494756bf..a02771d242 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -589,7 +589,7 @@ rm -rf %{buildroot} %else %config /etc/rc.d/init.d/frr %endif -%config /etc/frr/daemons +%config(noreplace) /etc/frr/daemons %config(noreplace) /etc/pam.d/frr %config(noreplace) %attr(640,root,root) /etc/logrotate.d/* From 2931e394e94c9a88b7ffa3aa1855f20913eb7ad4 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 17 Apr 2017 18:17:16 -0700 Subject: [PATCH 14/25] redhat: Add frr.service file for redhat based systemd systems (using init script) Signed-off-by: Martin Winter --- redhat/Makefile.am | 2 +- redhat/frr.service | 23 +++++++++++++++++++++++ redhat/frr.spec.in | 27 ++++++++++++++++++++------- 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 redhat/frr.service diff --git a/redhat/Makefile.am b/redhat/Makefile.am index 0a851a38d2..74856cfd82 100644 --- a/redhat/Makefile.am +++ b/redhat/Makefile.am @@ -1,5 +1,5 @@ -EXTRA_DIST = frr.init daemons \ +EXTRA_DIST = frr.init frr.service daemons \ frr.logrotate frr.pam frr.spec \ README.rpm_build.md diff --git a/redhat/frr.service b/redhat/frr.service new file mode 100644 index 0000000000..cc6ec429a3 --- /dev/null +++ b/redhat/frr.service @@ -0,0 +1,23 @@ +[Unit] +Description=FRRouting (FRR) +After=syslog.target networking.service +OnFailure=heartbeat-failed@%n.service + +[Service] +Nice=-5 +Type=forking +NotifyAccess=all +StartLimitInterval=3m +StartLimitBurst=3 +TimeoutSec=1m +WatchdogSec=60s +RestartSec=5 +Restart=on-abnormal +LimitNOFILE=1024 +ExecStart=/usr/lib/frr/frr start +ExecStop=/usr/lib/frr/frr stop +ExecReload=/usr/lib/frr/frr reload + +[Install] +WantedBy=network-online.target + diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a02771d242..4c6875aaf5 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -306,12 +306,16 @@ make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install # Remove this file, as it is uninstalled and causes errors when building on RH9 rm -rf %{buildroot}/usr/share/info/dir +# Remove debian init script if it was installed +rm -f %{buildroot}%{_sbindir}/frr # install /etc sources %if "%{initsystem}" == "systemd" mkdir -p %{buildroot}%{_unitdir} -install %{frr_tools}/frr.service \ +install %{zeb_rh_src}/frr.service \ %{buildroot}%{_unitdir}/frr.service +install %{zeb_rh_src}/frr.init \ + %{buildroot}%{_sbindir}/frr %else mkdir -p %{buildroot}/etc/rc.d/init.d install %{zeb_rh_src}/frr.init \ @@ -399,7 +403,7 @@ if [ ! -e %{_sysconfdir}/zebra.conf ]; then %if 0%{?frr_user:1} chown %frr_user:%frr_user %{_sysconfdir}/zebra.conf* %endif - chmod 640 %{_sysconfdir}/zebra.conf + chmod 640 %{_sysconfdir}/zebra.conf* fi for daemon in %{all_daemons} ; do if [ x"${daemon}" != x"" ] ; then @@ -411,6 +415,10 @@ for daemon in %{all_daemons} ; do fi fi done +%if 0%{?frr_user:1} + chown %frr_user:%frr_user %{_sysconfdir}/daemons +%endif + %if %{with_watchfrr} # No config for watchfrr - this is part of /etc/sysconfig/frr rm -f %{_sysconfdir}/watchfrr.* @@ -419,8 +427,10 @@ done if [ ! -e %{_sysconfdir}/vtysh.conf ]; then touch %{_sysconfdir}/vtysh.conf chmod 640 %{_sysconfdir}/vtysh.conf +%if 0%{?frr_user:1} %if 0%{?vty_group:1} - chown frr:%{vty_group} %{_sysconfdir}/vtysh.conf* + chown %{frr_user}:%{vty_group} %{_sysconfdir}/vtysh.conf* +%endif %endif fi @@ -560,8 +570,7 @@ rm -rf %{buildroot} %{_sbindir}/ospfd %{_sbindir}/ripd %{_sbindir}/bgpd -%{_sbindir}/ssd -%{_sbindir}/frr +%exclude %{_sbindir}/ssd %if %{with_watchfrr} %{_sbindir}/watchfrr %endif @@ -583,13 +592,14 @@ rm -rf %{buildroot} %attr(755,root,root) %{_libdir}/lib*.so.0.* %endif %{_bindir}/* -%config /etc/frr/[!v]* +%config(noreplace) /etc/frr/[!v]* +%attr(750,%frr_user,%frr_user) /etc/frr/daemons %if "%{initsystem}" == "systemd" %config %{_unitdir}/frr.service + %{_sbindir}/frr %else %config /etc/rc.d/init.d/frr %endif -%config(noreplace) /etc/frr/daemons %config(noreplace) /etc/pam.d/frr %config(noreplace) %attr(640,root,root) /etc/logrotate.d/* @@ -625,8 +635,11 @@ rm -rf %{buildroot} * Fri Jan 6 2017 Martin Winter - %{version} * Thu Apr 13 2017 Martin Winter - %{version} +* Thu Apr 17 2017 Martin Winter - %{version} - new subpackage frr-pythontools with python 2.7 restart script - remove PIMd from CentOS/RedHat 6 RPM packages (won't work - too old) +- converted to single frr init script (not per daemon) based on debian init script +- created systemd service file for systemd based systems (which uses init script) - Various other RPM package fixes for FRR 2.0 * Fri Jan 6 2017 Martin Winter From 00e3b7aa3b9d2bd859e137992e5b199a9fdb582c Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 17 Apr 2017 18:34:32 -0700 Subject: [PATCH 15/25] redhat: fix upgrade script (%postun), remove invalid mpls package selection (it's always built and auto detected), add ldpd Signed-off-by: Martin Winter --- redhat/frr.spec.in | 88 +++++----------------------------------------- 1 file changed, 8 insertions(+), 80 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 4c6875aaf5..46cdb9e134 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -16,7 +16,6 @@ %{!?with_ospfapi: %global with_ospfapi 1 } %{!?with_irdp: %global with_irdp 1 } %{!?with_rtadv: %global with_rtadv 1 } -%{!?with_mpls: %global with_mpls 0 } %{!?with_ldpd: %global with_ldpd 0 } %{!?with_nhrpd: %global with_nhrpd 1 } %{!?with_shared: %global with_shared 1 } @@ -217,9 +216,9 @@ developing OSPF-API and frr applications. %endif --enable-vtysh \ %if %{with_ospfclient} - --enable-ospfclient=yes \ + --enable-ospfclient \ %else - --enable-ospfclient=no\ + --disable-ospfclient\ %endif %if %{with_ospfapi} --enable-ospfapi=yes \ @@ -236,11 +235,6 @@ developing OSPF-API and frr applications. %else --enable-rtadv=no \ %endif -%if %{with_mpls} - --enable-mpls=yes \ -%else - --disable-mpls \ -%endif %if %{with_ldpd} --enable-ldpd \ %else @@ -436,85 +430,19 @@ fi %postun if [ "$1" -ge 1 ]; then - # Find out which daemons need to be restarted. - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - if [ -f /var/lock/subsys/${daemon} ]; then - eval restart_${daemon}=yes - else - eval restart_${daemon}=no - fi - fi - done - # Rename restart flags for daemons handled specially. - running_zebra="$restart_zebra" - restart_zebra=no - %if %{with_watchfrr} - running_watchfrr="$restart_watchfrr" - restart_watchfrr=no - %endif - + # + # Upgrade from older version + # %if "%{initsystem}" == "systemd" ## ## Systemd Version ## - # No watchfrr for systemd version - # - # Stop all daemons other than zebra. - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_postun ${daemon}.service - : - fi - done - # Restart zebra. - [ "$running_zebra" = yes ] && \ - %systemd_postun_with_restart $daemon.service - # Start all daemons other than zebra. - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - %systemd_post ${daemon}.service - : - fi - done + %systemd_postun frr.service %else ## ## init.d Version ## - %if %{with_watchfrr} - # Stop watchfrr first. - [ "$running_watchfrr" = yes ] && \ - /etc/rc.d/init.d/watchfrr stop >/dev/null 2>&1 - %endif - # Stop all daemons other than zebra and watchfrr. - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 - fi - done - # Restart zebra. - [ "$running_zebra" = yes ] && \ - /etc/rc.d/init.d/zebra restart >/dev/null 2>&1 - # Start all daemons other than zebra and watchfrr. - for daemon in %all_daemons ; do - if [ x"${daemon}" != x"" ] ; then - eval restart=\$restart_${daemon} - [ "$restart" = yes ] && \ - /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 - fi - done - %if %{with_watchfrr} - # Start watchfrr last. - # Avoid postun scriptlet error if watchfrr is not running. - [ "$running_watchfrr" = yes ] && \ - /etc/rc.d/init.d/watchfrr start >/dev/null 2>&1 || : - %endif + /etc/rc.d/init.d/frr restart >/dev/null 2>&1 %endif fi @@ -526,7 +454,7 @@ fi if [ "$1" = "0" ]; then for daemon in %all_daemons ; do if [ x"${daemon}" != x"" ] ; then - %systemd_preun ${daemon}.service + %systemd_preun frr.service fi done fi From c4342d2729780af9ab162f28b1e2112b2f0c89b6 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 17 Apr 2017 18:45:50 -0700 Subject: [PATCH 16/25] redhat: Update documentation for RPM build and usage Signed-off-by: Martin Winter --- redhat/README.rpm_build.md | 58 +++++++++++--------------------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index fa1d56e0ef..4513eda635 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -1,6 +1,6 @@ Building your own FRRouting RPM ====================================== -(Tested on CentOS 6, CentOS 7 and Fedora 22.) +(Tested on CentOS 6, CentOS 7 and Fedora 24.) 1. Install the following packages to build the RPMs: @@ -46,19 +46,12 @@ Building your own FRRouting RPM ################# frr configure options #################### # with-feature options %{!?with_snmp: %global with_snmp 1 } - %{!?with_vtysh: %global with_vtysh 1 } - %{!?with_ospf_te: %global with_ospf_te 1 } - %{!?with_opaque_lsa: %global with_opaque_lsa 1 } %{!?with_tcp_zebra: %global with_tcp_zebra 0 } - %{!?with_vtysh: %global with_vtysh 1 } %{!?with_pam: %global with_pam 1 } %{!?with_ospfclient: %global with_ospfclient 1 } %{!?with_ospfapi: %global with_ospfapi 1 } %{!?with_irdp: %global with_irdp 1 } %{!?with_rtadv: %global with_rtadv 1 } - %{!?with_isisd: %global with_isisd 1 } - %{!?with_pimd: %global with_pimd 1 } - %{!?with_mpls: %global with_mpls 0 } %{!?with_ldpd: %global with_ldpd 0 } %{!?with_shared: %global with_shared 1 } %{!?with_multipath: %global with_multipath 64 } @@ -66,6 +59,8 @@ Building your own FRRouting RPM %{!?vty_group: %global vty_group frrvt } %{!?with_fpm: %global with_fpm 0 } %{!?with_watchfrr: %global with_watchfrr 1 } + %{!?with_bgp_vnc: %global with_bgp_vnc 0 } + %{!?with_pimd: %global with_pimd 1 } 6. Build the RPM @@ -82,55 +77,36 @@ Enabling daemons after installation of the package: ### init.d based systems (ie CentOS 6): -1. Enable the daemons as needed to run after boot (Zebra is mandatory) +1. Edit /etc/frr/daemons and enable required routing daemons (Zebra is probably needed for most deployments, so make sure to enable it.) + +2. Enable the daemons as needed to run after boot (Zebra is mandatory) - chkconfig zebra on - chkconfig ospfd on - chkconfig ospf6d on - chkconfig bgpd on - ... etc - -2. If you want to run `watchfrr`, then configure `/etc/sysconfig/frr` - and uncomment the line with the daemons for `watchfrr` to monitor, - then enable watchfrr - - chkconfig watchfrr on + chkconfig frr on 3. Check your firewall / IPtables to make sure the routing protocols are allowed. -4. Start the daemons (or reboot) +5. Start the FRR daemons (or reboot) - service zebra start - service bgpd start - service ospfd start - ... etc + service frr start -Configuration is stored in `/etc/frr/*.conf` files. +Configuration is stored in `/etc/frr/*.conf` files and daemon selection is stored in `/etc/frr/daemons`. -### systemd based systems (ie CentOS 7, Fedora 22) +### systemd based systems (ie CentOS 7, Fedora 24) -1. Enable the daemons as needed to run after boot (Zebra is mandatory) +1. Edit /etc/frr/daemons and enable required routing daemons (Zebra is probably needed for most deployments, so make sure to enable it.) + +2. Enable the frr daemons to run after boot. - systemctl enable zebra - systemctl enable ospfd - systemctl enable ospf6d - systemctl enable bgpd - ... etc - - Note: There is no watchfrr on systemd based systems. Systemd contains - the functionality of monitoring and restarting daemons. + systemctl enable frr 2. Check your firewall / IPtables to make sure the routing protocols are allowed. 3. Start the daemons (or reboot) - systemctl start zebra - systemctl start bgpd - systemctl start ospfd - ... etc + systemctl start frr -Configuration is stored in `/etc/frr/*.conf` files. +Configuration is stored in `/etc/frr/*.conf` files and daemon selection is stored in `/etc/frr/daemons`. From d31223c5320f44d9a1d50536ccfed2418eaaeb56 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 19 Apr 2017 18:12:10 -0700 Subject: [PATCH 17/25] redhat: Fix BuildRequires for FRR/2.0 and duplicate /etc/frr/daemons - add make & gcc - remove autoconf and automake (not needed to build from src.rpm) - fix texi2html version detection for case when no texi2html is installed (broke yum-builddep) - fix duplicate listing of /etc/frr/daemons Signed-off-by: Martin Winter --- redhat/frr.spec.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 46cdb9e134..c52af61483 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -8,7 +8,7 @@ # rpms again and again on the same day, so the newer rpms can be installed. # bumping the number each time. -####################### FRRouting (FRR) configure options ######################### +#################### FRRouting (FRR) configure options ##################### # with-feature options %{!?with_tcp_zebra: %global with_tcp_zebra 0 } %{!?with_pam: %global with_pam 0 } @@ -46,7 +46,7 @@ #### Check version of texi2html # Old versions don't support "--number-footnotes" option. -%{expand: %%global texi2htmlversion %(/usr/bin/texi2html --version | cut -d. -f1)} +%{expand: %%global texi2htmlversion %(if [[ -f /usr/bin/texi2html ]]; then /usr/bin/texi2html --version | cut -d. -f1; else echo 0; fi)} #### Check for systemd or init.d (upstart) # Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7) @@ -127,9 +127,9 @@ Requires: ncurses json-c Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info Requires(post): /sbin/install-info -BuildRequires: texi2html texinfo autoconf automake patch libcap-devel groff +BuildRequires: gcc texi2html texinfo patch libcap-devel groff BuildRequires: readline readline-devel ncurses ncurses-devel -BuildRequires: json-c-devel bison >= 2.7 flex +BuildRequires: json-c-devel bison >= 2.7 flex make Requires: ncurses initscripts %if %{with_pam} BuildRequires: pam-devel @@ -520,8 +520,8 @@ rm -rf %{buildroot} %attr(755,root,root) %{_libdir}/lib*.so.0.* %endif %{_bindir}/* -%config(noreplace) /etc/frr/[!v]* -%attr(750,%frr_user,%frr_user) /etc/frr/daemons +%config(noreplace) /etc/frr/[!v]*.conf* +%config(noreplace) %attr(750,%frr_user,%frr_user) /etc/frr/daemons %if "%{initsystem}" == "systemd" %config %{_unitdir}/frr.service %{_sbindir}/frr From be5df5f7317c5b607679f638ef0979cb3ed03802 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 19 Apr 2017 18:39:49 -0700 Subject: [PATCH 18/25] redhat: fix duplicate Requires: line in spec file Signed-off-by: Martin Winter --- redhat/frr.spec.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index c52af61483..523af5da20 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -123,14 +123,13 @@ License: GPLv2+ Group: System Environment/Daemons Source0: http://www.frrouting.org/releases/frr/%{name}-%{frrversion}.tar.gz URL: http://www.frrouting.org -Requires: ncurses json-c Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info Requires(post): /sbin/install-info BuildRequires: gcc texi2html texinfo patch libcap-devel groff BuildRequires: readline readline-devel ncurses ncurses-devel BuildRequires: json-c-devel bison >= 2.7 flex make -Requires: ncurses initscripts +Requires: ncurses json-c initscripts %if %{with_pam} BuildRequires: pam-devel Requires: pam From 1dffb5647c7196e4615ac0b2bfff019b7678fc4a Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 19 Apr 2017 18:41:45 -0700 Subject: [PATCH 19/25] redhat: redirect reload function in frr init script to restart if reload script is not installed (fixes systemctl restart) Signed-off-by: Martin Winter --- redhat/frr.init | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/redhat/frr.init b/redhat/frr.init index c8c0cee407..ba3731e777 100755 --- a/redhat/frr.init +++ b/redhat/frr.init @@ -523,9 +523,17 @@ case "$1" in reload) # Just apply the commands that have changed, no restart necessary - [ ! -x "$RELOAD_SCRIPT" ] && echo "frr-reload script not available" && exit 0 + if [ ! -x "$RELOAD_SCRIPT" ]; then + echo "frr-reload script not installed - Executing full restart instead" + $0 restart + exit $? + fi NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}" - [ ! -r $NEW_CONFIG_FILE ] && echo "Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1 + if [ ! -r $NEW_CONFIG_FILE ]; then + echo "Unable to read configuration file $NEW_CONFIG_FILE. Only supporting integrated config - Executing full restart instead" + $0 restart + exit $? + fi echo "Applying only incremental changes to running configuration from frr.conf" "$RELOAD_SCRIPT" --reload /etc/frr/frr.conf exit $? From cf53d4137720159460c2f4a6a07b66e06d3b5bf6 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 19 Apr 2017 18:45:03 -0700 Subject: [PATCH 20/25] redhat: fix README for rpm package build - correct requirements - add comment on bison 2.7 installation on CentOS 6 Signed-off-by: Martin Winter --- redhat/README.rpm_build.md | 55 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index 4513eda635..daa4a4861f 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -2,11 +2,17 @@ Building your own FRRouting RPM ====================================== (Tested on CentOS 6, CentOS 7 and Fedora 24.) -1. Install the following packages to build the RPMs: +1. On CentOS 6 (which doesn't provide a bison/automake/autoconf of a recent enough version): + - Check out ../doc/Building_FRR_on_CentOS6.md for details on installing + a bison/automake/autoconf to support frr building. + + Newer automake/autoconf/bison is only needed to build the rpm and is + **not** needed to install the binary rpm package + +2. Install the following packages to build the RPMs: yum install git autoconf automake libtool make gawk readline-devel \ - texinfo dejagnu net-snmp-devel groff rpm-build net-snmp-devel \ - libcap-devel texi2html bison flex + texinfo net-snmp-devel groff pkgconfig rpm-build json-c-devel pam-devel texi2html bison Additionally, on systems with systemd (CentOS 7, Fedora) @@ -18,11 +24,11 @@ Building your own FRRouting RPM how to install required version of autoconf, automake and bison. The versions in the common Repo are too old. -2. Checkout FRR under a **unpriviledged** user account +3. Checkout FRR under a **unpriviledged** user account git clone https://github.com/frrouting/frr.git frr -3. Run Bootstrap and make distribution tar.gz +4. Run Bootstrap and make distribution tar.gz cd frr ./bootstrap.sh @@ -32,7 +38,7 @@ Building your own FRRouting RPM Note: configure parameters are not important for the RPM building - except the `with-pkg-extra-version` if you want to give the RPM a specific name to mark your own unoffical build -4. Create RPM directory structure and populate with sources +5. Create RPM directory structure and populate with sources mkdir rpmbuild mkdir rpmbuild/SOURCES @@ -40,29 +46,28 @@ Building your own FRRouting RPM cp redhat/*.spec rpmbuild/SPECS/ cp frr*.tar.gz rpmbuild/SOURCES/ -5. Edit rpm/SPECS/frr.spec with configuration as needed +6. Edit rpm/SPECS/frr.spec with configuration as needed Look at the beginning of the file and adjust the following parameters to enable or disable features as required: - ################# frr configure options #################### + ############### FRRouting (FRR) configure options ################# # with-feature options - %{!?with_snmp: %global with_snmp 1 } - %{!?with_tcp_zebra: %global with_tcp_zebra 0 } - %{!?with_pam: %global with_pam 1 } - %{!?with_ospfclient: %global with_ospfclient 1 } - %{!?with_ospfapi: %global with_ospfapi 1 } - %{!?with_irdp: %global with_irdp 1 } - %{!?with_rtadv: %global with_rtadv 1 } - %{!?with_ldpd: %global with_ldpd 0 } - %{!?with_shared: %global with_shared 1 } - %{!?with_multipath: %global with_multipath 64 } - %{!?frr_user: %global frr_user frr } - %{!?vty_group: %global vty_group frrvt } - %{!?with_fpm: %global with_fpm 0 } - %{!?with_watchfrr: %global with_watchfrr 1 } - %{!?with_bgp_vnc: %global with_bgp_vnc 0 } - %{!?with_pimd: %global with_pimd 1 } + %{!?with_tcp_zebra: %global with_tcp_zebra 0 } + %{!?with_pam: %global with_pam 0 } + %{!?with_ospfclient: %global with_ospfclient 1 } + %{!?with_ospfapi: %global with_ospfapi 1 } + %{!?with_irdp: %global with_irdp 1 } + %{!?with_rtadv: %global with_rtadv 1 } + %{!?with_ldpd: %global with_ldpd 1 } + %{!?with_shared: %global with_shared 1 } + %{!?with_multipath: %global with_multipath 256 } + %{!?frr_user: %global frr_user frr } + %{!?vty_group: %global vty_group frrvty } + %{!?with_fpm: %global with_fpm 0 } + %{!?with_watchfrr: %global with_watchfrr 1 } + %{!?with_bgp_vnc: %global with_bgp_vnc 0 } + %{!?with_pimd: %global with_pimd 1 } -6. Build the RPM +7. Build the RPM rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/frr.spec From baa1b8daf57494e82e807e3633ca5002bd62a792 Mon Sep 17 00:00:00 2001 From: smccroskey Date: Thu, 27 Apr 2017 19:39:24 -0700 Subject: [PATCH 21/25] redhat: use %initsystem check that works when chrooted `systemctl' returns different, non-useful output while in a chroot. Switch to checking if /sbin/init is a symlink to the systemd binary. With this change the build works in a mock chroot. Signed-off-by: Silas McCroskey --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 523af5da20..9b2e188a3a 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -50,7 +50,7 @@ #### Check for systemd or init.d (upstart) # Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7) -%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)} +%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `file /sbin/init` =~ "symbolic link to \`../lib/systemd/systemd'" ]]; then echo systemd; fi)} # # If init system is systemd, then always disable watchfrr # From e144d2ef148802980859e782b2a29b54edc11e05 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 22 May 2017 04:04:35 -0700 Subject: [PATCH 22/25] redhat: fix previous merge. initsystem detection should now work for mock builds and native builds on systemd based systems Signed-off-by: Martin Winter --- redhat/frr.spec.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 9b2e188a3a..c5e6775f3b 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -50,7 +50,7 @@ #### Check for systemd or init.d (upstart) # Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7) -%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `file /sbin/init` =~ "symbolic link to \`../lib/systemd/systemd'" ]]; then echo systemd; fi)} +%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `file /sbin/init` =~ "symbolic link to \`../lib/systemd/systemd'" ]]; then echo systemd; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)} # # If init system is systemd, then always disable watchfrr # @@ -563,6 +563,7 @@ rm -rf %{buildroot} * Fri Jan 6 2017 Martin Winter - %{version} * Thu Apr 13 2017 Martin Winter - %{version} * Thu Apr 17 2017 Martin Winter - %{version} +* Mon Apr 17 2017 Martin Winter - %{version} - new subpackage frr-pythontools with python 2.7 restart script - remove PIMd from CentOS/RedHat 6 RPM packages (won't work - too old) - converted to single frr init script (not per daemon) based on debian init script From fc1d4284b19e592e143a3994cc5b127c20241bd2 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 22 May 2017 04:07:22 -0700 Subject: [PATCH 23/25] redhat: Disallow reload function for unsupported systems Before the change, a reload triggered a restart if the python reload script wasn't installed or for non-integrated configs With this change, the reload is rejected with an error in this case (and suggests the installation of the python script package) Signed-off-by: Martin Winter --- redhat/frr.init | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/redhat/frr.init b/redhat/frr.init index ba3731e777..96c0a833af 100755 --- a/redhat/frr.init +++ b/redhat/frr.init @@ -524,15 +524,13 @@ case "$1" in reload) # Just apply the commands that have changed, no restart necessary if [ ! -x "$RELOAD_SCRIPT" ]; then - echo "frr-reload script not installed - Executing full restart instead" - $0 restart - exit $? + echo "frr-reload - reload not supported. Use restart or install frr-pythontools package" + exit 1 fi NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}" if [ ! -r $NEW_CONFIG_FILE ]; then - echo "Unable to read configuration file $NEW_CONFIG_FILE. Only supporting integrated config - Executing full restart instead" - $0 restart - exit $? + echo "Unable to read configuration file $NEW_CONFIG_FILE. Only supporting integrated config" + exit 1 fi echo "Applying only incremental changes to running configuration from frr.conf" "$RELOAD_SCRIPT" --reload /etc/frr/frr.conf From 02b9d1308cf908fed53a867ed5e44877ad684a1a Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 22 May 2017 04:08:44 -0700 Subject: [PATCH 24/25] redhat: Fix missing packages in requirements section of README Signed-off-by: Martin Winter --- redhat/README.rpm_build.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index daa4a4861f..d2b0814364 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -12,7 +12,8 @@ Building your own FRRouting RPM 2. Install the following packages to build the RPMs: yum install git autoconf automake libtool make gawk readline-devel \ - texinfo net-snmp-devel groff pkgconfig rpm-build json-c-devel pam-devel texi2html bison + texinfo net-snmp-devel groff pkgconfig rpm-build json-c-devel \ + pam-devel texi2html bison libcap-devel flex Additionally, on systems with systemd (CentOS 7, Fedora) From 31c98471f2296f36c282b3da2a7fae85328e9989 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 6 Jun 2017 15:03:54 -0700 Subject: [PATCH 25/25] redhat: Fix changelog to be in correct format and order --- redhat/frr.spec.in | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index c5e6775f3b..3bc36cd053 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -89,18 +89,18 @@ %define daemon_ldpd "" %endif -%if %{with_nhrpd} -%define daemon_nhrpd nhrpd -%else -%define daemon_nhrpd "" -%endif - %if %{with_pimd} %define daemon_pimd pimd %else %define daemon_pimd "" %endif +%if %{with_nhrpd} +%define daemon_nhrpd nhrpd +%else +%define daemon_nhrpd "" +%endif + %if %{with_watchfrr} %define daemon_watchfrr watchfrr %else @@ -557,13 +557,10 @@ rm -rf %{buildroot} %endif %changelog -* Tue Feb 14 2017 Timo Teräs - %{version} -- add nhrpd +* Mon Jun 5 2017 Martin Winter - %{version} +- added NHRP daemon -* Fri Jan 6 2017 Martin Winter - %{version} -* Thu Apr 13 2017 Martin Winter - %{version} -* Thu Apr 17 2017 Martin Winter - %{version} -* Mon Apr 17 2017 Martin Winter - %{version} +* Thu Apr 17 2017 Martin Winter - new subpackage frr-pythontools with python 2.7 restart script - remove PIMd from CentOS/RedHat 6 RPM packages (won't work - too old) - converted to single frr init script (not per daemon) based on debian init script