diff -Nur olsrd-0.5.0.orig/lib/httpinfo/src/olsrd_httpinfo.c olsrd-0.5.0/lib/httpinfo/src/olsrd_httpinfo.c
--- olsrd-0.5.0.orig/lib/httpinfo/src/olsrd_httpinfo.c	2007-06-30 22:09:07.000000000 +0200
+++ olsrd-0.5.0/lib/httpinfo/src/olsrd_httpinfo.c	2007-06-30 22:10:14.000000000 +0200
@@ -886,6 +886,8 @@
 
     size += snprintf(&buf[size], bufsize-size, "<td>TOS: 0x%04x</td>\n", olsr_cnf->tos);
 
+    size += sprintf(&buf[size], "<td>RtTable: 0x%04x</td>\n", olsr_cnf->rttable);
+
     size += snprintf(&buf[size], bufsize-size, "<td>Willingness: %d %s</td>\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : "");
     
     size += snprintf(&buf[size], bufsize-size, "</tr>\n<tr>\n");
diff -Nur olsrd-0.5.0.orig/src/cfgparser/cfgfile_gen.c olsrd-0.5.0/src/cfgparser/cfgfile_gen.c
--- olsrd-0.5.0.orig/src/cfgparser/cfgfile_gen.c	2007-03-27 05:05:21.000000000 +0200
+++ olsrd-0.5.0/src/cfgparser/cfgfile_gen.c	2007-06-30 22:10:14.000000000 +0200
@@ -123,6 +123,10 @@
   fprintf(fd, "# TOS(type of service) to use. Default is 16\n\n");
   fprintf(fd, "TosValue\t%d\n\n", cnf->tos);
 
+  /* RtTable */
+  fprintf(fd, "# Policy Routing Table to use. Default is 254\n\n");
+  fprintf(fd, "RtTable\t%d\n\n", cnf->rttable);
+
   /* Willingness */
   fprintf(fd, "# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n");
   if(cnf->willingness_auto)
@@ -432,6 +436,10 @@
   WRITE_TO_BUF("# TOS(type of service) to use. Default is 16\n\n")
   WRITE_TO_BUF("TosValue\t%d\n\n", cnf->tos)
 
+  /* RtTable */
+  WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n")
+  WRITE_TO_BUF("RtTable\t%d\n\n", cnf->rttable)
+
   /* Willingness */
   WRITE_TO_BUF("# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n")
   if(cnf->willingness_auto)
diff -Nur olsrd-0.5.0.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.0/src/cfgparser/olsrd_conf.c
--- olsrd-0.5.0.orig/src/cfgparser/olsrd_conf.c	2007-06-30 22:08:59.000000000 +0200
+++ olsrd-0.5.0/src/cfgparser/olsrd_conf.c	2007-06-30 22:10:14.000000000 +0200
@@ -446,6 +446,7 @@
     cnf->ip_version  = AF_INET;
     cnf->allow_no_interfaces = DEF_ALLOW_NO_INTS;
     cnf->tos = DEF_TOS;
+    cnf->rttable = 254;
     cnf->willingness_auto = DEF_WILL_AUTO;
     cnf->ipc_connections = DEF_IPC_CONNECTIONS;
     cnf->open_ipc = cnf->ipc_connections ? OLSR_TRUE : OLSR_FALSE;
@@ -473,7 +474,11 @@
     cnf->exit_value = EXIT_SUCCESS;
     cnf->max_tc_vtime = 0.0;
     cnf->ioctl_s = 0;
+#ifdef LINUX_POLICY_ROUTING
+    cnf->rtnl_s = 0;
+#else
     cnf->rts = 0;
+#endif
 }
 
 
@@ -549,6 +554,7 @@
   else
     printf("No interfaces    : NOT ALLOWED\n");
   printf("TOS              : 0x%02x\n", cnf->tos);
+  printf("RtTable          : 0x%02x\n", cnf->rttable);
   if(cnf->willingness_auto)
     printf("Willingness      : AUTO\n");
   else
diff -Nur olsrd-0.5.0.orig/src/cfgparser/oparse.y olsrd-0.5.0/src/cfgparser/oparse.y
--- olsrd-0.5.0.orig/src/cfgparser/oparse.y	2007-06-30 22:08:59.000000000 +0200
+++ olsrd-0.5.0/src/cfgparser/oparse.y	2007-06-30 22:10:14.000000000 +0200
@@ -143,6 +143,7 @@
 %token TOK_INTERFACE
 %token TOK_NOINT
 %token TOK_TOS
+%token TOK_RTTABLE
 %token TOK_WILLINGNESS
 %token TOK_IPCCON
 %token TOK_USEHYST
@@ -197,6 +198,7 @@
           | iipversion
           | bnoint
           | atos
+          | arttable
           | awillingness
           | busehyst
           | fhystscale
@@ -834,6 +836,16 @@
 }
 ;
 
+arttable: TOK_RTTABLE TOK_INTEGER
+{
+  if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer);
+  cnf->rttable = $2->integer;
+
+  free($2);
+
+}
+;
+
 awillingness: TOK_WILLINGNESS TOK_INTEGER
 {
   cnf->willingness_auto = OLSR_FALSE;
diff -Nur olsrd-0.5.0.orig/src/cfgparser/oscan.lex olsrd-0.5.0/src/cfgparser/oscan.lex
--- olsrd-0.5.0.orig/src/cfgparser/oscan.lex	2007-06-30 22:08:59.000000000 +0200
+++ olsrd-0.5.0/src/cfgparser/oscan.lex	2007-06-30 22:10:14.000000000 +0200
@@ -299,6 +299,11 @@
     return TOK_TOS;
 }
 
+"RtTable" {
+  yylval = NULL;
+  return TOK_RTTABLE;
+}
+
 "Willingness" {
     yylval = NULL;
     return TOK_WILLINGNESS;
diff -Nur olsrd-0.5.0.orig/src/linux/kernel_routes.c olsrd-0.5.0/src/linux/kernel_routes.c
--- olsrd-0.5.0.orig/src/linux/kernel_routes.c	2007-06-30 22:08:59.000000000 +0200
+++ olsrd-0.5.0/src/linux/kernel_routes.c	2007-06-30 23:09:01.000000000 +0200
@@ -1,6 +1,7 @@
 /*
  * The olsr.org Optimized Link-State Routing daemon(olsrd)
  * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
+ * Copyright (c) 2007, Sven-Ola for the policy routing stuff
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
@@ -49,10 +50,134 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
+#ifdef LINUX_POLICY_ROUTING
+
+#include <linux/types.h>
+#include <linux/rtnetlink.h>
+
+/*
+ * Sven-Ola@gmx.de: next two funcs borrowed from busybox/networking/libiproute/libnetlink.c
+ */
+
+static int get_prefix(unsigned long netmask)
+{
+	unsigned long msk = 0x80000000;
+	int ret = 0;
+
+	netmask = htonl(netmask);
+	while (msk)
+	{
+		if (netmask & msk)
+			ret++;
+		msk >>= 1;
+	}
+	return ret;
+}
+
+static int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
+{
+	int len = RTA_LENGTH(alen);
+	struct rtattr *rta;
+
+	if (NLMSG_ALIGN((int)n->nlmsg_len) + len > maxlen) return -1;
+	rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len));
+	rta->rta_type = type;
+	rta->rta_len = len;
+	memcpy(RTA_DATA(rta), data, alen);
+	n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + len;
+	return 0;
+}
+
+static int olsr_netlink_route(struct rt_entry *destination, __u16 cmd)
+{
+	ssize_t ret = 0;
+	olsr_32_t rt_metric = destination->rt_metric;
+	struct
+	{
+		struct nlmsghdr		n;
+		struct rtmsg		r;
+		char			buf[1024];
+	} req;
+	struct iovec iov;
+	struct sockaddr_nl nladdr;
+	struct msghdr msg =
+	{
+		(void*)&nladdr,
+		sizeof(nladdr),
+		&iov,
+		1,
+		NULL,
+		0,
+		0
+	};
+
+	memset(&req, 0, sizeof(req));
+	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
+	req.n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK;
+	req.n.nlmsg_type = cmd;
+	req.r.rtm_family = AF_INET;
+	req.r.rtm_table = olsr_cnf->rttable;
+	if (cmd != RTM_DELROUTE)
+	{
+		req.r.rtm_protocol = RTPROT_STATIC;
+		req.r.rtm_scope = RT_SCOPE_UNIVERSE;
+		req.r.rtm_type = RTN_UNICAST;
+	}
+	req.r.rtm_dst_len = get_prefix(destination->rt_mask.v4);
+	if (destination->rt_dst.v4 != destination->rt_router.v4)
+	{
+		addattr_l(&req.n, sizeof(req), RTA_GATEWAY, &destination->rt_router.v4, sizeof(destination->rt_router.v4)); 
+	}
+	addattr_l(&req.n, sizeof(req), RTA_DST, &destination->rt_dst.v4, sizeof(destination->rt_dst.v4)); 
+	addattr_l(&req.n, sizeof(req), RTA_PRIORITY, &rt_metric, sizeof(rt_metric));
+	addattr_l(&req.n, sizeof(req), RTA_OIF, &destination->rt_if->if_index, sizeof(destination->rt_if->if_index));
+	iov.iov_base = (void*)&req.n;
+	iov.iov_len = req.n.nlmsg_len;
+	memset(&nladdr, 0, sizeof(nladdr));
+	nladdr.nl_family = AF_NETLINK;
+	if (0 <= (ret = sendmsg(olsr_cnf->rtnl_s, &msg, 0)))
+	{
+		iov.iov_base = req.buf;
+		iov.iov_len = sizeof(req.buf);
+		if (0 < (ret = recvmsg(olsr_cnf->rtnl_s, &msg, 0)))
+		{
+			struct nlmsghdr *h = (struct nlmsghdr*)req.buf;
+			while (NLMSG_OK(h, ret)) {
+				if (NLMSG_DONE == h->nlmsg_type) break;
+				if (NLMSG_ERROR == h->nlmsg_type)
+				{
+					if (NLMSG_LENGTH(sizeof(struct nlmsgerr) <= h->nlmsg_len))
+					{
+						struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h);
+						errno = -l_err->error;
+						if (0 != errno) ret = -1;
+					}
+					break;
+				}
+				h = NLMSG_NEXT(h, ret);
+			}
+		}
+	}
+	return ret;
+}
+
+int olsr_ioctl_add_route(struct rt_entry *destination)
+{
+	return olsr_netlink_route(destination, RTM_NEWROUTE);
+}
+
+int olsr_ioctl_del_route(struct rt_entry *destination)
+{
+	return olsr_netlink_route(destination, RTM_DELROUTE);
+}
+
+#endif /* LINUX_POLICY_ROUTING */
 
 
 static struct sockaddr_in6 null_addr6; /* Address used as Originator Address IPv6 */
 
+#ifndef LINUX_POLICY_ROUTING
+
 /**
  *Insert a route in the kernel routing table
  *
@@ -135,6 +260,7 @@
   return tmp;
 }
 
+#endif /* !LINUX_POLICY_ROUTING */
 
 
 
@@ -206,6 +332,7 @@
 }
 
 
+#ifndef LINUX_POLICY_ROUTING
 
 /**
  *Remove a route from the kernel
@@ -270,6 +397,7 @@
   return tmp;
 }
 
+#endif /* !LINUX_POLICY_ROUTING */
 
 
 
diff -Nur olsrd-0.5.0.orig/src/main.c olsrd-0.5.0/src/main.c
--- olsrd-0.5.0.orig/src/main.c	2007-06-30 22:09:13.000000000 +0200
+++ olsrd-0.5.0/src/main.c	2007-06-30 23:09:35.000000000 +0200
@@ -56,6 +56,12 @@
 #include "net_os.h"
 #include "build_msg.h"
 
+#ifdef LINUX_POLICY_ROUTING
+#include <linux/types.h>
+#include <linux/rtnetlink.h>
+#include <fcntl.h>
+#endif
+
 /* Global stuff externed in defs.h */
 FILE *debug_handle;             /* Where to send debug(defaults to stdout) */
 struct olsrd_config *olsr_cnf;  /* The global configuration */
@@ -266,6 +272,15 @@
       olsr_exit(__func__, 0);
     }
 
+#ifdef LINUX_POLICY_ROUTING
+  if ((olsr_cnf->rtnl_s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) 
+    {
+      olsr_syslog(OLSR_LOG_ERR, "rtnetlink socket: %m");
+      olsr_exit(__func__, 0);
+    }
+  fcntl(olsr_cnf->rtnl_s, F_SETFL, O_NONBLOCK);
+#endif
+
 #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
   if ((olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
     {
@@ -485,6 +500,10 @@
   /* ioctl socket */
   close(olsr_cnf->ioctl_s);
 
+#ifdef LINUX_POLICY_ROUTING
+  close(olsr_cnf->rtnl_s);
+#endif
+
 #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
   /* routing socket */
   close(olsr_cnf->rts);
diff -Nur olsrd-0.5.0.orig/src/olsr_cfg.h olsrd-0.5.0/src/olsr_cfg.h
--- olsrd-0.5.0.orig/src/olsr_cfg.h	2007-06-30 22:08:59.000000000 +0200
+++ olsrd-0.5.0/src/olsr_cfg.h	2007-06-30 22:10:14.000000000 +0200
@@ -45,6 +45,10 @@
 
 #include "olsr_types.h"
 
+#if defined linux
+#  define LINUX_POLICY_ROUTING
+#endif
+
 /* Default valuse not declared in olsr_protocol.h */
 #define DEF_POLLRATE        0.05
 #define DEF_NICCHGPOLLRT    2.5
@@ -200,6 +204,7 @@
   int                      ip_version;
   olsr_bool                allow_no_interfaces;
   olsr_u16_t               tos;
+  olsr_u8_t                rttable;
   olsr_bool                willingness_auto;
   olsr_u8_t                willingness;
   int                      ipc_connections;
@@ -234,7 +239,11 @@
   float                    max_tc_vtime;
 
   int                      ioctl_s;              /* Socket used for ioctl calls */
+#ifdef LINUX_POLICY_ROUTING
+  int                      rtnl_s;               /* Socket used for rtnetlink messages */
+#else
   int                      rts;                  /* Socket used for route changes on BSDs */
+#endif
 };
 
 #if defined __cplusplus
