]> rtime.felk.cvut.cz Git - orte.git/commitdiff
RTEMS: use explicit loopback configuration for RTEMS <= 4.10.x.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 14 Sep 2013 18:36:55 +0000 (20:36 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 14 Sep 2013 18:36:55 +0000 (20:36 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
orte/examples/rtems-shell/init.c
orte/examples/rtems-shell/networkconfig-static.h
orte/examples/rtems-shell/networkconfig.h

index a9fc3ed9591c4e033a9b89c54861229e932fc706..e19c0e6b35c8ca5ca976f76cf8c18aa7d565aaf8 100644 (file)
@@ -34,8 +34,6 @@
 
 #include <orte_rtems_shell.h>
 
-#include "networkconfig-static.h"
-
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
 #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
 
+#if RTEMS_VER_CODE < VER_CODE(4,10,99)
+  #ifndef RTEMS_USE_LOOPBACK
+    #define RTEMS_USE_LOOPBACK 1
+  #endif
+#endif
+
+#include "networkconfig-static.h"
+
 #if RTEMS_VER_CODE < VER_CODE(4,7,99)
   #define rtems_shell_add_cmd shell_add_cmd
   #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
index 961690f90176705f2c3e360e0ad1fa7013364707..a5ba84ec6fd3a0bde08b39560d0abbf6e11f132e 100644 (file)
@@ -6,10 +6,33 @@
 
 static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
 
+#ifdef RTEMS_USE_LOOPBACK
+
+int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+
+#ifdef RTEMS_USE_LOOPBACK_ONLY
+static struct rtems_bsdnet_ifconfig netdriver_config = {
+#else
+static struct rtems_bsdnet_ifconfig loopback_config = {
+#endif
+       .name = "lo0",
+       .attach = rtems_bsdnet_loopattach,
+       .next = NULL,
+       .ip_address = "127.0.0.1",
+       .ip_netmask = "255.0.0.0",
+};
+
+#endif /*RTEMS_USE_LOOPBACK*/
+
+#ifndef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
        .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
        .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+#ifdef RTEMS_USE_LOOPBACK
+       .next = &loopback_config,
+#else /*RTEMS_USE_LOOPBACK*/
        .next = NULL,
+#endif /*RTEMS_USE_LOOPBACK*/
        .ip_address = "192.168.2.3",
        .ip_netmask = "255.255.255.0",
        .hardware_address = ethernet_address,
@@ -22,6 +45,7 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
        .bpar = 0,
        .drv_ctrl = NULL
 };
+#endif /*RTEMS_USE_LOOPBACK_ONLY*/
 
 struct rtems_bsdnet_config rtems_bsdnet_config = {
        .ifconfig = &netdriver_config,
index e5158eb7a2403ddebabcd9f8238edf9ac6507f0f..7c3dccfa91ffe9666e474ca0b895b6599b384edf 100644 (file)
@@ -7,10 +7,33 @@
 
 static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
 
+#ifdef RTEMS_USE_LOOPBACK
+
+int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+
+#ifdef RTEMS_USE_LOOPBACK_ONLY
+static struct rtems_bsdnet_ifconfig netdriver_config = {
+#else
+static struct rtems_bsdnet_ifconfig loopback_config = {
+#endif
+       .name = "lo0",
+       .attach = rtems_bsdnet_loopattach,
+       .next = NULL,
+       .ip_address = "127.0.0.1",
+       .ip_netmask = "255.0.0.0",
+};
+
+#endif /*RTEMS_USE_LOOPBACK*/
+
+#ifndef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
        .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
        .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+#ifdef RTEMS_USE_LOOPBACK
+       .next = &loopback_config,
+#else /*RTEMS_USE_LOOPBACK*/
        .next = NULL,
+#endif /*RTEMS_USE_LOOPBACK*/
        .ip_address = "192.168.3.66",
        .ip_netmask = "255.255.255.0",
        .hardware_address = ethernet_address,
@@ -23,6 +46,7 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
        .bpar = 0,
        .drv_ctrl = NULL
 };
+#endif /*RTEMS_USE_LOOPBACK_ONLY*/
 
 struct rtems_bsdnet_config rtems_bsdnet_config = {
        .ifconfig = &netdriver_config,