diff --git a/src/usr/local/pkg/frr/frr_bgp_cacheservers.xml b/src/usr/local/pkg/frr/frr_bgp_cacheservers.xml
new file mode 100644
index 000000000000..df62c8f5cbcc
--- /dev/null
+++ b/src/usr/local/pkg/frr/frr_bgp_cacheservers.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
+<packagegui>
+	<copyright>
+	<![CDATA[
+/*
+ * frr_bgp_communities.xml
+ *
+ * part of pfSense (https://www.pfsense.org)
+ * Copyright (c) 2012-2015 Rubicon Communications, LLC (Netgate)
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+	]]>
+	</copyright>
+	<name>frr_bgp_cacheservers</name>
+	<title>Services/FRR/BGP</title>
+	<include_file>/usr/local/pkg/frr.inc</include_file>
+	<aftersaveredirect>pkg.php?xml=frr/frr_bgp_cacheservers.xml</aftersaveredirect>
+	<tabs>
+		<tab>
+			<text>BGP</text>
+			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
+		</tab>
+		<tab>
+			<text>Advanced</text>
+			<url>pkg_edit.php?xml=frr/frr_bgp_advanced.xml</url>
+		</tab>
+		<tab>
+			<text>Neighbors</text>
+			<url>pkg.php?xml=frr/frr_bgp_neighbors.xml</url>
+		</tab>
+		<tab>
+			<text>AS Paths</text>
+			<url>pkg.php?xml=frr/frr_bgp_aspaths.xml</url>
+		</tab>
+		<tab>
+			<text>Communities</text>
+			<url>pkg.php?xml=frr/frr_bgp_communities.xml</url>
+		</tab>
+		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+			<active/>
+		</tab>
+		<tab>
+			<text>[Global Settings]</text>
+			<url>pkg_edit.php?xml=frr.xml</url>
+		</tab>
+		<tab>
+			<text>[OSPF]</text>
+			<url>pkg_edit.php?xml=frr/frr_ospf.xml</url>
+		</tab>
+		<tab>
+			<text>[OSPF6]</text>
+			<url>pkg_edit.php?xml=frr/frr_ospf6.xml</url>
+		</tab>
+		<tab>
+			<text>Status</text>
+			<url>/status_frr.php</url>
+		</tab>
+	</tabs>
+	<adddeleteeditpagefields>
+		<columnitem>
+			<fielddescr>Name</fielddescr>
+			<fieldname>name</fieldname>
+		</columnitem>
+		<columnitem>
+			<fielddescr>Host</fielddescr>
+			<fieldname>host</fieldname>
+		</columnitem>
+		<columnitem>
+			<fielddescr>Description</fielddescr>
+			<fieldname>descr</fieldname>
+		</columnitem>
+	</adddeleteeditpagefields>
+	<fields>
+		<field>
+			<fielddescr>Name</fielddescr>
+			<fieldname>name</fieldname>
+			<description>
+				<![CDATA[
+				The name of this RPKI cache server.
+				]]>
+			</description>
+			<type>input</type>
+			<size>20</size>
+			<required/>
+		</field>
+		<field>
+			<fielddescr>Description</fielddescr>
+			<fieldname>descr</fieldname>
+			<size>50</size>
+			<type>input</type>
+		</field>
+		<field>
+			<fielddescr>Host</fielddescr>
+			<fieldname>host</fieldname>
+			<description>
+				<![CDATA[
+				The host or IP address for this cache server.
+				]]>
+			</description>
+			<size>50</size>
+			<type>input</type>
+			<combinefields>begin</combinefields>
+		</field>
+		<field>
+			<fielddescr>Port</fielddescr>
+			<fieldname>port</fieldname>
+			<description>
+				<![CDATA[
+				The port for this cache server.
+				]]>
+			</description>
+			<size>6</size>
+			<type>input</type>
+			<combinefields>end</combinefields>
+		</field>
+		<field>
+			<fielddescr>Preference</fielddescr>
+			<fieldname>preference</fieldname>
+			<description>
+				<![CDATA[
+				The internal preference for this cache server. Lower preference cache servers are queried first.
+				]]>
+			</description>
+			<size>6</size>
+			<type>input</type>
+		</field>
+		<field>
+			<name>SSH</name>
+			<type>listtopic</type>
+		</field>
+		<field>
+			<fielddescr>Enable</fielddescr>
+			<fieldname>sshenable</fieldname>
+			<description>Connect as SSH client</description>
+			<type>checkbox</type>
+		</field>
+		<field>
+			<fielddescr>Username</fielddescr>
+			<fieldname>sshusername</fieldname>
+			<description>
+				<![CDATA[
+				The username to use when authenticating via SSH.
+				]]>
+			</description>
+			<size>100</size>
+			<type>input</type>
+		</field>
+		<field>
+			<fielddescr>Public Key File</fielddescr>
+			<fieldname>sshpublickey</fieldname>
+			<description>
+				<![CDATA[
+				The public key path for the SSH channel (e.g. id_rsa.pub).
+				]]>
+			</description>
+			<size>100</size>
+			<type>input</type>
+		</field>
+		<field>
+			<fielddescr>Private Key File</fielddescr>
+			<fieldname>sshprivatekey</fieldname>
+			<description>
+				<![CDATA[
+				The private key path for the SSH channel (e.g. id_rsa).
+				]]>
+			</description>
+			<size>100</size>
+			<type>input</type>
+		</field>
+	</fields>
+	<custom_php_resync_config_command>
+		frr_generate_config();
+	</custom_php_resync_config_command>
+</packagegui>
diff --git a/src/etc/inc/priv/frr.priv.inc b/src/etc/inc/priv/frr.priv.inc
index 70d83c47a08a..c32846484a54 100644
--- a/src/etc/inc/priv/frr.priv.inc
+++ b/src/etc/inc/priv/frr.priv.inc
@@ -29,6 +29,7 @@ $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp_advan
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp_aspaths.xml*";
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp_communities.xml*";
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp_neighbors.xml*";
+$priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp_cacheservers.xml*";
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_bgp.xml*";
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_global_acls.xml*";
 $priv_list['page-services-frr']['match'][] = "pkg_edit.php?xml=frr/frr_global_prefixes.xml*";
diff --git a/src/usr/local/pkg/frr.inc b/src/usr/local/pkg/frr.inc
index 743306fdc529..ded9588ee5bc 100644
--- a/src/usr/local/pkg/frr.inc
+++ b/src/usr/local/pkg/frr.inc
@@ -352,7 +352,7 @@ fi
 [ -s {$frr_config_base}/staticd.conf ] && /usr/local/sbin/staticd -d -f {$frr_config_base}/staticd.conf
 [ -s {$frr_config_base}/ospfd.conf ] && /usr/local/sbin/ospfd -d -f {$frr_config_base}/ospfd.conf
 [ -s {$frr_config_base}/ospf6d.conf ] && /usr/local/sbin/ospf6d -d -f {$frr_config_base}/ospf6d.conf
-[ -s {$frr_config_base}/bgpd.conf ] && /usr/local/sbin/bgpd -d -f {$frr_config_base}/bgpd.conf
+[ -s {$frr_config_base}/bgpd.conf ] && /usr/local/sbin/bgpd -d -f {$frr_config_base}/bgpd.conf -M rpki
 [ -s {$frr_config_base}/frr_md5pw_add.conf ] && /sbin/setkey -f {$frr_config_base}/frr_md5pw_add.conf
 
 EOF;
diff --git a/src/usr/local/pkg/frr/frr_bgp.xml b/src/usr/local/pkg/frr/frr_bgp.xml
index 8512e712f2a6..ba885b88ea77 100644
--- a/src/usr/local/pkg/frr/frr_bgp.xml
+++ b/src/usr/local/pkg/frr/frr_bgp.xml
@@ -29,7 +29,7 @@
 	<title>Services/FRR/BGP</title>
 	<include_file>/usr/local/pkg/frr.inc</include_file>
 	<aftersaveredirect>pkg_edit.php?xml=frr/frr_bgp.xml</aftersaveredirect>
-	<tabs>
+		<tabs>
 		<tab>
 			<text>BGP</text>
 			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
@@ -52,6 +52,10 @@
 			<url>pkg.php?xml=frr/frr_bgp_communities.xml</url>
 		</tab>
 		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+		</tab>
+		<tab>
 			<text>[Global Settings]</text>
 			<url>pkg_edit.php?xml=frr.xml</url>
 		</tab>
@@ -65,7 +69,7 @@
 		</tab>
 		<tab>
 			<text>Status</text>
-			<url>/status_frr.php?protocol=bgp</url>
+			<url>/status_frr.php</url>
 		</tab>
 	</tabs>
 	<fields>
diff --git a/src/usr/local/pkg/frr/frr_bgp_advanced.xml b/src/usr/local/pkg/frr/frr_bgp_advanced.xml
index fd00aa78b287..2eca1731565f 100644
--- a/src/usr/local/pkg/frr/frr_bgp_advanced.xml
+++ b/src/usr/local/pkg/frr/frr_bgp_advanced.xml
@@ -29,7 +29,7 @@
 	<title>Services/FRR/BGP</title>
 	<include_file>/usr/local/pkg/frr.inc</include_file>
 	<aftersaveredirect>pkg_edit.php?xml=frr/frr_bgp_advanced.xml</aftersaveredirect>
-	<tabs>
+		<tabs>
 		<tab>
 			<text>BGP</text>
 			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
@@ -52,6 +52,10 @@
 			<url>pkg.php?xml=frr/frr_bgp_communities.xml</url>
 		</tab>
 		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+		</tab>
+		<tab>
 			<text>[Global Settings]</text>
 			<url>pkg_edit.php?xml=frr.xml</url>
 		</tab>
@@ -392,6 +396,35 @@
 			<description>Number of packets to write to peer socket per run (1-10000)</description>
 			<type>input</type>
 		</field>
+		
+		<field>
+			<name>RPKI</name>
+			<type>listtopic</type>
+		</field>
+		<field>
+			<fielddescr>Enable RPKI</fielddescr>
+			<fieldname>enablerpki</fieldname>
+			<description>Enable RPKI functionality in BGP.</description>
+			<type>checkbox</type>
+		</field>
+		<field>
+			<fielddescr>Log RPKI Events</fielddescr>
+			<fieldname>rpkilog</fieldname>
+			<description>Enable RPKI debug logging in the BGPD output.</description>
+			<type>checkbox</type>
+		</field>
+		<field>
+			<fielddescr>Polling Period</fielddescr>
+			<fieldname>rpkipollingperiod</fieldname>
+			<description>Cache server polling period, in seconds</description>
+			<type>input</type>
+		</field>
+		<field>
+			<fielddescr>Timeout</fielddescr>
+			<fieldname>rpkitimeout</fieldname>
+			<description>Cache server poll timeout, in seconds</description>
+			<type>input</type>
+		</field>
 	</fields>
 	<custom_php_resync_config_command>
 		frr_generate_config();
diff --git a/src/usr/local/pkg/frr/frr_bgp_aspaths.xml b/src/usr/local/pkg/frr/frr_bgp_aspaths.xml
index 3c88172b26d8..d02c69e9d019 100644
--- a/src/usr/local/pkg/frr/frr_bgp_aspaths.xml
+++ b/src/usr/local/pkg/frr/frr_bgp_aspaths.xml
@@ -29,7 +29,7 @@
 	<title>Services/FRR/BGP</title>
 	<include_file>/usr/local/pkg/frr.inc</include_file>
 	<aftersaveredirect>pkg.php?xml=frr/frr_bgp_aspaths.xml</aftersaveredirect>
-	<tabs>
+		<tabs>
 		<tab>
 			<text>BGP</text>
 			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
@@ -52,6 +52,10 @@
 			<url>pkg.php?xml=frr/frr_bgp_communities.xml</url>
 		</tab>
 		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+		</tab>
+		<tab>
 			<text>[Global Settings]</text>
 			<url>pkg_edit.php?xml=frr.xml</url>
 		</tab>
diff --git a/src/usr/local/pkg/frr/frr_bgp_communities.xml b/src/usr/local/pkg/frr/frr_bgp_communities.xml
index 6044c0fa39f1..31c4cf7258ad 100644
--- a/src/usr/local/pkg/frr/frr_bgp_communities.xml
+++ b/src/usr/local/pkg/frr/frr_bgp_communities.xml
@@ -29,7 +29,7 @@
 	<title>Services/FRR/BGP</title>
 	<include_file>/usr/local/pkg/frr.inc</include_file>
 	<aftersaveredirect>pkg.php?xml=frr/frr_bgp_communities.xml</aftersaveredirect>
-	<tabs>
+		<tabs>
 		<tab>
 			<text>BGP</text>
 			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
@@ -52,6 +52,10 @@
 			<active/>
 		</tab>
 		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+		</tab>
+		<tab>
 			<text>[Global Settings]</text>
 			<url>pkg_edit.php?xml=frr.xml</url>
 		</tab>
diff --git a/src/usr/local/pkg/frr/frr_bgp_neighbors.xml b/src/usr/local/pkg/frr/frr_bgp_neighbors.xml
index f95d73b1ab0f..6be83166bf2f 100644
--- a/src/usr/local/pkg/frr/frr_bgp_neighbors.xml
+++ b/src/usr/local/pkg/frr/frr_bgp_neighbors.xml
@@ -29,7 +29,7 @@
 	<title>Services/FRR/BGP</title>
 	<include_file>/usr/local/pkg/frr.inc</include_file>
 	<aftersaveredirect>pkg.php?xml=frr/frr_bgp_neighbors.xml</aftersaveredirect>
-	<tabs>
+		<tabs>
 		<tab>
 			<text>BGP</text>
 			<url>pkg_edit.php?xml=frr/frr_bgp.xml</url>
@@ -52,6 +52,10 @@
 			<url>pkg.php?xml=frr/frr_bgp_communities.xml</url>
 		</tab>
 		<tab>
+			<text>Cache Servers</text>
+			<url>pkg.php?xml=frr/frr_bgp_cacheservers.xml</url>
+		</tab>
+		<tab>
 			<text>[Global Settings]</text>
 			<url>pkg_edit.php?xml=frr.xml</url>
 		</tab>
diff --git a/src/usr/local/pkg/frr/frr_global_routemaps.xml b/src/usr/local/pkg/frr/frr_global_routemaps.xml
index da30307c0073..0218f28934cb 100644
--- a/src/usr/local/pkg/frr/frr_global_routemaps.xml
+++ b/src/usr/local/pkg/frr/frr_global_routemaps.xml
@@ -420,6 +420,23 @@
 			<size>1</size>
 		</field>
 		<field>
+			<name>BGP RPKI</name>
+			<type>listtopic</type>
+		</field>
+		<field>
+			<fielddescr>RPKI Validation Result</fielddescr>
+			<fieldname>rpki_result</fieldname>
+			<description>Match RPKI validation result</description>
+			<type>select</type>
+			<default_value>none</default_value>
+			<options>
+				<option><name>None (Do Nothing)</name><value>none</value></option>
+				<option><name>Invalid</name><value>invalid</value></option>
+				<option><name>Not Found</name><value>notfound</value></option>
+				<option><name>Valid</name><value>valid</value></option>
+			</options>
+		</field>
+		<field>
 			<name>Origin</name>
 			<type>listtopic</type>
 		</field>
diff --git a/src/usr/local/pkg/frr/inc/frr_bgp.inc b/src/usr/local/pkg/frr/inc/frr_bgp.inc
index c1de4120d9d1..af8817921c9f 100644
--- a/src/usr/local/pkg/frr/inc/frr_bgp.inc
+++ b/src/usr/local/pkg/frr/inc/frr_bgp.inc
@@ -120,6 +120,49 @@ function frr_get_neighbor_updatesource($source, $type) {
 	return "";
 }
 
+/* Generate BGP RPKI lines */
+function frr_bgp_generate_rpki() {
+	global $config, $frr_config_base;
+	/* Populate FRR BGP Advanced Settings */
+	if (is_array($config['installedpackages']['frrbgpadvanced']['config'])) {
+		$frr_bgpadv_conf = &$config['installedpackages']['frrbgpadvanced']['config'][0];
+	} else {
+		/* No BGP Advanced config, stop. */
+		return null;
+	}
+	
+	if (empty($frr_bgpadv_conf['enablerpki'])) {
+		return null;
+	}
+	
+	$rpkiconf = "# RPKI Config\n";
+	if (!empty($frr_bgpadv_conf['rpkilog'])) {
+		$rpkiconf .= "debug rpki\n";
+	}
+	
+	/* Populate RPKI Settings */
+	$rpkiconf .= "rpki\n";
+	if (!empty($frr_bgpadv_conf['rpkipollingperiod'])) {
+		$rpkiconf .= "  rpki polling_period {$frr_bgpadv_conf['rpkipollingperiod']}\n";
+	}
+	if (!empty($frr_bgpadv_conf['rpkitimeout'])) {
+		$rpkiconf .= "  rpki timeout {$frr_bgpadv_conf['rpkitimeout']}\n";
+	}
+	if (is_array($config['installedpackages']['frrbgpcacheservers']['config'])) {
+		$frr_cacheservers_conf = &$config['installedpackages']['frrbgpcacheservers']['config'];
+		foreach ($frr_cacheservers_conf as $cacheserver) {
+			if (empty($frr_bgpadv_conf['sshenable'])) {
+				$rpkiconf .= "  rpki cache {$cacheserver['host']} {$cacheserver['port']} preference {$cacheserver['preference']}\n";
+			} else {
+				$rpkiconf .= "  rpki cache {$cacheserver['host']} {$cacheserver['port']} {$cacheserver['sshusername']} {$cacheserver['port']} {$cacheserver['sshprivatekey']} {$cacheserver['sshpublickey']} preference {$cacheserver['preference']}\n";
+			}
+		}
+	}
+	$rpkiconf .= "  exit\n";
+
+	return $rpkiconf;
+}
+
 /* Generate BGP Router configuration lines */
 function frr_bgp_generate_router() {
 	global $config, $frr_config_base;
@@ -855,6 +898,8 @@ function frr_generate_config_bgp() {
 			$bgpdconffile .= "log syslog\n";
 		}
 
+		/* BGP RPKI Config */
+		$bgpdconffile .= frr_bgp_generate_rpki();
 		/* BGP Router Config */
 		$bgpdconffile .= frr_bgp_generate_router();
 		/* BGP Router Advanced Config */
diff --git a/src/usr/local/pkg/frr/inc/frr_zebra.inc b/src/usr/local/pkg/frr/inc/frr_zebra.inc
index 7b559655d6e1..30342c82b9a4 100644
--- a/src/usr/local/pkg/frr/inc/frr_zebra.inc
+++ b/src/usr/local/pkg/frr/inc/frr_zebra.inc
@@ -335,7 +335,17 @@ function frr_zebra_generate_routemaps() {
 		    ($rm['exitaction'] != "none")) {
 			$rmconf .= "  on-match goto {$rm['exitaction']}\n";
 		}
-
+		
+		/* RPKI */
+		switch ($rm['rpki_result']) {
+			case "invalid":
+			case "notfound":
+			case "valid":
+				$rmconf .= "  match rpki {$rm['rpki_result']}\n";
+				break;
+			default:
+		}
+		
 		/* Access List */
 		if (in_array($rm['acl_match'], frr_get_list_values(frr_get_accesslist_list())) &&
 		    ($rm['acl_match'] != "none")) {
