diff -urN bird-1.0.6/filter/filter.c bird-1.0.6-realms/filter/filter.c
--- bird-1.0.6/filter/filter.c	2003-04-06 17:59:22.000000000 +0700
+++ bird-1.0.6-realms/filter/filter.c	2003-04-21 17:40:51.000000000 +0700
@@ -830,7 +830,7 @@
   res = interpret(inst);
   if (res.type != T_RETURN) {
     log( L_ERR "Filter %s did not return accept nor reject. Make up your mind", filter->name); 
-    return F_ERROR;
+//    return F_ERROR;
   }
   DBG( "done (%d)\n", res.val.i );
   return res.val.i;
diff -urN bird-1.0.6/nest/config.Y bird-1.0.6-realms/nest/config.Y
--- bird-1.0.6/nest/config.Y	2002-11-13 14:43:23.000000000 +0600
+++ bird-1.0.6-realms/nest/config.Y	2003-04-21 19:48:23.000000000 +0700
@@ -24,6 +24,8 @@
 CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
 CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS)
 
+CF_KEYWORDS(REALM)
+
 CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
 	RIP, OSPF, OSPF_EXT, OSPF_IA, OSPF_BOUNDARY, BGP, PIPE)
 CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE)
@@ -102,6 +104,7 @@
  | IMPORT imexport { this_proto->in_filter = $2; }
  | EXPORT imexport { this_proto->out_filter = $2; }
  | TABLE rtable { this_proto->table = $2; }
+ | REALM imexport { this_proto->realm_filter = $2; }
  ;
 
 imexport:
diff -urN bird-1.0.6/nest/proto.c bird-1.0.6-realms/nest/proto.c
--- bird-1.0.6/nest/proto.c	2000-06-07 19:17:05.000000000 +0700
+++ bird-1.0.6-realms/nest/proto.c	2003-04-21 19:35:48.000000000 +0700
@@ -114,6 +114,7 @@
   p->table = c->table->table;
   p->in_filter = c->in_filter;
   p->out_filter = c->out_filter;
+  p->realm_filter = c->realm_filter;
   p->min_scope = SCOPE_SITE;
   p->hash_key = random_u32();
   c->proto = p;
@@ -322,6 +323,7 @@
 		      PD(p, "Reconfigured");
 		      p->cf = nc;
 		      p->name = nc->name;
+		      p->realm_filter = nc->realm_filter;
 		      p->in_filter = nc->in_filter;
 		      p->out_filter = nc->out_filter;
 		      nc->proto = p;
diff -urN bird-1.0.6/nest/protocol.h bird-1.0.6-realms/nest/protocol.h
--- bird-1.0.6/nest/protocol.h	2000-05-19 17:27:11.000000000 +0700
+++ bird-1.0.6-realms/nest/protocol.h	2003-04-21 19:32:12.000000000 +0700
@@ -80,6 +80,7 @@
   struct protocol *protocol;		/* Protocol */
   struct proto *proto;			/* Instance we've created */
   char *name;
+  struct filter *realm_filter;
   unsigned debug, preference, disabled;	/* Generic parameters */
   struct rtable_config *table;		/* Table we're attached to */
   struct filter *in_filter, *out_filter; /* Attached filters */
@@ -149,6 +150,7 @@
   struct rtable *table;			/* Our primary routing table */
   struct filter *in_filter;		/* Input filter */
   struct filter *out_filter;		/* Output filter */
+  struct filter *realm_filter;
   struct announce_hook *ahooks;		/* Announcement hooks for this protocol */
 
   struct fib_iterator *feed_iterator;	/* Routing table iterator used during protocol feeding */
diff -urN bird-1.0.6/nest/route.h bird-1.0.6-realms/nest/route.h
--- bird-1.0.6/nest/route.h	2000-06-22 04:48:20.000000000 +0700
+++ bird-1.0.6-realms/nest/route.h	2003-04-21 16:41:19.000000000 +0700
@@ -146,6 +146,7 @@
 typedef struct rte {
   struct rte *next;
   net *net;				/* Network this RTE belongs to */
+  u32 realm;
   struct rta *attrs;			/* Attributes of this route */
   byte flags;				/* Flags (REF_...) */
   byte pflags;				/* Protocol-specific flags */
diff -urN bird-1.0.6/nest/rt-table.c bird-1.0.6-realms/nest/rt-table.c
--- bird-1.0.6/nest/rt-table.c	2002-11-13 14:37:07.000000000 +0600
+++ bird-1.0.6-realms/nest/rt-table.c	2003-04-21 19:49:58.000000000 +0700
@@ -330,6 +330,7 @@
     x->attrs == y->attrs &&
     x->flags == y->flags &&
     x->pflags == y->pflags &&
+    x->realm == y->realm &&
     x->pref == y->pref &&
     (!x->attrs->proto->rte_same || x->attrs->proto->rte_same(x, y));
 }
@@ -505,6 +506,13 @@
 	  if (tmpa != old_tmpa && p->store_tmp_attrs)
 	    p->store_tmp_attrs(new, tmpa);
 	}
+	
+	if (p->realm_filter) {
+		ea_list *old_tmpa = tmpa;
+		rte_trace_in(D_FILTERS, p, new, "checking realm filter");
+		new->realm = f_run(p->realm_filter, &new, &tmpa, 
+					rte_update_pool, 0);
+	}
       if (!(new->attrs->aflags & RTAF_CACHED)) /* Need to copy attributes */
 	new->attrs = rta_lookup(new->attrs);
       new->flags |= REF_COW;
diff -urN bird-1.0.6/sysdep/linux/netlink/netlink.c bird-1.0.6-realms/sysdep/linux/netlink/netlink.c
--- bird-1.0.6/sysdep/linux/netlink/netlink.c	2003-02-23 16:21:38.000000000 +0600
+++ bird-1.0.6-realms/sysdep/linux/netlink/netlink.c	2003-04-21 19:47:15.000000000 +0700
@@ -34,6 +34,8 @@
 #define MSG_TRUNC 0x20
 #endif
 
+extern struct config *config;
+
 /*
  *	Synchronous Netlink interface
  */
@@ -491,6 +493,8 @@
   r.r.rtm_protocol = RTPROT_BIRD;
   r.r.rtm_scope = RT_SCOPE_UNIVERSE;
   nl_add_attr_ipa(&r.h, sizeof(r), RTA_DST, net->n.prefix);
+	if (e->realm != 0)
+		nl_add_attr_u32(&r.h, sizeof(r), RTA_FLOW, e->realm);
   switch (a->dest)
     {
     case RTD_ROUTER:
