diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/index.cgi SDK.UBNT.v4.0.1.4978/apps/web/common/index.cgi
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/index.cgi	2011-08-19 15:41:37.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/index.cgi	2012-05-23 21:43:08.000000000 +0200
@@ -88,6 +88,14 @@
 			addOption(o, '<? echo dict_translate("Show Port Forward..."); >', 'pfw.cgi');
 			addOption(o, '<? echo dict_translate("Show DHCP Leases..."); >', 'leases.cgi');
 		}
+    if('<? echo cfg_get_def($cfg, "olsrd.status", "disabled"); >'=='enabled') {
+			addOption(o, '<? echo dict_translate("Show OLSR Neighbors..."); >', 'solsr.cgi?olsrview=neigh');
+			addOption(o, '<? echo dict_translate("Show OLSR Links..."); >', 'solsr.cgi?olsrview=link');
+			addOption(o, '<? echo dict_translate("Show OLSR Topology..."); >', 'solsr.cgi?olsrview=topo');
+			addOption(o, '<? echo dict_translate("Show OLSR MID..."); >', 'solsr.cgi?olsrview=mid');
+			addOption(o, '<? echo dict_translate("Show OLSR HNA..."); >', 'solsr.cgi?olsrview=hna');
+			addOption(o, '<? echo dict_translate("Show OLSR Routes..."); >', 'solsr.cgi?olsrview=route');
+    }
 		selectOption(o,'');
 	}
 	var o = document.getElementById('tools');
@@ -351,6 +359,12 @@
 	       	<option value="fw.cgi?netmode=<? echo $netmode;>"><? echo dict_translate("Show Firewall..."); ></option>
 		<option value="fw.cgi"><? echo dict_translate("Show Port Forward..."); ></option>
 		<option value="leases.cgi"><? echo dict_translate("Show DHCP Leases..."); ></option>
+		<option value="solsr.cgi?olsrview=neigh"><? echo dict_translate("Show OLSR Neighbors..."); ></option>
+		<option value="solsr.cgi?olsrview=link"><? echo dict_translate("Show OLSR Links..."); ></option>
+		<option value="solsr.cgi?olsrview=topo"><? echo dict_translate("Show OLSR Topology..."); ></option>
+		<option value="solsr.cgi?olsrview=mid"><? echo dict_translate("Show OLSR MID..."); ></option>
+		<option value="solsr.cgi?olsrview=hna"><? echo dict_translate("Show OLSR HNA..."); ></option>
+		<option value="solsr.cgi?olsrview=route"><? echo dict_translate("Show OLSR Routes..."); ></option>
 	  </select></td>
 		  <td>&nbsp;</td>
 		  <td class="h">&nbsp;</td>
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/link.inc SDK.UBNT.v4.0.1.4978/apps/web/common/lib/link.inc
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/link.inc	2011-07-22 16:48:19.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/lib/link.inc	2012-05-23 21:43:08.000000000 +0200
@@ -1009,10 +1009,16 @@
 );
 
 Function cfg_get_ipv4gw $cfg, $iface, $gw (
-        if (!strlen($gw)) {
-                $gw = "0.0.0.0";
-        }
-        return cfg_get_def($cfg, "route.1.gateway", $gw);
+  $status = "disabled";
+  $status = cfg_get_def($cfg, "route.1.status", $status);
+  if($status == "enabled")
+  {
+    if (!strlen($gw)) {
+      $gw = "0.0.0.0";
+    }
+    return cfg_get_def($cfg, "route.1.gateway", $gw);
+  }
+  return "";
 );
 
 Function cfg_get_dns $cfg, $dns (
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/netrouterap.tmpl SDK.UBNT.v4.0.1.4978/apps/web/common/lib/netrouterap.tmpl
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/netrouterap.tmpl	2011-03-15 11:30:02.000000000 +0100
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/lib/netrouterap.tmpl	2012-05-23 21:43:08.000000000 +0200
@@ -131,7 +131,7 @@
 	  	onClick="return openPage('ipalias.cgi?iface=<? echo $wan_iface;>',720,330);" /></td>
       </tr>
        <tr><td class="f"><strong><? echo dict_translate("Gateway IP:"); ></strong></td>
-	<td colspan="3"><input class="f" type="text" name="wangw" id="wangw" value="<?echo $wangw>" req="1" callback="validateWanIP" realname="<? echo dict_translate("LAN Gateway IP"); >"/></td>
+	<td colspan="3"><input class="f" type="text" name="wangw" id="wangw" value="<?echo $wangw>" req="1" callback="validateWlanOptIP" realname="<? echo dict_translate("LAN Gateway IP"); >"/></td>
       </tr>
        <tr><td class="f"><strong><? echo dict_translate("Primary DNS IP:"); ></strong></td>
 	<td colspan="3"><input class="f" type="text" name="dns1" id="dns1" value="<?echo $dns1>" req="1" callback="validateWanIP" realname="<? echo dict_translate("Primary DNS IP"); >"/></td>
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/netroutersta.tmpl SDK.UBNT.v4.0.1.4978/apps/web/common/lib/netroutersta.tmpl
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/netroutersta.tmpl	2011-03-15 11:30:02.000000000 +0100
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/lib/netroutersta.tmpl	2012-05-23 21:43:08.000000000 +0200
@@ -85,7 +85,7 @@
 	  	onClick="return openPage('ipalias.cgi?iface=<? echo $wan_iface;>',720,330);" /></td>
       </tr>
        <tr><td class="f"><strong><? echo dict_translate("Gateway IP:"); ></strong></td>
-	<td colspan="3"><input class="f" type="text" name="wangw" id="wangw" value="<?echo $wangw>" req="1" callback="validateWanIP" realname="<? echo dict_translate("WLAN Gateway IP"); >"/></td>
+	<td colspan="3"><input class="f" type="text" name="wangw" id="wangw" value="<?echo $wangw>" req="1" callback="validateWlanOptIP" realname="<? echo dict_translate("WLAN Gateway IP"); >"/></td>
       </tr>
        <tr><td class="f"><strong><? echo dict_translate("Primary DNS IP:"); ></strong></td>
 	<td colspan="3"><input class="f" type="text" name="dns1" id="dns1" value="<?echo $dns1>" req="1" callback="validateWanIP" realname="<? echo dict_translate("Primary DNS IP"); >"/></td>
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/services.tmpl SDK.UBNT.v4.0.1.4978/apps/web/common/lib/services.tmpl
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/lib/services.tmpl	2011-03-31 11:32:23.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/lib/services.tmpl	2012-05-23 21:43:08.000000000 +0200
@@ -21,6 +21,7 @@
                 telnetStatusClicked();
                 sshStatusClicked();
                 syslogStatusClicked();
+                olsrStatusClicked();
         }
         window.onload=init;
 </script>
@@ -270,6 +271,23 @@
 	</tr>
 	</table>
 	</form>
+
+	<form enctype="multipart/form-data" action="services.cgi" method="POST" onSubmit="return validateStandard(this, 'error');">
+	<table class="linktable" cellspacing="0"> 
+	<tr><th colspan="3"><? echo dict_translate("OLSRd"); ></th></tr>
+	<tr>
+	<td class="f"><strong><? echo dict_translate("Enable OLSRd:"); ></strong></td>
+	<td><input type="checkbox" name="olsr_status" value="enabled" id="olsr_status" <? if ($olsr_status=="enabled") { echo "checked"; }> onClick="olsrStatusClicked();"></td>
+	<td class="f">&nbsp;</td>
+	</tr>
+	<tr>
+	  <td class="f">&nbsp;<input type="hidden" name="action" value="cholsr"></td>
+	  <td><input type="submit" value="<? echo dict_translate("Change"); >">&nbsp;</td>
+	  <td class="f">&nbsp; </td>
+	</tr>
+	</table>
+	</form>
+
 <!-- we use default certificates
 	<form enctype="multipart/form-data" action="services.cgi" method="POST" onSubmit="return validateStandard(this, 'error');">
 	<table class="linktable" cellspacing="0"> 
@@ -302,6 +320,34 @@
 	</form>
 -->
 
+	<form enctype="multipart/form-data" action="services.cgi" method="POST" onSubmit="return validateStandard(this, 'error');">
+	<table class="linktable" cellspacing="0"> 
+	<tr><th colspan="3"><? echo dict_translate("OLSRd Configuration"); ></th></tr>
+	<tr>
+	<td class="f"><strong><? echo dict_translate("Upload Configuration File:"); ></strong></td>
+	<td><input type="file" name="olsr_conf_file" id="olsr_conf_file" realname="<? echo dict_translate("Configuration File"); >"></td>
+	</td>
+	<td class="f">&nbsp;</td>
+	</tr>
+	<tr>
+	  <td class="f">&nbsp;<input type="hidden" name="action" value="olsrconfupload"></td>
+	  <td><input type="submit" value="<? echo dict_translate("Upload"); >">&nbsp;</td>
+	  <td class="f">&nbsp; </td>
+	</tr>
+	<tr>
+	 <td class="f" rowspan="2"><strong><? echo dict_translate("Current Configuration File:"); ></strong></td>
+	 <td>
+       <input type="button" onClick="return openPage('olsrconf.cgi');" value="<? echo dict_translate("Download..."); >">
+       <input type="submit" id="olsrconfdelete" name="olsrconfdelete" value="<? echo dict_translate("Remove"); >"
+         onClick="return confirm('<? echo dict_translate("qst_remove_olsr_conf|Do you really want to remove uploaded OLSRd Configuration file?"); >');">
+	 </td>
+	  <td class="f"> &nbsp; </td>
+	</tr>
+  	<td></td>
+	</table>
+	</form>
+
+
     </td>
   </tr>
   <tr> 
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/services.cgi SDK.UBNT.v4.0.1.4978/apps/web/common/services.cgi
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/services.cgi	2011-08-22 19:03:29.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/services.cgi	2012-05-23 21:43:08.000000000 +0200
@@ -140,6 +140,13 @@
                 }
 		cfg_save($cfg, $cfg_file);
 		cfg_set_modified($cfg_file);
+	} elseif ($action == "cholsr") {
+		if ($olsr_status != "enabled") {
+			$olsr_status = "disabled";
+		}
+		cfg_set($cfg, "olsrd.status", $olsr_status);
+		cfg_save($cfg, $cfg_file);
+		cfg_set_modified($cfg_file);
 	} elseif ($action == "httpscertupload" && strlen($httpscertdelete) > 0) {
 		@unlink("/etc/persistent/https/server.crt");
 		@unlink("/etc/persistent/https/server.key");
@@ -182,6 +189,32 @@
 		}
 		cfg_save($cfg, $cfg_file);
 		cfg_set_modified($cfg_file);
+	} elseif ($action == "olsrconfupload" && strlen($olsrconfdelete) > 0) {
+		@unlink("/etc/persistent/olsrd.conf");
+		cfg_save($cfg, $cfg_file);
+		cfg_set_modified($cfg_file);
+	} elseif ($action == "olsrconfupload") {
+		if (strlen($olsr_conf_file) == 0)
+		{
+			$error_msg = dict_translate("msg_no_olsr_conf_file_specified|No OLSRd configuration file specified.");
+			include("lib/services.tmpl");
+			exit;			
+		}
+		$conf_error = check_uploaded_file($olsr_conf_file,
+				$olsr_conf_file_size, dict_translate("OLSRd configuration"), 5120);
+		if (strlen($conf_error) > 0)
+		{
+  		$error_msg = $conf_error;
+			@unlink($olsr_conf_file);
+			include("lib/services.tmpl");
+			exit;
+		}		
+		if (strlen($olsr_conf_file))
+		{
+			exec("mv "+$olsr_conf_file+" /etc/persistent/olsrd.conf");
+		}
+		cfg_save($cfg, $cfg_file);
+		cfg_set_modified($cfg_file);
 	}
 }
 
@@ -190,6 +223,7 @@
 $ssh_status = cfg_get_def($cfg, "sshd.status", $ssh_status);
 $syslog_status = cfg_get_def($cfg, "syslog.status", $syslog_status);
 $rsyslog_status = cfg_get_def($cfg, "syslog.remote.status", $rsyslog_status);
+$olsr_status = cfg_get_def($cfg, "olsrd.status", $olsr_status);
 $httpport = cfg_get_def($cfg, "httpd.port", "80");
 if (strlen($httpport) == 0) {
 	$httpport = "80";
diff -Nur SDK.UBNT.v4.0.1.4978.orig/apps/web/common/system.js SDK.UBNT.v4.0.1.4978/apps/web/common/system.js
--- SDK.UBNT.v4.0.1.4978.orig/apps/web/common/system.js	2011-08-23 11:44:21.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/apps/web/common/system.js	2012-05-23 21:43:08.000000000 +0200
@@ -118,3 +118,7 @@
 
 	return HOSTNAME_regex.test(value);
 }
+function olsrStatusClicked() {
+var c=document.getElementById('olsr_status');
+statusClicked(c,new Array());
+}
diff -Nur SDK.UBNT.v4.0.1.4978.orig/conf/xs2/busybox.config SDK.UBNT.v4.0.1.4978/conf/xs2/busybox.config
--- SDK.UBNT.v4.0.1.4978.orig/conf/xs2/busybox.config	2010-10-29 16:26:09.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/conf/xs2/busybox.config	2012-05-23 21:43:08.000000000 +0200
@@ -361,8 +361,9 @@
 CONFIG_PIDOF=y
 CONFIG_PS=y
 # CONFIG_RENICE is not set
-# CONFIG_TOP is not set
-# CONFIG_UPTIME is not set
+CONFIG_TOP=y
+FEATURE_CPU_USAGE_PERCENTAGE=y
+CONFIG_UPTIME=y
 # CONFIG_SYSCTL is not set
 
 #
diff -Nur SDK.UBNT.v4.0.1.4978.orig/conf/xs2/product.mk SDK.UBNT.v4.0.1.4978/conf/xs2/product.mk
--- SDK.UBNT.v4.0.1.4978.orig/conf/xs2/product.mk	2011-12-19 20:11:20.000000000 +0100
+++ SDK.UBNT.v4.0.1.4978/conf/xs2/product.mk	2012-05-23 21:43:08.000000000 +0200
@@ -40,6 +40,7 @@
 	    iproute2  trigger_url ntpclient igmpproxy dropbear
 #	    bird batmand wifidog
 #APPS_GPL += libpcap tcpdump iperfi
+APPS_GPL += olsrd
 
 ifdef USE_LIGHTTPD
 APPS_OPEN += tdb
diff -Nur SDK.UBNT.v4.0.1.4978.orig/conf/xs5/busybox.config SDK.UBNT.v4.0.1.4978/conf/xs5/busybox.config
--- SDK.UBNT.v4.0.1.4978.orig/conf/xs5/busybox.config	2010-10-29 16:26:09.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/conf/xs5/busybox.config	2012-05-23 21:43:08.000000000 +0200
@@ -361,8 +361,9 @@
 CONFIG_PIDOF=y
 CONFIG_PS=y
 # CONFIG_RENICE is not set
-# CONFIG_TOP is not set
-# CONFIG_UPTIME is not set
+CONFIG_TOP=y
+FEATURE_CPU_USAGE_PERCENTAGE=y
+CONFIG_UPTIME=y
 # CONFIG_SYSCTL is not set
 
 #
diff -Nur SDK.UBNT.v4.0.1.4978.orig/conf/xs5/product.mk SDK.UBNT.v4.0.1.4978/conf/xs5/product.mk
--- SDK.UBNT.v4.0.1.4978.orig/conf/xs5/product.mk	2011-12-19 20:11:20.000000000 +0100
+++ SDK.UBNT.v4.0.1.4978/conf/xs5/product.mk	2012-05-23 21:43:08.000000000 +0200
@@ -49,6 +49,7 @@
 
 #	    bird batmand wifidog
 #APPS_GPL += libpcap tcpdump iperf
+APPS_GPL += olsrd
 
 export DRIVERS APPS_OPEN APPS_GPL
 
diff -Nur SDK.UBNT.v4.0.1.4978.orig/rootfs/ls2/linuxrc SDK.UBNT.v4.0.1.4978/rootfs/ls2/linuxrc
--- SDK.UBNT.v4.0.1.4978.orig/rootfs/ls2/linuxrc	2011-03-28 14:36:00.000000000 +0200
+++ SDK.UBNT.v4.0.1.4978/rootfs/ls2/linuxrc	2012-05-23 21:43:08.000000000 +0200
@@ -139,6 +139,15 @@
 # Run configuration parser
 [ -e /sbin/ubntconf ] && /sbin/ubntconf
 
+# add olsrd to init
+grep -q "olsrd.status=enabled" /tmp/system.cfg
+if [ $? -eq 0 ] && [ -x /bin/olsrd ]; then
+    cp -f /usr/etc/init.d/olsrd /etc/sysinit/olsrd.conf
+    echo "null::respawn:/bin/olsrd -nofork" >> /etc/inittab
+    echo "olsrd" >> /etc/startup.list
+fi
+
+
 echo "Executing init..."
 exec /sbin/init -f
 
diff -Nur SDK.UBNT.v4.0.1.4978.orig/rootfs/ls2/usr/etc/rc.d/rc.softrestart SDK.UBNT.v4.0.1.4978/rootfs/ls2/usr/etc/rc.d/rc.softrestart
--- SDK.UBNT.v4.0.1.4978.orig/rootfs/ls2/usr/etc/rc.d/rc.softrestart	2011-01-25 11:52:29.000000000 +0100
+++ SDK.UBNT.v4.0.1.4978/rootfs/ls2/usr/etc/rc.d/rc.softrestart	2012-05-23 21:43:08.000000000 +0200
@@ -20,6 +20,14 @@
 	/sbin/ubntconf
 fi
 
+# add olsrd to init
+grep -q "olsrd.status=enabled" /tmp/system.cfg
+if [ $? -eq 0 ] && [ -x /bin/olsrd ]; then
+    cp -f /usr/etc/init.d/olsrd /etc/sysinit/olsrd.conf
+    echo "null::respawn:/bin/olsrd -nofork" >> /etc/inittab
+    echo "olsrd" >> /etc/startup.list
+fi
+
 RC_CMD=start
 . /etc/rc.d/rc
 
