--- /dev/null
+Origin: commit:2e4dc0a9a116a39aaa7e4d445c95447aad4c0697
+Author: David Lamparter <equinox@diac24.net>
+Subject: vtysh: fix pager compatibility handling
+Last-Update: 2019-01-25
+
+I just straight up forgot checking VTYSH_PAGER at startup, and the
+"terminal paginate" command is only installed to VIEW_NODE so it can't
+be processed from vtysh.conf in CONFIG_NODE...
+
+diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
+index 2a3b74cdb10f..8f998f84d203 100644
+--- a/vtysh/vtysh.c
++++ b/vtysh/vtysh.c
+@@ -104,7 +104,7 @@ static int vty_close_pager(struct vty *vty)
+ return 0;
+ }
+
+-static void vtysh_pager_envdef(void)
++static void vtysh_pager_envdef(bool fallback)
+ {
+ char *pager_defined;
+
+@@ -112,7 +112,7 @@ static void vtysh_pager_envdef(void)
+
+ if (pager_defined)
+ vtysh_pager_name = strdup(pager_defined);
+- else
++ else if (fallback)
+ vtysh_pager_name = strdup(VTYSH_PAGER);
+ }
+
+@@ -2858,7 +2858,7 @@ DEFUN (vtysh_terminal_paginate,
+ vtysh_pager_name = NULL;
+
+ if (strcmp(argv[0]->text, "no"))
+- vtysh_pager_envdef();
++ vtysh_pager_envdef(true);
+ return CMD_SUCCESS;
+ }
+
+@@ -2878,7 +2878,7 @@ DEFUN (vtysh_terminal_length,
+
+ if (!strcmp(argv[0]->text, "no") || !strcmp(argv[1]->text, "no")) {
+ /* "terminal no length" = use VTYSH_PAGER */
+- vtysh_pager_envdef();
++ vtysh_pager_envdef(true);
+ return CMD_SUCCESS;
+ }
+
+@@ -2887,7 +2887,7 @@ DEFUN (vtysh_terminal_length,
+ vty_out(vty,
+ "%% The \"terminal length\" command is deprecated and its value is ignored.\n"
+ "%% Please use \"terminal paginate\" instead with OS TTY length handling.\n");
+- vtysh_pager_envdef();
++ vtysh_pager_envdef(true);
+ }
+
+ return CMD_SUCCESS;
+@@ -3445,6 +3445,7 @@ void vtysh_init_vty(void)
+
+ /* set default output */
+ vty->of = stdout;
++ vtysh_pager_envdef(false);
+
+ /* Initialize commands. */
+ cmd_init(0);
+@@ -3773,6 +3774,7 @@ void vtysh_init_vty(void)
+ /* "write memory" command. */
+ install_element(ENABLE_NODE, &vtysh_write_memory_cmd);
+
++ install_element(CONFIG_NODE, &vtysh_terminal_paginate_cmd);
+ install_element(VIEW_NODE, &vtysh_terminal_paginate_cmd);
+ install_element(VIEW_NODE, &vtysh_terminal_length_cmd);
+ install_element(VIEW_NODE, &vtysh_terminal_no_length_cmd);
+--
+2.20.1
+
--- /dev/null
+Origin: commit:aea5145ffde23873ce4ef4ab2b54b2e24850fa8d
+Author: David Lamparter <equinox@opensourcerouting.org>
+Subject: watchfrr: build in defaults for -r/-s/-k
+Last-Update: 2019-01-25
+
+There's no good reason to not have these options default to the
+installation path of tools/watchfrr.sh. Doing so allows us to ditch
+watchfrr_options from daemons/daemons.conf completely.
+
+diff --git a/configure.ac b/configure.ac
+index 72747550dd86..85a0f97bb3d3 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -1974,6 +1974,7 @@ AC_SUBST(CFG_SBIN)
+ AC_SUBST(CFG_STATE)
+ AC_SUBST(CFG_MODULE)
+ AC_DEFINE_UNQUOTED(MODULE_PATH, "$CFG_MODULE", path to modules)
++AC_DEFINE_UNQUOTED(WATCHFRR_SH_PATH, "${CFG_SBIN%/}/watchfrr.sh", path to watchfrr.sh)
+
+ dnl ------------------------------------
+ dnl Enable RPKI and add librtr to libs
+diff --git a/tools/etc/frr/daemons b/tools/etc/frr/daemons
+index 9077606633e8..c40ebb598d72 100644
+--- a/tools/etc/frr/daemons
++++ b/tools/etc/frr/daemons
+@@ -53,7 +53,7 @@ staticd_options="-A 127.0.0.1"
+ bfdd_options=" -A 127.0.0.1"
+
+ # The list of daemons to watch is automatically generated by the init script.
+-watchfrr_options="-r '/usr/lib/frr/watchfrr.sh restart %s' -s '/usr/lib/frr/watchfrr.sh start %s' -k '/usr/lib/frr/watchfrr.sh stop %s'"
++#watchfrr_options=""
+
+ # for debugging purposes, you can specify a "wrap" command to start instead
+ # of starting the daemon directly, e.g. to use valgrind on ospfd:
+diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in
+index 588aa6d103e1..37abfeb30d2e 100644
+--- a/tools/frrcommon.sh.in
++++ b/tools/frrcommon.sh.in
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # This is a "library" of sorts for use by the other FRR shell scripts. It
+ # has most of the daemon start/stop logic, but expects the following shell
+@@ -288,6 +288,13 @@ load_old_config "$C_PATH/daemons.conf"
+ load_old_config "/etc/default/frr"
+ load_old_config "/etc/sysconfig/frr"
+
++if declare -p watchfrr_options | grep -q '^declare \-a'; then
++ log_warning_msg "watchfrr_options contains a bash array value." \
++ "The configured value is intentionally ignored since it is likely wrong." \
++ "Please remove or fix the setting."
++ unset watchfrr_options
++fi
++
+ #
+ # other defaults and dispatch
+ #
+diff --git a/tools/frrinit.sh.in b/tools/frrinit.sh.in
+index 3dddf5bd4484..0f5ed85864e7 100644
+--- a/tools/frrinit.sh.in
++++ b/tools/frrinit.sh.in
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ ### BEGIN INIT INFO
+ # Provides: frr
+diff --git a/tools/watchfrr.sh.in b/tools/watchfrr.sh.in
+index 3051d910448c..712f962a0ae5 100644
+--- a/tools/watchfrr.sh.in
++++ b/tools/watchfrr.sh.in
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # This is NOT the init script! This is the watchfrr start/stop/restart
+ # command handler, passed to watchfrr with the -s/-r/-k commands. It is used
+diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
+index 7e75bed2d6ed..757d10419a9c 100644
+--- a/watchfrr/watchfrr.c
++++ b/watchfrr/watchfrr.c
+@@ -53,6 +53,10 @@
+ #define DEFAULT_MIN_RESTART 60
+ #define DEFAULT_MAX_RESTART 600
+
++#define DEFAULT_RESTART_CMD WATCHFRR_SH_PATH " restart %s"
++#define DEFAULT_START_CMD WATCHFRR_SH_PATH " start %s"
++#define DEFAULT_STOP_CMD WATCHFRR_SH_PATH " stop %s"
++
+ #define PING_TOKEN "PING"
+
+ DEFINE_MGROUP(WATCHFRR, "watchfrr")
+@@ -124,6 +128,9 @@ static struct global_state {
+ .loglevel = DEFAULT_LOGLEVEL,
+ .min_restart_interval = DEFAULT_MIN_RESTART,
+ .max_restart_interval = DEFAULT_MAX_RESTART,
++ .restart_command = DEFAULT_RESTART_CMD,
++ .start_command = DEFAULT_START_CMD,
++ .stop_command = DEFAULT_STOP_CMD,
+ };
+
+ typedef enum {
+@@ -227,14 +234,17 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n",
+ -r, --restart Supply a Bourne shell command to use to restart a single\n\
+ daemon. The command string should include '%%s' where the\n\
+ name of the daemon should be substituted.\n\
++ (default: '%s')\n\
+ -s, --start-command\n\
+ Supply a Bourne shell to command to use to start a single\n\
+ daemon. The command string should include '%%s' where the\n\
+ name of the daemon should be substituted.\n\
++ (default: '%s')\n\
+ -k, --kill-command\n\
+ Supply a Bourne shell to command to use to stop a single\n\
+ daemon. The command string should include '%%s' where the\n\
+ name of the daemon should be substituted.\n\
++ (default: '%s')\n\
+ --dry Do not start or restart anything, just log.\n\
+ -p, --pid-file Set process identifier file name\n\
+ (default is %s/watchfrr.pid).\n\
+@@ -247,7 +257,9 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n",
+ -h, --help Display this help and exit\n",
+ frr_vtydir, DEFAULT_LOGLEVEL, LOG_EMERG, LOG_DEBUG, LOG_DEBUG,
+ DEFAULT_MIN_RESTART, DEFAULT_MAX_RESTART, DEFAULT_PERIOD,
+- DEFAULT_TIMEOUT, DEFAULT_RESTART_TIMEOUT, frr_vtydir);
++ DEFAULT_TIMEOUT, DEFAULT_RESTART_TIMEOUT,
++ DEFAULT_RESTART_CMD, DEFAULT_START_CMD, DEFAULT_STOP_CMD,
++ frr_vtydir);
+ }
+
+ static pid_t run_background(char *shell_cmd)
+--
+2.20.1
+