diff -urN openbgpd.orig/openbgpd.inc openbgpd/openbgpd.inc
--- openbgpd.orig/openbgpd.inc	2009-06-30 15:16:07.000000000 +0200
+++ openbgpd/openbgpd.inc	2009-06-30 17:41:24.000000000 +0200
@@ -34,97 +34,103 @@
 	
 	conf_mount_rw();
 	
-	if($config['installedpackages']['openbgpd']['config']) 
-		$openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0];
-	if($config['installedpackages']['openbgpd']['config'][0]['row'])
-		$openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row'];	
-	if($config['installedpackages']['openbgpdgroups']['config'])
-		$openbgpd_groups = &$config['installedpackages']['openbgpdgroups']['config'];
-	if($config['installedpackages']['openbgpdneighbors']['config'])
-		$openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config'];
-	
-	$fd = fopen("/usr/local/etc/bgpd.conf", "w");
-	
-	$conffile = "";
-	
-	// Setup AS #
-	if($openbgpd_conf['asnum']) 
-		$conffile .= "AS {$openbgpd_conf['asnum']}\n";
-	
-	// Setup holdtime if defined.  Default is 90.
-	if($openbgpd_conf['holdtime']) 
-		$conffile .= "holdtime {$openbgpd_conf['holdtime']}\n";
-
-	// Specify listen ip
-	if($openbgpd_conf['listenip']) 
-		$conffile .= "listen on {$openbgpd_conf['listenip']}\n";
+  if ($config['installedpackages']['openbgpd']['rawconfig'] && $config['installedpackages']['openbgpd']['rawconfig']['item']) {
+    // if there is a raw config specifyed in tthe config.xml use that instead of the assisted config
+    $conffile = implode("\n",$config['installedpackages']['openbgpd']['rawconfig']['item']);
+    //$conffile = $config['installedpackages']['openbgpd']['rawconfig'];
+  } else {
+    // generate bgpd.conf based on the assistant
+    if($config['installedpackages']['openbgpd']['config']) 
+      $openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0];
+    if($config['installedpackages']['openbgpd']['config'][0]['row'])
+      $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row'];	
+    if($config['installedpackages']['openbgpdgroups']['config'])
+      $openbgpd_groups = &$config['installedpackages']['openbgpdgroups']['config'];
+    if($config['installedpackages']['openbgpdneighbors']['config'])
+      $openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config'];
+    
+    $conffile = "# This file was created by the pfSense package manager.  Do not edit!\n\n";
+    
+    // Setup AS #
+    if($openbgpd_conf['asnum']) 
+      $conffile .= "AS {$openbgpd_conf['asnum']}\n";
+    
+    // Setup holdtime if defined.  Default is 90.
+    if($openbgpd_conf['holdtime']) 
+      $conffile .= "holdtime {$openbgpd_conf['holdtime']}\n";
+
+    // Specify listen ip
+    if($openbgpd_conf['listenip']) 
+      $conffile .= "listen on {$openbgpd_conf['listenip']}\n";
+
+    // Specify router id
+    if($openbgpd_conf['routerid']) 
+      $conffile .= "router-id {$openbgpd_conf['routerid']}\n";
+
+    // Handle advertised networks
+    if($config['installedpackages']['openbgpd']['config'][0]['row'])
+      if(is_array($openbgpd_rows))
+        foreach($openbgpd_rows as $row) 
+          $conffile .= "network {$row['networks']}\n";
+    
+    // Attach neighbors to their respective group owner
+    if(is_array($openbgpd_groups)) {	
+      foreach($openbgpd_groups as $group) {
+        $conffile .= "group \"{$group['name']}\" {\n";
+        $conffile .= "	remote-as {$group['remoteas']}\n";
+        if(is_array($openbgpd_neighbors)) {
+          foreach($openbgpd_neighbors as $neighbor) {
+            if($neighbor['groupname'] == $group['name']) {
+              $conffile .= "	neighbor {$neighbor['neighbor']} {\n";
+              $conffile .= "		descr \"{$neighbor['descr']}\"\n";
+              if($neighbor['md5sigpass']) 
+                $conffile .= "		tcp md5sig password {$neighbor['md5sigpass']}\n";
+              if($neighbor['md5sigkey']) 
+                          $conffile .= "		tcp md5sig key {$neighbor['md5sigkey']}\n";						
+              foreach($neighbor['row'] as $row) {
+                $conffile .= "		{$row['paramaters']} {$row['parmvalue']} \n";
+              }		
+              $conffile .= "	}\n";
+            }
+          }
+        }
+        $conffile .= "}\n";
+      }
+    }	
+
+    // Handle neighbors that do not have a group assigned to them	
+    if(is_array($openbgpd_neighbors)) {
+      foreach($openbgpd_neighbors as $neighbor) {
+        $used_this_item = false;
+        if($neighbor['groupname'] == "") {
+          $conffile .= "	neighbor {$neighbor['neighbor']} {\n";
+          $conffile .= "		descr \"{$neighbor['descr']}\"\n";
+          $used_this_item = true;
+          foreach($neighbor['row'] as $row) {
+            $conffile .= "		{$row['paramaters']} {$row['parmvalue']} \n";
+          }
+          if($used_this_item)		
+            $conffile .= "	}\n";
+        }
+      }
+      if($used_this_item)
+        $conffile .= "}\n";
+    }	
+    
+    // OpenBGPD filters
+    $conffile .= "deny from any\n";
+    $conffile .= "deny to any\n";
+    if(is_array($openbgpd_neighbors)) {
+      foreach($openbgpd_neighbors as $neighbor) {
+        $conffile .= "allow from {$neighbor['neighbor']}\n";
+        $conffile .= "allow to {$neighbor['neighbor']}\n";	
+      }
+    }
+  }
 
-	// Specify router id
-	if($openbgpd_conf['routerid']) 
-		$conffile .= "router-id {$openbgpd_conf['routerid']}\n";
-
-	// Handle advertised networks
-	if($config['installedpackages']['openbgpd']['config'][0]['row'])
-		if(is_array($openbgpd_rows))
-			foreach($openbgpd_rows as $row) 
-				$conffile .= "network {$row['networks']}\n";
+  $fd = fopen("/usr/local/etc/bgpd.conf", "w");
 	
-	// Attach neighbors to their respective group owner
-	if(is_array($openbgpd_groups)) {	
-		foreach($openbgpd_groups as $group) {
-			$conffile .= "group \"{$group['name']}\" {\n";
-			$conffile .= "	remote-as {$group['remoteas']}\n";
-			if(is_array($openbgpd_neighbors)) {
-				foreach($openbgpd_neighbors as $neighbor) {
-					if($neighbor['groupname'] == $group['name']) {
-						$conffile .= "	neighbor {$neighbor['neighbor']} {\n";
-						$conffile .= "		descr \"{$neighbor['descr']}\"\n";
-						if($neighbor['md5sigpass']) 
-							$conffile .= "		tcp md5sig password {$neighbor['md5sigpass']}\n";
-						if($neighbor['md5sigkey']) 
-		                   	$conffile .= "		tcp md5sig key {$neighbor['md5sigkey']}\n";						
-						foreach($neighbor['row'] as $row) {
-							$conffile .= "		{$row['paramaters']} {$row['parmvalue']} \n";
-						}		
-						$conffile .= "	}\n";
-					}
-				}
-			}
-			$conffile .= "}\n";
-		}
-	}	
-
-	// Handle neighbors that do not have a group assigned to them	
-	if(is_array($openbgpd_neighbors)) {
-		foreach($openbgpd_neighbors as $neighbor) {
-			$used_this_item = false;
-			if($neighbor['groupname'] == "") {
-				$conffile .= "	neighbor {$neighbor['neighbor']} {\n";
-				$conffile .= "		descr \"{$neighbor['descr']}\"\n";
-				$used_this_item = true;
-				foreach($neighbor['row'] as $row) {
-					$conffile .= "		{$row['paramaters']} {$row['parmvalue']} \n";
-				}
-				if($used_this_item)		
-					$conffile .= "	}\n";
-			}
-		}
-		if($used_this_item)
-			$conffile .= "}\n";
-	}	
-	
-	// OpenBGPD filters
-	$conffile .= "deny from any\n";
-	$conffile .= "deny to any\n";
-	if(is_array($openbgpd_neighbors)) {
-		foreach($openbgpd_neighbors as $neighbor) {
-			$conffile .= "allow from {$neighbor['neighbor']}\n";
-			$conffile .= "allow to {$neighbor['neighbor']}\n";	
-		}
-	}
-
-	// Write out the configuration file
-	fwrite($fd, "# This file was created by the pfSense package manager.  Do not edit!\n\n");	
+  // Write out the configuration file
 	fwrite($fd, $conffile);
 	
 	// Close file handle
@@ -150,6 +156,23 @@
 	conf_mount_ro();
 }
 
+// get the raw openbgpd confi file for manual inspection/editing
+function openbgpd_get_raw_config() {
+  return file_get_contents("/usr/local/etc/bgpd.conf");
+}
+
+// serialize the raw openbgpd confi file to config.xml
+function openbgpd_put_raw_config($conffile) {
+  global $config;
+  if ($conffile == "")
+    unset($config['installedpackages']['openbgpd']['rawconfig']);
+  else {
+    $config['installedpackages']['openbgpd']['rawconfig'] = array();
+    $config['installedpackages']['openbgpd']['rawconfig']['item'] = explode("\n",$_POST['openbgpd_raw']);
+    //$config['installedpackages']['openbgpd']['rawconfig'] = $conffile;
+  }
+}
+
 function deinstall_openbgpd() {
 	exec("rm /usr/local/etc/rc.d/bgpd.sh");
 	exec("rm /usr/local/www/openbgpd_status.php");
@@ -220,4 +243,4 @@
 		return false;
 }
 
-?>
\ No newline at end of file
+?>
diff -urN openbgpd.orig/openbgpd.xml openbgpd/openbgpd.xml
--- openbgpd.orig/openbgpd.xml	2009-06-30 15:16:27.000000000 +0200
+++ openbgpd/openbgpd.xml	2009-06-30 16:01:56.000000000 +0200
@@ -56,6 +56,11 @@
 		<item>http://www.pfsense.com/packages/config/openbgpd/openbgpd_status.php</item>
 	</additional_files_needed>
 	<additional_files_needed>
+		<prefix>/usr/local/www/</prefix>
+		<chmod>077</chmod>
+		<item>http://www.pfsense.com/packages/config/openbgpd/openbgpd_raw.php</item>
+	</additional_files_needed>
+	<additional_files_needed>
 		<prefix>/usr/local/pkg/</prefix>
 		<chmod>077</chmod>
 		<item>http://www.pfsense.com/packages/config/openbgpd/openbgpd.inc</item>
@@ -91,6 +96,10 @@
 			<url>/pkg.php?xml=openbgpd_groups.xml&amp;id=0</url>
 		</tab>
 		<tab>
+			<text>Raw config</text>
+			<url>/openbgpd_raw.php</url>
+		</tab>
+		<tab>
 			<text>Status</text>
 			<url>/openbgpd_status.php</url>
 		</tab>
diff -urN openbgpd.orig/openbgpd_groups.xml openbgpd/openbgpd_groups.xml
--- openbgpd.orig/openbgpd_groups.xml	2009-06-30 15:16:16.000000000 +0200
+++ openbgpd/openbgpd_groups.xml	2009-06-30 16:02:38.000000000 +0200
@@ -59,7 +59,11 @@
 			<url>/pkg.php?xml=openbgpd_groups.xml</url>
 			<active/>
 		</tab>
-		<tab>
+    <tab>
+      <text>Raw config</text>
+      <url>/openbgpd_raw.php</url>
+      </tab>
+    <tab>
 			<text>Status</text>
 			<url>/openbgpd_status.php</url>
 		</tab>
diff -urN openbgpd.orig/openbgpd_neighbors.xml openbgpd/openbgpd_neighbors.xml
--- openbgpd.orig/openbgpd_neighbors.xml	2009-06-30 15:15:31.000000000 +0200
+++ openbgpd/openbgpd_neighbors.xml	2009-06-30 16:03:06.000000000 +0200
@@ -60,6 +60,10 @@
 			<url>/pkg.php?xml=openbgpd_groups.xml</url>
 		</tab>
 		<tab>
+			<text>Raw config</text>
+			<url>/openbgpd_raw.php</url>
+		</tab>
+		<tab>
 			<text>Status</text>
 			<url>/openbgpd_status.php</url>
 		</tab>
@@ -176,4 +180,4 @@
 	<custom_php_after_form_command>
 		grey_out_value_boxes();
 	</custom_php_after_form_command>
-</packagegui>
\ No newline at end of file
+</packagegui>
diff -urN openbgpd.orig/openbgpd_raw.php openbgpd/openbgpd_raw.php
--- openbgpd.orig/openbgpd_raw.php	1970-01-01 01:00:00.000000000 +0100
+++ openbgpd/openbgpd_raw.php	2009-06-30 16:29:17.000000000 +0200
@@ -0,0 +1,92 @@
+<?php
+/* $Id$ */
+/*
+	openbgpd_raw.php
+	part of pfSense (http://www.pfsense.com/)
+    Copyright (C) 2009 Aarno Aukia (aarnoaukia@gmail.com)
+	All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions are met:
+
+	1. Redistributions of source code must retain the above copyright notice,
+	   this list of conditions and the following disclaimer.
+
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+
+	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+require("openbgpd.inc");
+
+if (isset($_POST['openbgpd_raw'])) {
+  openbgpd_put_raw_config($_POST['openbgpd_raw']);
+  write_config();
+  openbgpd_install_conf();
+}
+
+$openbgpd_raw = openbgpd_get_raw_config();
+
+$pgtitle = "OpenBGPD: raw config";
+include("head.inc");
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></font></p>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<?php
+	$tab_array = array();
+	$tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=openbgpd.xml&id=0");
+	$tab_array[] = array(gettext("Neighbors"), false, "/pkg.php?xml=openbgpd_neighbors.xml");
+	$tab_array[] = array(gettext("Groups"), false, "/pkg.php?xml=openbgpd_groups.xml");
+	$tab_array[] = array(gettext("Raw config"), true, "/openbgpd_raw.php");
+	$tab_array[] = array(gettext("Status"), true, "/openbgpd_status.php");
+	display_top_tabs($tab_array);
+?>
+</table>
+<form action="openbgpd_raw.php" method="post" name="iform" id="iform">
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+   <tr>
+    <td class="tabcont" >
+      You can edit the raw bgpd.conf here.<br>
+      Note: Once you click "Save" below, the assistant (in the "Settings", "Neighbors" and "Groups" tabs above) will be overridden with whatever you type here. To get back the assisted config save this form below once with an empty input field.
+     </td>
+    </tr>
+   <tr>
+    <td class="tabcont" >
+      <textarea name="openbgpd_raw" rows="40" cols="80"><? echo $openbgpd_raw; ?></textarea>
+     </td>
+    </tr>
+  <tr>
+    <td>
+      <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" on
+      click="history.back()">
+    </td>
+  </tr>
+</table>
+
+</form>
+
+</div>
+
+<?php include("fend.inc"); ?>
+
+</body>
+</html>
diff -urN openbgpd.orig/openbgpd_status.php openbgpd/openbgpd_status.php
--- openbgpd.orig/openbgpd_status.php	2009-06-30 15:16:38.000000000 +0200
+++ openbgpd/openbgpd_status.php	2009-06-30 16:03:38.000000000 +0200
@@ -120,6 +120,7 @@
 	$tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=openbgpd.xml&id=0");
 	$tab_array[] = array(gettext("Neighbors"), false, "/pkg.php?xml=openbgpd_neighbors.xml");
 	$tab_array[] = array(gettext("Groups"), false, "/pkg.php?xml=openbgpd_groups.xml");
+	$tab_array[] = array(gettext("Raw config"), true, "/openbgpd_raw.php");
 	$tab_array[] = array(gettext("Status"), true, "/openbgpd_status.php");
 	display_top_tabs($tab_array);
 ?>
