diff --git a/examples/rpl-border-router/Makefile b/examples/rpl-border-router/Makefile
index b05f4007e15651a5e2b53acc5ff14f0a81c5b48f..76c07cb8b1e95d1bbdf89b05193926f1c73337dd 100644
--- a/examples/rpl-border-router/Makefile
+++ b/examples/rpl-border-router/Makefile
@@ -15,7 +15,7 @@ endif
 include $(SOURCES_DIR)/Makefile
 
 PROJECTDIRS += $(SOURCES_DIR)
-PROJECT_SOURCEFILES += httpd-simple.c webserver.c
+PROJECT_SOURCEFILES += httpd-simple.c webserver.c border-router-common.c
 CFLAGS += -DPROJECT_CONF_PATH=\"$(SOURCES_DIR)/project-conf.h\"
 
 include $(CONTIKI)/Makefile.include
diff --git a/examples/rpl-border-router/common/border-router-common.c b/examples/rpl-border-router/common/border-router-common.c
new file mode 100644
index 0000000000000000000000000000000000000000..c078057af00f20e623949dc7796b124ef03a6c14
--- /dev/null
+++ b/examples/rpl-border-router/common/border-router-common.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, RISE SICS
+ * 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.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
+ *
+ * This file is part of the Contiki operating system.
+ *
+ */
+
+#include "contiki.h"
+#include "border-router-common.h"
+#include "rpl-dag-root.h"
+
+/* Log configuration */
+#include "sys/log.h"
+#define LOG_MODULE "BR"
+#define LOG_LEVEL LOG_LEVEL_INFO
+
+uip_ipaddr_t prefix;
+uint8_t prefix_set;
+
+/*---------------------------------------------------------------------------*/
+void
+ print_local_addresses(void)
+ {
+   int i;
+   uint8_t state;
+
+   LOG_INFO("Server IPv6 addresses:\n");
+   for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
+     state = uip_ds6_if.addr_list[i].state;
+     if(uip_ds6_if.addr_list[i].isused &&
+        (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
+       LOG_INFO("  ");
+       LOG_INFO_6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
+       LOG_INFO_("\n");
+     }
+   }
+ }
+ /*---------------------------------------------------------------------------*/
+ void
+ set_prefix_64(uip_ipaddr_t *prefix_64)
+ {
+   memcpy(&prefix, prefix_64, 16);
+   prefix_set = 1;
+   rpl_dag_root_init(prefix_64, NULL);
+   rpl_dag_root_init_dag_immediately();
+ }
diff --git a/examples/rpl-border-router/common/border-router-common.h b/examples/rpl-border-router/common/border-router-common.h
new file mode 100644
index 0000000000000000000000000000000000000000..14775efad677fec0aa721033beb55ebb0871ad31
--- /dev/null
+++ b/examples/rpl-border-router/common/border-router-common.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, RISE SICS
+ * 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.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
+ *
+ * This file is part of the Contiki operating system.
+ *
+ */
+
+#include "contiki.h"
+#include "net/ipv6/uip.h"
+#include "net/ipv6/uip-ds6.h"
+
+extern uip_ipaddr_t prefix;
+extern uint8_t prefix_set;
+
+void print_local_addresses(void);
+void set_prefix_64(uip_ipaddr_t *prefix_64);
diff --git a/examples/rpl-border-router/embedded/border-router-embedded.c b/examples/rpl-border-router/embedded/border-router-embedded.c
index 48a5520fa3abe381c254edbc925141920f9d2148..d85c31e0855472aa450e5100ffd53f8321d114f3 100644
--- a/examples/rpl-border-router/embedded/border-router-embedded.c
+++ b/examples/rpl-border-router/embedded/border-router-embedded.c
@@ -36,71 +36,21 @@
  */
 
 #include "contiki.h"
-#include "contiki-lib.h"
-#include "contiki-net.h"
-#include "net/ipv6/uip.h"
-#include "net/ipv6/uip-ds6.h"
 #include "rpl.h"
-#if UIP_CONF_IPV6_RPL_LITE == 0
-#include "rpl-private.h"
-#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
-#include "rpl-dag-root.h"
-#if RPL_WITH_NON_STORING
-#include "rpl-ns.h"
-#endif /* RPL_WITH_NON_STORING */
-#include "net/netstack.h"
 #include "dev/button-sensor.h"
 #include "dev/slip.h"
-#include "net/ipv6/uip-debug.h"
+#include "border-router-common.h"
+
 /*---------------------------------------------------------------------------*/
 /* Log configuration */
 #include "sys/log.h"
 #define LOG_MODULE "BR"
 #define LOG_LEVEL LOG_LEVEL_INFO
-/*---------------------------------------------------------------------------*/
-static uip_ipaddr_t prefix;
-static uint8_t prefix_set;
-/*---------------------------------------------------------------------------*/
-PROCESS(border_router_process, "Border router process");
 
-/*---------------------------------------------------------------------------*/
-static void
-print_local_addresses(void)
-{
-  int i;
-  uint8_t state;
+void request_prefix(void);
 
-  LOG_INFO("Server IPv6 addresses:\n");
-  for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
-    state = uip_ds6_if.addr_list[i].state;
-    if(uip_ds6_if.addr_list[i].isused &&
-       (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
-      LOG_INFO("  ");
-      LOG_INFO_6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
-      LOG_INFO_("\n");
-    }
-  }
-}
-/*---------------------------------------------------------------------------*/
-void
-request_prefix(void)
-{
-  /* mess up uip_buf with a dirty request... */
-  uip_buf[0] = '?';
-  uip_buf[1] = 'P';
-  uip_len = 2;
-  slip_send();
-  uip_clear_buf();
-}
 /*---------------------------------------------------------------------------*/
-void
-set_prefix_64(uip_ipaddr_t *prefix_64)
-{
-  memcpy(&prefix, prefix_64, 16);
-  prefix_set = 1;
-  rpl_dag_root_init(prefix_64, NULL);
-  rpl_dag_root_init_dag_immediately();
-}
+PROCESS(border_router_process, "Border router process");
 /*---------------------------------------------------------------------------*/
 PROCESS_THREAD(border_router_process, ev, data)
 {
@@ -132,9 +82,7 @@ PROCESS_THREAD(border_router_process, ev, data)
 
   NETSTACK_MAC.on();
 
-#if DEBUG || 1
   print_local_addresses();
-#endif
 
   while(1) {
     PROCESS_YIELD();
diff --git a/examples/rpl-border-router/embedded/slip-bridge.c b/examples/rpl-border-router/embedded/slip-bridge.c
index abf95dfa8d96bf675bb5ae2b1cdd6f97f4d993b7..cb85793f08431e694c1b1a217a86627aea917ad1 100644
--- a/examples/rpl-border-router/embedded/slip-bridge.c
+++ b/examples/rpl-border-router/embedded/slip-bridge.c
@@ -53,6 +53,18 @@
 void set_prefix_64(uip_ipaddr_t *);
 
 static uip_ipaddr_t last_sender;
+
+/*---------------------------------------------------------------------------*/
+void
+request_prefix(void)
+{
+  /* mess up uip_buf with a dirty request... */
+  uip_buf[0] = '?';
+  uip_buf[1] = 'P';
+  uip_len = 2;
+  slip_send();
+  uip_clear_buf();
+}
 /*---------------------------------------------------------------------------*/
 static void
 slip_input_callback(void)
diff --git a/examples/rpl-border-router/native/border-router-native.c b/examples/rpl-border-router/native/border-router-native.c
index 7339b4b79a1ecec047fdfee94c1abde4f8bf2320..5f39d6fb083b1955d2981ba6f7f37e3b1557d8d9 100644
--- a/examples/rpl-border-router/native/border-router-native.c
+++ b/examples/rpl-border-router/native/border-router-native.c
@@ -39,15 +39,9 @@
  */
 
 #include "contiki.h"
-#include "contiki-lib.h"
 #include "contiki-net.h"
-#include "net/ipv6/uip.h"
-#include "net/ipv6/uip-ds6.h"
 #include "rpl.h"
-#include "rpl-dag-root.h"
-
-#include "net/netstack.h"
-#include "dev/slip.h"
+#include "border-router-common.h"
 #include "cmd.h"
 #include "border-router.h"
 #include "border-router-cmds.h"
@@ -55,13 +49,13 @@
 #define DEBUG DEBUG_FULL
 #include "net/ipv6/uip-debug.h"
 
+#include <stdlib.h>
+
 #define MAX_SENSORS 4
 
 extern long slip_sent;
 extern long slip_received;
 
-static uip_ipaddr_t prefix;
-static uint8_t prefix_set;
 static uint8_t mac_set;
 
 static uint8_t sensor_count = 0;
@@ -77,24 +71,6 @@ CMD_HANDLERS(border_router_cmd_handler);
 
 PROCESS(border_router_process, "Border router process");
 
-/*---------------------------------------------------------------------------*/
-static void
-print_local_addresses(void)
-{
-  int i;
-  uint8_t state;
-
-  PRINTA("Server IPv6 addresses:\n");
-  for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
-    state = uip_ds6_if.addr_list[i].state;
-    if(uip_ds6_if.addr_list[i].isused &&
-       (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
-      PRINTA(" %p: =>", &uip_ds6_if.addr_list[i]);
-      uip_debug_ipaddr_print(&(uip_ds6_if.addr_list[i]).ipaddr);
-      PRINTA("\n");
-    }
-  }
-}
 /*---------------------------------------------------------------------------*/
 static void
 request_mac(void)
@@ -150,15 +126,6 @@ border_router_set_sensors(const char *data, int len)
   sensor_count = sc;
 }
 /*---------------------------------------------------------------------------*/
-static void
-set_prefix_64(uip_ipaddr_t *prefix_64)
-{
-  memcpy(&prefix, prefix_64, 16);
-  prefix_set = 1;
-  rpl_dag_root_init(prefix_64, NULL);
-  rpl_dag_root_init_dag_immediately();
-}
-/*---------------------------------------------------------------------------*/
 PROCESS_THREAD(border_router_process, ev, data)
 {
   static struct etimer et;
@@ -197,9 +164,7 @@ PROCESS_THREAD(border_router_process, ev, data)
     }
   }
 
-#if DEBUG
   print_local_addresses();
-#endif
 
   while(1) {
     etimer_set(&et, CLOCK_SECOND * 2);