[Xorp-users] XORP OSPF on Linux: compile error and documentation request

Jeff Gold jgold@mazunetworks.com
Tue, 13 Jul 2004 14:40:38 -0400


I would like to experiment with XORP using OSPF on Linux.  I understand 
that this is supported only through a contrib package that is thoroughly 
tested only on FreeBSD, but I would like to see how it holds up. 
Unfortunately for me it seems that OSPF won't even compile on Linux.  I 
have managed to solve a few of the problems with the patch attached to 
this message, but I am stuck on the following problem:

$ ./configure --prefix=/usr/local/routed/xorp --without-snmp && \
   make clean && make
[...]
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../.. -I../../.. -I./../src 
   -g  -W -Wall -Wwrite-strings -Wcast-qual -Werror -Wpointer-arith 
-Wcast-align -Wstrict-prototypes -Woverloaded-virtual 
-ftemplate-depth-20 -c -o ospfd_xorp.o `test -f ospfd_xorp.C || echo 
'./'`ospfd_xorp.C
In file included from ospfd_xorp.C:46:
ospfd_xorp.h:101: error: field `rt_rtm' has incomplete type
make[4]: *** [ospfd_xorp.o] Error 1
make[4]: Leaving directory `/root/xorp-1.0/contrib/ospfd/xorp'

Apparently the xorp/ospfd_xorp.[hC] files are significantly changed 
versions of the freebsd/ospfd_freebsd.[hC] files.  Can this be right? 
How is one supposed to build this on Linux, short of porting the XORP 
changes to the linux/ospfd_linux.[hC] files?

                                           Jeff


diff -urN xorp-1.0/configure xorp-1.0-ospflinux/configure
--- xorp-1.0/configure  2004-07-09 02:34:59.000000000 -0400
+++ xorp-1.0-ospflinux/configure        2004-07-13 10:30:03.000000000 -0400
@@ -9136,7 +9136,7 @@
             xorp_cv_ospfd_os="freebsd"
         ;;
         linux* )
-           xorp_cv_ospfd_os="unsupported"
+           xorp_cv_ospfd_os="linux"
                                 ;;
         * )
             xorp_cv_ospfd_os="unsupported"
diff -urN xorp-1.0/contrib/ospfd/xorp/ospfd_xorp.C 
xorp-1.0-ospflinux/contrib/ospfd/xorp/ospfd_xorp.C
--- xorp-1.0/contrib/ospfd/xorp/ospfd_xorp.C    2003-09-27 
18:32:45.000000000 -0400
+++ xorp-1.0-ospflinux/contrib/ospfd/xorp/ospfd_xorp.C  2004-07-13 
10:30:34.000000000 -0400
@@ -46,6 +46,14 @@
  #include "ospfd_xorp.h"
  #include "xrl_target.h"

+/* apparently this is a BSD specific macro */
+#ifndef _SIZEOF_ADDR_IFREQ
+# define _SIZEOF_ADDR_IFREQ(ifr) \
+           ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
+            (sizeof(struct ifreq) - sizeof(struct sockaddr) + \
+             (ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
+#endif /* _SIZEOF_ADDR_IFREQ */
+
  /* Initialize the FreeBSD interface.
   * Open the network interface.
   * Start the random number generator.