diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-12-27 14:02:33 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-27 14:02:33 -0500 | 
| commit | 9378b564816717b77799fc81894a1650bc5912b2 (patch) | |
| tree | 8abcc8f695cf7ae0974145b84a6112ae32cef3ec | |
| parent | 0dac58c01213735cda11e10c98f0734b9dc02310 (diff) | |
| parent | 6c24d792868de2d4ced70d0b36e079c966ec66dc (diff) | |
Merge pull request #3536 from opensourcerouting/6.0-kill-backports
6.0 fixes from package testing
| -rw-r--r-- | debian/control | 1 | ||||
| -rw-r--r-- | debian/frr.postinst | 1 | ||||
| -rw-r--r-- | doc/developer/packaging-debian.rst | 22 | ||||
| -rw-r--r-- | tools/frrcommon.sh.in | 3 | ||||
| -rw-r--r-- | watchfrr/watchfrr.c | 49 | 
5 files changed, 54 insertions, 22 deletions
diff --git a/debian/control b/debian/control index 006554c5fd..022d296046 100644 --- a/debian/control +++ b/debian/control @@ -27,6 +27,7 @@ Build-Depends:   libsystemd-dev <!pkg.frr.nosystemd>,   pkg-config,   python3, + python3-dev,   python3-sphinx,   python3-pytest <!nocheck>,   texinfo (>= 4.7) diff --git a/debian/frr.postinst b/debian/frr.postinst index a6dff333aa..dac2fa0f05 100644 --- a/debian/frr.postinst +++ b/debian/frr.postinst @@ -12,6 +12,7 @@ adduser \  	--ingroup frr \  	--home /nonexistent \  	--gecos "Frr routing suite" \ +	--no-create-home \  	frr  usermod -a -G frrvty frr diff --git a/doc/developer/packaging-debian.rst b/doc/developer/packaging-debian.rst index 55e35c332f..a5834a357f 100644 --- a/doc/developer/packaging-debian.rst +++ b/doc/developer/packaging-debian.rst @@ -10,17 +10,7 @@ buster.)        sudo apt install fakeroot debhelper devscripts -2. Install build dependencies using the  `mk-build-deps` tool from the -   `devscripts` package: - -   .. code-block:: shell - -      sudo mk-build-deps --install debianpkg/control - -   Alternatively, you can manually install build dependencies for your -   platform as outlined in :ref:`building`. - -3. Checkout FRR under an **unprivileged** user account: +2. Checkout FRR under an **unprivileged** user account:     .. code-block:: shell @@ -33,6 +23,16 @@ buster.)        git checkout <branch> +3. Install build dependencies using the  `mk-build-deps` tool from the +   `devscripts` package: + +   .. code-block:: shell + +      sudo mk-build-deps --install debian/control + +   Alternatively, you can manually install build dependencies for your +   platform as outlined in :ref:`building`. +  4. Run ``tools/tarsource.sh -V``:     .. code-block:: shell diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in index fa2fdc94b2..588aa6d103 100644 --- a/tools/frrcommon.sh.in +++ b/tools/frrcommon.sh.in @@ -85,6 +85,9 @@ daemon_list() {  		eval inst=\$${daemon}_instances  		[ "$daemon" = zebra -o "$daemon" = staticd ] && cfg=yes  		if [ -n "$cfg" -a "$cfg" != "no" -a "$cfg" != "0" ]; then +			if ! daemon_prep "$daemon" "$inst"; then +				continue +			fi  			debug "$daemon enabled"  			enabled="$enabled $daemon"  			if [ -n "$inst" ]; then diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 5230ec383f..7e75bed2d6 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -83,6 +83,7 @@ static const char *phase_str[] = {  };  #define PHASE_TIMEOUT (3*gs.restart_timeout) +#define STARTUP_TIMEOUT	55 * 1000  struct restart_info {  	const char *name; @@ -97,6 +98,7 @@ struct restart_info {  static struct global_state {  	restart_phase_t phase;  	struct thread *t_phase_hanging; +	struct thread *t_startup_timeout;  	const char *vtydir;  	long period;  	long timeout; @@ -630,23 +632,38 @@ static int handle_read(struct thread *t_read)   * Wait till we notice that all daemons are ready before   * we send we are ready to systemd   */ -static void daemon_send_ready(void) +static void daemon_send_ready(int exitcode)  { +	FILE *fp;  	static int sent = 0; -	if (!sent && gs.numdown == 0) { -		FILE *fp; +	if (sent) +		return; + +	if (exitcode == 0)  		zlog_notice("all daemons up, doing startup-complete notify"); -		frr_detach(); +	else if (gs.numdown < gs.numdaemons) +		flog_err(WATCHFRR_ERR_CONNECTION, +			 "startup did not complete within timeout" +			 " (%d/%d daemons running)", +			 gs.numdaemons - gs.numdown, gs.numdaemons); +	else { +		flog_err(WATCHFRR_ERR_CONNECTION, +			 "all configured daemons failed to start" +			 " -- exiting watchfrr"); +		exit(exitcode); + +	} -		fp = fopen(DAEMON_VTY_DIR "/watchfrr.started", "w"); -		if (fp) -			fclose(fp); +	frr_detach(); + +	fp = fopen(DAEMON_VTY_DIR "/watchfrr.started", "w"); +	if (fp) +		fclose(fp);  #if defined HAVE_SYSTEMD -		systemd_send_started(master, 0); +	systemd_send_started(master, 0);  #endif -		sent = 1; -	} +	sent = 1;  }  static void daemon_up(struct daemon *dmn, const char *why) @@ -655,7 +672,8 @@ static void daemon_up(struct daemon *dmn, const char *why)  	gs.numdown--;  	dmn->connect_tries = 0;  	zlog_notice("%s state -> up : %s", dmn->name, why); -	daemon_send_ready(); +	if (gs.numdown == 0) +		daemon_send_ready(0);  	SET_WAKEUP_ECHO(dmn);  	phase_check();  } @@ -1030,6 +1048,12 @@ static char *translate_blanks(const char *cmd, const char *blankstr)  	return res;  } +static int startup_timeout(struct thread *t_wakeup) +{ +	daemon_send_ready(1); +	return 0; +} +  static void watchfrr_init(int argc, char **argv)  {  	const char *special = "zebra"; @@ -1037,6 +1061,9 @@ static void watchfrr_init(int argc, char **argv)  	struct daemon *dmn, **add = &gs.daemons;  	char alldaemons[512] = "", *p = alldaemons; +	thread_add_timer_msec(master, startup_timeout, NULL, STARTUP_TIMEOUT, +			      &gs.t_startup_timeout); +  	for (i = optind; i < argc; i++) {  		dmn = XCALLOC(MTYPE_WATCHFRR_DAEMON, sizeof(*dmn));  | 
