[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service
new file mode 100644
index 0000000..76f9f61
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=BGP routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/bgpd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/bgpd.pid
+ExecStart=@SBINDIR@/bgpd -d $bgpd_options -f @SYSCONFDIR@/quagga/bgpd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/bgpd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service
new file mode 100644
index 0000000..9bfe7b6
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=IS-IS routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/isisd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+ExecStart=@SBINDIR@/isisd -d $isisd_options -f /etc/quagga/isisd.conf
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service
new file mode 100644
index 0000000..a2e493b
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=OSPF routing daemon for IPv6
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ospf6d.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ospf6d.pid
+ExecStart=@SBINDIR@/ospf6d -d $ospf6d_options -f @SYSCONFDIR@/quagga/ospf6d.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ospf6d.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service
new file mode 100644
index 0000000..0c62cbc
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=OSPF routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ospfd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ospfd.pid
+ExecStart=@SBINDIR@/ospfd -d $ospfd_options -f @SYSCONFDIR@/quagga/ospfd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ospfd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default
new file mode 100644
index 0000000..4c4bc23
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default
@@ -0,0 +1,12 @@
+# If this option is set the /etc/init.d/quagga script automatically loads
+# the config via "vtysh -b" when the servers are started.
+vtysh_enable=yes
+
+# Bind all daemons to loopback only by default
+zebra_options=" --daemon -A 127.0.0.1"
+bgpd_options="  --daemon -A 127.0.0.1"
+ospfd_options=" --daemon -A 127.0.0.1"
+ospf6d_options="--daemon -A ::1"
+ripd_options="  --daemon -A 127.0.0.1"
+ripngd_options="--daemon -A ::1"
+isisd_options=" --daemon -A 127.0.0.1"
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init
new file mode 100644
index 0000000..df1beb7
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init
@@ -0,0 +1,200 @@
+#!/bin/sh
+#
+# /etc/init.d/quagga -- start/stop the Quagga routing daemons
+#
+# Based on debian version by Endre Hirling <endre@mail.elte.hu> and 
+# Christian Hammers <ch@debian.org>.
+#
+
+### BEGIN INIT INFO
+# Provides: quagga
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop the Quagga routing suite
+# Description: Quagga is a routing suite for IP routing protocols like 
+#              BGP, OSPF, RIP and others. This script contols the main 
+#              daemon "quagga" as well as the individual protocol daemons.
+### END INIT INFO
+
+# NOTE: sbin must be before bin so we get the iproute2 ip and not the
+# busybox ip command. The busybox one flushes all routes instead of just
+# the dynamic routes
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin
+D_PATH=/usr/sbin
+C_PATH=/etc/quagga
+
+# Keep zebra first and do not list watchquagga!
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd"
+
+# Print the name of the pidfile.
+pidfile()
+{
+	echo "/var/run/quagga/$1.pid"
+}
+
+# Check if daemon is started by using the pidfile.
+started()
+{
+	[ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0
+	return 1
+}
+
+# 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/Quagga.conf ]; then
+		/usr/bin/vtysh -b
+	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/Quagga.conf" ]; then
+	  return 0
+	fi 
+
+	# check for config file		  
+	if [ ! -r "$C_PATH/$1.conf" ]; then
+	  return 1
+	fi
+	return 0
+}
+
+# Starts the server if it's not alrady running according to the pid file.
+# The Quagga daemons creates the pidfile when starting.
+start()
+{
+	if ! check_daemon $1; then echo -n " (!$1)"; return; fi
+	echo -n " $1"
+	start-stop-daemon \
+		--start \
+		--pidfile=`pidfile $1` \
+		--exec "$D_PATH/$1" \
+		-- \
+		`eval echo "$""$1""_options"`
+		
+}
+
+# Stop the daemon given in the parameter, printing its name to the terminal.
+stop()
+{
+    if ! started "$1" ; then
+	echo -n " (!$1)"
+	return 0
+    else
+	PIDFILE=`pidfile $1`
+	PID=`cat $PIDFILE 2>/dev/null`
+	start-stop-daemon --stop --quiet --exec "$D_PATH/$1"
+	#
+	#       Now we have to wait until $DAEMON has _really_ stopped.
+	#
+	if test -n "$PID" && kill -0 $PID 2>/dev/null; then
+	    echo -n " (waiting) ."
+	    cnt=0
+	    while kill -0 $PID 2>/dev/null; do
+		cnt=`expr $cnt + 1`
+		if [ $cnt -gt 60 ]; then
+		    # Waited 120 secs now, fail.
+		    echo -n "Failed.. "
+		    break
+		fi
+		sleep 2
+		echo -n "."
+		done
+	    fi
+	echo -n " $1"
+	rm -f `pidfile $1`
+    fi
+}
+
+stop_all() 
+{
+	local daemon_list
+	daemon_list=${1:-$DAEMONS}
+
+	echo -n "Stopping Quagga daemons:"
+	for daemon_name in $daemon_list; do
+		stop "$daemon_name"
+	done
+	echo "."
+}
+
+start_all()
+{
+	local daemon_list
+	daemon_list=${1:-$DAEMONS}
+
+	echo -n "Starting Quagga daemons:"
+	for daemon_name in $daemon_list; do
+		start "$daemon_name"
+	done
+	echo "."
+}
+
+status_all() 
+{
+	local daemon_list
+	daemon_list=${1:-$DAEMONS}
+	res=1
+
+	echo -n "quagga: "
+	for daemon_name in $daemon_list; do
+	    if started "$daemon_name" ; then
+		id=`cat \`pidfile $daemon_name\``
+		echo -n "$daemon_name (pid $id) "
+		res=0
+	    fi
+	done
+	if [ $res -eq 0 ]; then
+	    echo "is running..."
+	else
+	    echo "is stopped..."
+	fi
+	exit $res
+}
+
+#########################################################
+# 		Main program 				#
+#########################################################
+
+# Load configuration
+test -f /etc/default/quagga && . /etc/default/quagga
+
+case "$1" in
+    start)
+	cd $C_PATH/
+	start_all $2
+	vtysh_b
+    	;;
+	
+    stop)
+  	stop_all $2
+	echo "Removing all routes made by zebra."
+	ip route flush proto zebra
+   	;;
+
+    status)
+  	status_all $2
+   	;;
+
+    restart|force-reload)
+	$0 stop $2
+	sleep 1
+	$0 start $2
+	;;
+
+    *)
+    	echo "Usage: /etc/init.d/quagga {start|stop|restart|status|force-reload} [daemon]"
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam
new file mode 100644
index 0000000..3541a97
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam
@@ -0,0 +1,13 @@
+#
+# The PAM configuration file for the quagga `vtysh' service
+#
+
+# This allows root to change user infomation without being
+# prompted for a password
+auth		sufficient	pam_rootok.so
+
+# The standard Unix authentication modules, used with
+# NIS (man nsswitch) as well as normal /etc/passwd and
+# /etc/shadow entries.
+auth       include      common-auth
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service
new file mode 100644
index 0000000..1d20389
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=RIP routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ripd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ripd.pid
+ExecStart=@SBINDIR@/ripd -d $ripd_options -f @SYSCONFDIR@/quagga/ripd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ripd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service
new file mode 100644
index 0000000..0355ad1
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=RIP routing daemon for IPv6
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ripngd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ripngd.pid
+ExecStart=@SBINDIR@/ripngd -d $ripngd_options -f @SYSCONFDIR@/quagga/ripngd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ripngd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
new file mode 100644
index 0000000..1f28c0b
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
@@ -0,0 +1,3 @@
+# <type> <owner> <group> <mode> <path> <linksource>
+d quagga quagga 0755 /var/run/quagga none
+d quagga quagga 0755 /var/log/quagga none
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default
new file mode 100644
index 0000000..2d601ec
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default
@@ -0,0 +1,12 @@
+# Watchquagga configuration
+#watch_daemons="zebra bgpd ospfd ospf6d ripd ripngd"
+watch_daemons="zebra"
+
+# To enable restarts when multiple daemons are being used, uncomment this line (but first be sure to edit
+# the WATCH_DAEMONS line to reflect the daemons you are actually using):
+#watch_options="-Az -b_ -r/etc/init.d/quagga_restart_%s -s/etc/init.d/quagga_start_%s -k/etc/init.d/quagga_stop_%s"
+
+# Since we are using one quagga daemon for now, use the following line. If using
+# multiple daemons, comment the line below and uncoment the line mentioned
+# above.
+watch_options="-z -b_ -r/etc/init.d/quagga_restart_%s"
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init
new file mode 100644
index 0000000..5ddd94a
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: watchquagga
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop the Quagga watchdog
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# Load configuration
+test -f /etc/default/watchquagga && . /etc/default/watchquagga
+
+# Check that there are daemons to be monitored.
+[ -z "$watch_daemons" ] && exit 0
+
+pidfile="/var/run/quagga/watchquagga.pid"
+
+case "$1" in
+    start)
+	echo -n "Starting quagga watchdog daemon: watchquagga"
+	start-stop-daemon --start \
+		--pidfile $pidfile \
+		--exec /usr/sbin/watchquagga \
+		-- -d $watch_options $watch_daemons
+	echo "."
+    	;;
+	
+    stop)
+	echo -n "Stopping quagga watchdog daemon: watchquagga"
+	start-stop-daemon --stop --quiet \
+		--pidfile $pidfile
+	echo "."
+	;;
+
+    status)
+	echo -n "watchquagga "
+	res=1
+	[ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null
+	if [ $? -eq 0 ]; then
+	    echo "(pid `cat $pidfile`) is running..."
+	    res=0
+	else
+	    echo "is stopped..."
+	fi
+	exit $res
+	;;
+
+    restart|force-reload)
+	$0 stop $2
+	sleep 1
+	$0 start $2
+	;;
+
+    *)
+	echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}"
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service
new file mode 100644
index 0000000..e4fb6c8
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNU Zebra routing manager
+Wants=network.target
+Before=network.target
+ConditionPathExists=@SYSCONFDIR@/quagga/zebra.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/zebra.pid
+ExecStartPre=@BASE_SBINDIR@/ip route flush proto zebra
+ExecStart=@SBINDIR@/zebra -d $zebra_options -f @SYSCONFDIR@/quagga/zebra.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/zebra.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc
new file mode 100644
index 0000000..dfd6aa7
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -0,0 +1,232 @@
+SUMMARY = "BGP/OSPF/RIP routing daemon"
+DESCRIPTION = "Quagga is a routing software suite, providing \
+implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
+Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
+Quagga is a fork of GNU Zebra which was developed by Kunihiro \
+Ishiguro. The Quagga tree aims to build a more involved community \
+around Quagga than the current centralised model of GNU Zebra."
+HOMEPAGE = "http://www.nongnu.org/quagga/"
+SECTION = "net"
+
+
+LICENSE = "GPL-2.0 & LGPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \
+                    file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c"
+
+DEPENDS = "readline ncurses perl-native c-ares"
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
+SNMP_CONF="${@bb.utils.contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
+
+# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
+RDEPENDS_${PN} += "iproute2"
+
+SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga/quagga-${PV}.tar.gz; \
+           file://quagga.init \
+           file://quagga.default \
+           file://watchquagga.init \
+           file://watchquagga.default \
+           file://volatiles.03_quagga \
+           file://quagga.pam \
+           file://bgpd.service \
+           file://isisd.service \
+           file://ospf6d.service \
+           file://ospfd.service \
+           file://ripd.service \
+           file://ripngd.service \
+           file://zebra.service \
+          "
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
+PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
+
+inherit autotools update-rc.d useradd systemd pkgconfig
+
+SYSTEMD_PACKAGES = "${PN} ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
+SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
+SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
+SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
+SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
+SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
+SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
+SYSTEMD_SERVICE_${PN} = "zebra.service"
+
+EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
+                --localstatedir=${localstatedir}/run/quagga \
+                --enable-exampledir=${docdir}/quagga/examples/ \
+                --enable-vtysh \
+                --enable-isisd \
+                ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \
+                --enable-ospfclient=yes \
+                --enable-multipath=64 \
+                --enable-user=quagga \
+                --enable-group=quagga \
+                --enable-vty-group=quaggavty \
+                --enable-configfile-mask=0640 \
+                --enable-logfile-mask=0640 \
+                --enable-rtadv \
+                --enable-linux24-tcp-md5 \
+                ap_cv_cc_pie=no \
+                ${SNMP_CONF}"
+
+CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
+
+do_install () {
+    # Install init script and default settings
+    install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
+    ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
+    install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
+    install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
+    install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
+    install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
+    install -m 0644 ${WORKDIR}/volatiles.03_quagga  ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
+
+    # Install sample configurations for the daemons
+    for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
+        install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
+    done
+
+    for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
+        touch ${D}${sysconfdir}/quagga/$f.conf
+    done
+    chown quagga:quaggavty ${D}${sysconfdir}/quagga
+    chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
+    chmod 750 ${D}${sysconfdir}/quagga
+    chmod 640 ${D}${sysconfdir}/quagga/*.conf
+
+    # Install quagga
+    oe_runmake install DESTDIR=${D} prefix=${prefix} \
+            sbindir=${sbindir} \
+            sysconfdir=${sysconfdir}/quagga \
+            localstatedir=${localstatedir}/run/quagga
+
+    # Fix hardcoded paths
+    sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
+    sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
+    sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
+    sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
+    sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
+
+    # For PAM
+    for feature in ${DISTRO_FEATURES}; do
+        if [ "$feature" = "pam" ]; then
+            install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
+            break
+        fi
+    done
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /var/run/quagga 0755 quagga quagga -" \
+        > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+    fi
+
+    # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
+        rm -rf ${D}${sysconfdir}/init.d/
+        rm -f ${D}${sysconfdir}/default/watchquagga
+    fi
+
+    install -d ${D}${systemd_unitdir}/system
+    for i in bgpd isisd ospf6d ospfd ripd ripngd zebra; do
+        install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
+    done
+    sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
+        -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+        -e 's,@SBINDIR@,${sbindir},g' \
+        -e 's,@base_bindir@,${base_bindir},g' \
+        -e 's,@localstatedir@,${localstatedir},g' \
+        -i ${D}${systemd_unitdir}/system/*.service
+}
+
+DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
+pkg_postinst_${PN} () {
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
+        if [ -n "$D" ]; then
+            OPTS="--root=$D"
+        fi
+        systemctl $OPTS mask quagga.service
+    fi
+}
+
+# Split into a main package and separate per-protocol packages
+PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-bgpd \
+                     ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
+                     ${PN}-ospfclient ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}"
+
+RDEPENDS_${PN} += "${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
+
+FILES_${PN}-ospfd       = "${sbindir}/ospfd ${libdir}/libospf.so.*"
+FILES_${PN}-ospf6d      = "${sbindir}/ospf6d"
+FILES_${PN}-bgpd        = "${sbindir}/bgpd"
+FILES_${PN}-ripd        = "${sbindir}/ripd"
+FILES_${PN}-ripngd      = "${sbindir}/ripngd"
+FILES_${PN}-isisd       = "${sbindir}/isisd"
+FILES_${PN}-ospfclient  = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
+FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
+                           ${sysconfdir}/init.d/watchquagga"
+
+# Indicate that the default files are configuration files
+CONFFILES_${PN} = "${sysconfdir}/default/quagga \
+                   ${sysconfdir}/quagga/bgpd.conf \
+                   ${sysconfdir}/quagga/vtysh.conf \
+                   ${sysconfdir}/quagga/isisd.conf \
+                   ${sysconfdir}/quagga/ospfd.conf \
+                   ${sysconfdir}/quagga/ripngd.conf \
+                   ${sysconfdir}/quagga/zebra.conf \
+                   ${sysconfdir}/quagga/ripd.conf \
+                   ${sysconfdir}/quagga/ospf6d.conf \
+                  "
+CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
+
+# Stop the names being rewritten due to the internal shared libraries
+DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
+DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
+
+# Main init script starts all deamons
+# Seperate init script for watchquagga
+INITSCRIPT_PACKAGES                     = "${PN} ${PN}-watchquagga"
+INITSCRIPT_NAME_${PN}                   = "quagga"
+INITSCRIPT_PARAMS_${PN}                 = "defaults 15 85"
+INITSCRIPT_NAME_${PN}-watchquagga       = "watchquagga"
+INITSCRIPT_PARAMS_${PN}-watchquagga     = "defaults 90 10"
+
+# Add quagga's user and group
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
+USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga -G quaggavty --shell /bin/false quagga"
+
+pkg_postinst_${PN} () {
+    if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
+        ${sysconfdir}/init.d/populate-volatile.sh update
+    fi
+}
+
+# Stop apps before uninstall
+pkg_prerm_${PN} () {
+    ${sysconfdir}/init.d/quagga stop
+}
+
+pkg_prerm_${PN}-ospfd () {
+    ${sysconfdir}/init.d/quagga stop ospfd
+}
+
+pkg_prerm_${PN}-ospf6d () {
+    ${sysconfdir}/init.d/quagga stop ospf6d
+}
+
+pkg_prerm_${PN}-bgpd () {
+    ${sysconfdir}/init.d/quagga stop bgpd
+}
+
+pkg_prerm_${PN}-ripd () {
+    ${sysconfdir}/init.d/quagga stop ripd
+}
+
+pkg_prerm_${PN}-ripngd () {
+    ${sysconfdir}/init.d/quagga stop ripngd
+}
+
+pkg_prerm_${PN}-isisd () {
+    ${sysconfdir}/init.d/quagga stop isisd
+}
diff --git a/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb
new file mode 100644
index 0000000..a7697a1
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb
@@ -0,0 +1,4 @@
+require quagga.inc
+
+SRC_URI[md5sum] = "eced21b054d71c9e1b7c6ac43286a166"
+SRC_URI[sha256sum] = "e364c082c3309910e1eb7b068bf39ee298e2f2f3f31a6431a5c115193bd653d3"