unbound, bind9, fedora8 added
authorHajime Tazaki <tazaki@nict.go.jp>
Fri, 11 May 2012 17:03:32 +0900
changeset 205ca51e147e7f
parent 19 f86f5b19833f
child 21 c9fa67dd732a
unbound, bind9, fedora8 added
120406-dce-quagga-support.patch
120410-dce-umip-support.patch
dns_bind9.patch
dns_unbound.patch
fedora8-nontimerfd-etc.patch
series
     1.1 --- a/120406-dce-quagga-support.patch	Wed Apr 11 12:41:12 2012 +0900
     1.2 +++ b/120406-dce-quagga-support.patch	Fri May 11 17:03:32 2012 +0900
     1.3 @@ -825,7 +825,7 @@
     1.4  -#endif /* QUAGGA_HELPER_H */
     1.5  diff -r 28c0c7f781c1 model/dce-fd.cc
     1.6  --- a/model/dce-fd.cc	Thu Mar 29 17:00:46 2012 +0200
     1.7 -+++ b/model/dce-fd.cc	Wed Apr 11 10:56:47 2012 +0900
     1.8 ++++ b/model/dce-fd.cc	Mon Apr 23 17:29:23 2012 +0900
     1.9  @@ -345,12 +345,6 @@
    1.10   
    1.11     Ptr<SocketFdFactory>  factory = 0;
    1.12 @@ -841,7 +841,7 @@
    1.13         factory = manager->GetObject<SocketFdFactory> ();
    1.14  diff -r 28c0c7f781c1 model/libc-ns3.h
    1.15  --- a/model/libc-ns3.h	Thu Mar 29 17:00:46 2012 +0200
    1.16 -+++ b/model/libc-ns3.h	Wed Apr 11 10:56:47 2012 +0900
    1.17 ++++ b/model/libc-ns3.h	Mon Apr 23 17:29:23 2012 +0900
    1.18  @@ -412,7 +412,7 @@
    1.19   DCE    (ftruncate)
    1.20   
    1.21 @@ -862,7 +862,7 @@
    1.22   
    1.23  diff -r 28c0c7f781c1 model/linux-socket-fd-factory.cc
    1.24  --- a/model/linux-socket-fd-factory.cc	Thu Mar 29 17:00:46 2012 +0200
    1.25 -+++ b/model/linux-socket-fd-factory.cc	Wed Apr 11 10:56:47 2012 +0900
    1.26 ++++ b/model/linux-socket-fd-factory.cc	Mon Apr 23 17:29:23 2012 +0900
    1.27  @@ -254,6 +254,10 @@
    1.28   {
    1.29     LinuxSocketFdFactory *self = (LinuxSocketFdFactory *)kernel;
    1.30 @@ -885,9 +885,89 @@
    1.31     struct SimDevice *dev = m_exported->dev_create (PeekPointer (device), (enum SimDevFlags)flags);
    1.32   
    1.33     Ptr<LinuxDeviceStateListener> listener = Create <LinuxDeviceStateListener> (device, this);
    1.34 +diff -r 28c0c7f781c1 model/ns3-socket-fd-factory.cc
    1.35 +--- a/model/ns3-socket-fd-factory.cc	Thu Mar 29 17:00:46 2012 +0200
    1.36 ++++ b/model/ns3-socket-fd-factory.cc	Mon Apr 23 17:29:23 2012 +0900
    1.37 +@@ -98,6 +98,29 @@
    1.38 +         break;
    1.39 +         }
    1.40 +     }
    1.41 ++  else if (domain == PF_INET6)
    1.42 ++    {
    1.43 ++      switch (type) {
    1.44 ++        case SOCK_RAW: {
    1.45 ++        TypeId tid = TypeId::LookupByName ("ns3::Ipv6RawSocketFactory");
    1.46 ++        Ptr<SocketFactory> factory = GetObject<SocketFactory> (tid);
    1.47 ++        sock = factory->CreateSocket ();
    1.48 ++        sock->SetAttribute ("Protocol", UintegerValue (protocol));
    1.49 ++        socket = new UnixDatagramSocketFd (sock);
    1.50 ++          } break;
    1.51 ++        case SOCK_DGRAM: {
    1.52 ++          } break;
    1.53 ++        case SOCK_STREAM: {
    1.54 ++        TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory");
    1.55 ++        Ptr<SocketFactory> factory = GetObject<SocketFactory> (tid);
    1.56 ++        sock = factory->CreateSocket ();
    1.57 ++        socket = new UnixStreamSocketFd (sock);
    1.58 ++          } break;
    1.59 ++        default:
    1.60 ++        NS_FATAL_ERROR ("missing socket type");
    1.61 ++        break;
    1.62 ++        }
    1.63 ++    }
    1.64 +   else if (domain == PF_NETLINK)
    1.65 +     {
    1.66 +       switch (type) {
    1.67 +diff -r 28c0c7f781c1 model/unix-socket-fd.cc
    1.68 +--- a/model/unix-socket-fd.cc	Thu Mar 29 17:00:46 2012 +0200
    1.69 ++++ b/model/unix-socket-fd.cc	Mon Apr 23 17:29:23 2012 +0900
    1.70 +@@ -33,6 +33,7 @@
    1.71 + #include "ns3/boolean.h"
    1.72 + #include "ns3/simulator.h"
    1.73 + #include "ns3/netlink-socket-address.h"
    1.74 ++#include "ns3/inet6-socket-address.h"
    1.75 + #include <fcntl.h>
    1.76 + #include <errno.h>
    1.77 + #include <linux/icmp.h> // need ICMP_FILTER
    1.78 +@@ -634,6 +635,15 @@
    1.79 +       InetSocketAddress inet = InetSocketAddress (ipv4, port);
    1.80 +       return inet;
    1.81 +     }
    1.82 ++  else if (my_addr->sa_family == AF_INET6)
    1.83 ++    {
    1.84 ++      const struct sockaddr_in6 *addr = (const struct sockaddr_in6 *)my_addr;
    1.85 ++      Ipv6Address ipv6;
    1.86 ++      ipv6.Set ((uint8_t *)addr->sin6_addr.s6_addr);
    1.87 ++      uint16_t port = ntohs (addr->sin6_port);
    1.88 ++      Inet6SocketAddress inet = Inet6SocketAddress (ipv6, port);
    1.89 ++      return inet;
    1.90 ++    }
    1.91 +   else if (my_addr->sa_family == AF_NETLINK)
    1.92 +     {
    1.93 +       const struct sockaddr_nl *addr = (const struct sockaddr_nl *)my_addr;
    1.94 +@@ -670,6 +680,19 @@
    1.95 +       inet_addr->sin_addr.s_addr = htonl (ns_inetaddr.GetIpv4 ().Get ());
    1.96 +       *addrlen = sizeof(struct sockaddr_in);
    1.97 +     }
    1.98 ++  else if (Inet6SocketAddress::IsMatchingType (nsaddr))
    1.99 ++    {
   1.100 ++      Inet6SocketAddress ns_inetaddr = Inet6SocketAddress::ConvertFrom (nsaddr);
   1.101 ++      if (*addrlen < sizeof (struct sockaddr_in6))
   1.102 ++        {
   1.103 ++          return -1;
   1.104 ++        }
   1.105 ++      struct sockaddr_in6 *inet_addr = (struct sockaddr_in6 *)addr;
   1.106 ++      inet_addr->sin6_family = AF_INET;
   1.107 ++      inet_addr->sin6_port = htons (ns_inetaddr.GetPort ());
   1.108 ++      ns_inetaddr.GetIpv6 ().GetBytes (inet_addr->sin6_addr.s6_addr);
   1.109 ++      *addrlen = sizeof(struct sockaddr_in6);
   1.110 ++    }
   1.111 +   else if (NetlinkSocketAddress::IsMatchingType(nsaddr))
   1.112 +     {
   1.113 +       NetlinkSocketAddress ns_nladdr = NetlinkSocketAddress::ConvertFrom (nsaddr);
   1.114  diff -r 28c0c7f781c1 model/utils.cc
   1.115  --- a/model/utils.cc	Thu Mar 29 17:00:46 2012 +0200
   1.116 -+++ b/model/utils.cc	Wed Apr 11 10:56:47 2012 +0900
   1.117 ++++ b/model/utils.cc	Mon Apr 23 17:29:23 2012 +0900
   1.118  @@ -191,6 +191,11 @@
   1.119   void UtilsDoSignal (void)
   1.120   {
   1.121 @@ -902,7 +982,7 @@
   1.122     for (std::vector<SignalHandler>::iterator i = current->process->signalHandlers.begin (); 
   1.123  diff -r 28c0c7f781c1 test/dce-manager-test.cc
   1.124  --- a/test/dce-manager-test.cc	Thu Mar 29 17:00:46 2012 +0200
   1.125 -+++ b/test/dce-manager-test.cc	Wed Apr 11 10:56:47 2012 +0900
   1.126 ++++ b/test/dce-manager-test.cc	Mon Apr 23 17:29:23 2012 +0900
   1.127  @@ -161,13 +161,15 @@
   1.128         {  "test-random", 0, "", false },
   1.129         {  "test-local-socket", 0, "", false },
   1.130 @@ -922,7 +1002,7 @@
   1.131     // Prepare directories and files for test-stdio
   1.132  diff -r 28c0c7f781c1 test/test-bug-multi-select.cc
   1.133  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   1.134 -+++ b/test/test-bug-multi-select.cc	Wed Apr 11 10:56:47 2012 +0900
   1.135 ++++ b/test/test-bug-multi-select.cc	Mon Apr 23 17:29:23 2012 +0900
   1.136  @@ -0,0 +1,199 @@
   1.137  +#include <stdio.h>
   1.138  +#include <sys/select.h>
   1.139 @@ -1125,7 +1205,7 @@
   1.140  +}
   1.141  diff -r 28c0c7f781c1 test/test-socket.cc
   1.142  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   1.143 -+++ b/test/test-socket.cc	Wed Apr 11 10:56:47 2012 +0900
   1.144 ++++ b/test/test-socket.cc	Mon Apr 23 17:29:23 2012 +0900
   1.145  @@ -0,0 +1,395 @@
   1.146  +#define _GNU_SOURCE 1
   1.147  +#include <sys/types.h>
   1.148 @@ -1524,7 +1604,7 @@
   1.149  +}
   1.150  diff -r 28c0c7f781c1 test/wscript
   1.151  --- a/test/wscript	Thu Mar 29 17:00:46 2012 +0200
   1.152 -+++ b/test/wscript	Wed Apr 11 10:56:47 2012 +0900
   1.153 ++++ b/test/wscript	Mon Apr 23 17:29:23 2012 +0900
   1.154  @@ -31,6 +31,8 @@
   1.155       new_test(bld, 'test-netdb', '')
   1.156       new_test(bld, 'test-env', '')
   1.157 @@ -1536,7 +1616,7 @@
   1.158       new_test(bld, 'test-select', 'PTHREAD')
   1.159  diff -r 28c0c7f781c1 utils/setenv.sh
   1.160  --- a/utils/setenv.sh	Thu Mar 29 17:00:46 2012 +0200
   1.161 -+++ b/utils/setenv.sh	Wed Apr 11 10:56:47 2012 +0900
   1.162 ++++ b/utils/setenv.sh	Mon Apr 23 17:29:23 2012 +0900
   1.163  @@ -1,6 +1,6 @@
   1.164   #!/bin/bash
   1.165   # Set environnement for ns3 dce
   1.166 @@ -1547,7 +1627,7 @@
   1.167   BASE=$PWD
   1.168  diff -r 28c0c7f781c1 wscript
   1.169  --- a/wscript	Thu Mar 29 17:00:46 2012 +0200
   1.170 -+++ b/wscript	Wed Apr 11 10:56:47 2012 +0900
   1.171 ++++ b/wscript	Mon Apr 23 17:29:23 2012 +0900
   1.172  @@ -26,6 +26,7 @@
   1.173       ns3waf.check_modules(conf, ['point-to-point', 'tap-bridge', 'netanim'], mandatory = False)
   1.174       ns3waf.check_modules(conf, ['wifi', 'point-to-point', 'csma', 'mobility'], mandatory = False)
     2.1 --- a/120410-dce-umip-support.patch	Wed Apr 11 12:41:12 2012 +0900
     2.2 +++ b/120410-dce-umip-support.patch	Fri May 11 17:03:32 2012 +0900
     2.3 @@ -1,8 +1,8 @@
     2.4  support umip(mip6d) with ns-3-linux for NEMO/MIP6
     2.5  
     2.6 -diff -r 61ddc5520f14 model/dce-fd.cc
     2.7 ---- a/model/dce-fd.cc	Wed Apr 11 10:56:47 2012 +0900
     2.8 -+++ b/model/dce-fd.cc	Wed Apr 11 12:38:04 2012 +0900
     2.9 +diff -r ab266495f633 model/dce-fd.cc
    2.10 +--- a/model/dce-fd.cc	Mon Apr 23 17:29:23 2012 +0900
    2.11 ++++ b/model/dce-fd.cc	Thu Apr 26 09:56:01 2012 +0900
    2.12  @@ -367,11 +367,30 @@
    2.13       }
    2.14   
    2.15 @@ -34,9 +34,9 @@
    2.16   int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
    2.17   {
    2.18     Thread *current = Current ();
    2.19 -diff -r 61ddc5520f14 model/dce-manager.cc
    2.20 ---- a/model/dce-manager.cc	Wed Apr 11 10:56:47 2012 +0900
    2.21 -+++ b/model/dce-manager.cc	Wed Apr 11 12:38:04 2012 +0900
    2.22 +diff -r ab266495f633 model/dce-manager.cc
    2.23 +--- a/model/dce-manager.cc	Mon Apr 23 17:29:23 2012 +0900
    2.24 ++++ b/model/dce-manager.cc	Thu Apr 26 09:56:01 2012 +0900
    2.25  @@ -1096,6 +1096,22 @@
    2.26             libpthread_setup = (void (*)(const struct Libc *))(symbol);
    2.27             libpthread_setup (libc);
    2.28 @@ -60,9 +60,9 @@
    2.29             // finally, call into 'main'.
    2.30             h = ld->Load (filename, RTLD_GLOBAL);
    2.31   
    2.32 -diff -r 61ddc5520f14 model/dce-poll.cc
    2.33 ---- a/model/dce-poll.cc	Wed Apr 11 10:56:47 2012 +0900
    2.34 -+++ b/model/dce-poll.cc	Wed Apr 11 12:38:04 2012 +0900
    2.35 +diff -r ab266495f633 model/dce-poll.cc
    2.36 +--- a/model/dce-poll.cc	Mon Apr 23 17:29:23 2012 +0900
    2.37 ++++ b/model/dce-poll.cc	Thu Apr 26 09:56:01 2012 +0900
    2.38  @@ -180,7 +180,12 @@
    2.39           }
    2.40       }
    2.41 @@ -77,9 +77,9 @@
    2.42       {
    2.43         current->err = EINVAL;
    2.44         return -1;
    2.45 -diff -r 61ddc5520f14 model/dce-signal.cc
    2.46 ---- a/model/dce-signal.cc	Wed Apr 11 10:56:47 2012 +0900
    2.47 -+++ b/model/dce-signal.cc	Wed Apr 11 12:38:04 2012 +0900
    2.48 +diff -r ab266495f633 model/dce-signal.cc
    2.49 +--- a/model/dce-signal.cc	Mon Apr 23 17:29:23 2012 +0900
    2.50 ++++ b/model/dce-signal.cc	Thu Apr 26 09:56:01 2012 +0900
    2.51  @@ -3,6 +3,7 @@
    2.52   #include "process.h"
    2.53   #include "ns3/log.h"
    2.54 @@ -106,9 +106,9 @@
    2.55   int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
    2.56   {
    2.57     Thread *current = Current ();
    2.58 -diff -r 61ddc5520f14 model/dce-signal.h
    2.59 ---- a/model/dce-signal.h	Wed Apr 11 10:56:47 2012 +0900
    2.60 -+++ b/model/dce-signal.h	Wed Apr 11 12:38:04 2012 +0900
    2.61 +diff -r ab266495f633 model/dce-signal.h
    2.62 +--- a/model/dce-signal.h	Mon Apr 23 17:29:23 2012 +0900
    2.63 ++++ b/model/dce-signal.h	Thu Apr 26 09:56:01 2012 +0900
    2.64  @@ -17,6 +17,7 @@
    2.65   int dce_pthread_kill (pthread_t thread, int sig);
    2.66   void dce_abort ();
    2.67 @@ -117,9 +117,33 @@
    2.68   
    2.69   #ifdef __cplusplus
    2.70   }
    2.71 -diff -r 61ddc5520f14 model/dce-time.cc
    2.72 ---- a/model/dce-time.cc	Wed Apr 11 10:56:47 2012 +0900
    2.73 -+++ b/model/dce-time.cc	Wed Apr 11 12:38:04 2012 +0900
    2.74 +diff -r ab266495f633 model/dce-string.cc
    2.75 +--- a/model/dce-string.cc	Mon Apr 23 17:29:23 2012 +0900
    2.76 ++++ b/model/dce-string.cc	Thu Apr 26 09:56:01 2012 +0900
    2.77 +@@ -26,3 +26,9 @@
    2.78 +   /// \todo Do actual checking
    2.79 +   strcpy (__dest, __src); 
    2.80 + }
    2.81 ++
    2.82 ++char *dce_strrchr(char *s, int c)
    2.83 ++{
    2.84 ++  return strrchr (s, c);
    2.85 ++}
    2.86 ++
    2.87 +diff -r ab266495f633 model/dce-string.h
    2.88 +--- a/model/dce-string.h	Mon Apr 23 17:29:23 2012 +0900
    2.89 ++++ b/model/dce-string.h	Thu Apr 26 09:56:01 2012 +0900
    2.90 +@@ -12,6 +12,7 @@
    2.91 + char *dce___strcpy_chk (char *__restrict __dest,
    2.92 + 						const char *__restrict __src,
    2.93 + 						size_t __destlen);
    2.94 ++char *dce_strrchr(char *s, int c);
    2.95 + 
    2.96 + #ifdef __cplusplus
    2.97 + }
    2.98 +diff -r ab266495f633 model/dce-time.cc
    2.99 +--- a/model/dce-time.cc	Mon Apr 23 17:29:23 2012 +0900
   2.100 ++++ b/model/dce-time.cc	Thu Apr 26 09:56:01 2012 +0900
   2.101  @@ -54,3 +54,12 @@
   2.102   
   2.103     return asctime_r (tm, Current ()->process->asctime_result);
   2.104 @@ -133,9 +157,9 @@
   2.105  +  *tp = UtilsTimeToTimespec (UtilsSimulationTimeToTime (Now ()));
   2.106  +  return 0;
   2.107  +}
   2.108 -diff -r 61ddc5520f14 model/dce-time.h
   2.109 ---- a/model/dce-time.h	Wed Apr 11 10:56:47 2012 +0900
   2.110 -+++ b/model/dce-time.h	Wed Apr 11 12:38:04 2012 +0900
   2.111 +diff -r ab266495f633 model/dce-time.h
   2.112 +--- a/model/dce-time.h	Mon Apr 23 17:29:23 2012 +0900
   2.113 ++++ b/model/dce-time.h	Thu Apr 26 09:56:01 2012 +0900
   2.114  @@ -3,6 +3,7 @@
   2.115   
   2.116   #include "sys/dce-time.h"
   2.117 @@ -153,9 +177,9 @@
   2.118   	
   2.119   #ifdef __cplusplus
   2.120   }
   2.121 -diff -r 61ddc5520f14 model/dce.cc
   2.122 ---- a/model/dce.cc	Wed Apr 11 10:56:47 2012 +0900
   2.123 -+++ b/model/dce.cc	Wed Apr 11 12:38:04 2012 +0900
   2.124 +diff -r ab266495f633 model/dce.cc
   2.125 +--- a/model/dce.cc	Mon Apr 23 17:29:23 2012 +0900
   2.126 ++++ b/model/dce.cc	Thu Apr 26 09:56:01 2012 +0900
   2.127  @@ -22,6 +22,8 @@
   2.128   #include <getopt.h>
   2.129   #include <limits.h>
   2.130 @@ -265,9 +289,9 @@
   2.131   #ifdef HAVE_GETCPUFEATURES
   2.132   extern "C"
   2.133   {
   2.134 -diff -r 61ddc5520f14 model/elf-cache.cc
   2.135 ---- a/model/elf-cache.cc	Wed Apr 11 10:56:47 2012 +0900
   2.136 -+++ b/model/elf-cache.cc	Wed Apr 11 12:38:04 2012 +0900
   2.137 +diff -r ab266495f633 model/elf-cache.cc
   2.138 +--- a/model/elf-cache.cc	Mon Apr 23 17:29:23 2012 +0900
   2.139 ++++ b/model/elf-cache.cc	Thu Apr 26 09:56:01 2012 +0900
   2.140  @@ -26,6 +26,9 @@
   2.141     overriden.from = "libpthread.so.0";
   2.142     overriden.to = "libpthread-ns3.so";
   2.143 @@ -278,9 +302,9 @@
   2.144   }
   2.145   
   2.146   std::string
   2.147 -diff -r 61ddc5520f14 model/libc-ns3.h
   2.148 ---- a/model/libc-ns3.h	Wed Apr 11 10:56:47 2012 +0900
   2.149 -+++ b/model/libc-ns3.h	Wed Apr 11 12:38:04 2012 +0900
   2.150 +diff -r ab266495f633 model/libc-ns3.h
   2.151 +--- a/model/libc-ns3.h	Mon Apr 23 17:29:23 2012 +0900
   2.152 ++++ b/model/libc-ns3.h	Thu Apr 26 09:56:01 2012 +0900
   2.153  @@ -73,6 +73,7 @@
   2.154   NATIVE (ntohl)
   2.155   NATIVE (ntohs)
   2.156 @@ -289,7 +313,17 @@
   2.157   DCE    (getsockname)
   2.158   DCE    (getpeername)
   2.159   DCE    (bind)
   2.160 -@@ -214,6 +215,7 @@
   2.161 +@@ -99,7 +100,8 @@
   2.162 + NATIVE (strnlen)
   2.163 + // because C++ defines both const and non-const functions
   2.164 + NATIVE_EXPLICIT (strchr, char* (*) (char *, int))
   2.165 +-NATIVE_EXPLICIT (strrchr, char * (*) (char *, int))
   2.166 ++NATIVE_EXPLICIT (strrchr, const char * (*) (const char *, int))
   2.167 ++//DCE (strrchr)
   2.168 + NATIVE (strcasecmp)
   2.169 + NATIVE (strncasecmp)
   2.170 + 
   2.171 +@@ -214,6 +216,7 @@
   2.172   DCE    (setregid)
   2.173   DCE    (setresuid)
   2.174   DCE    (setresgid)
   2.175 @@ -297,7 +331,7 @@
   2.176   NATIVE (inet_aton)
   2.177   NATIVE (inet_ntoa)
   2.178   DCE    (inet_ntop)
   2.179 -@@ -223,6 +225,8 @@
   2.180 +@@ -223,6 +226,8 @@
   2.181   NATIVE (inet_lnaof)
   2.182   NATIVE (inet_netof)
   2.183   NATIVE (inet_addr)
   2.184 @@ -306,7 +340,7 @@
   2.185   DCE    (mmap)
   2.186   DCE    (mmap64)
   2.187   DCE    (munmap)
   2.188 -@@ -254,6 +258,7 @@
   2.189 +@@ -254,6 +259,7 @@
   2.190   DCE    (realloc)
   2.191   DCE    (gettimeofday)
   2.192   DCE    (time)
   2.193 @@ -314,7 +348,7 @@
   2.194   DCE    (isatty)
   2.195   DCE    (send)
   2.196   DCE    (sendto)
   2.197 -@@ -279,6 +284,7 @@
   2.198 +@@ -279,6 +285,7 @@
   2.199   NATIVE (sigaddset)
   2.200   NATIVE (sigdelset)
   2.201   NATIVE (sigismember)
   2.202 @@ -322,7 +356,7 @@
   2.203   DCE_WITH_ALIAS2(strtol, __strtol_internal)
   2.204   DCET    (long long int, strtoll)
   2.205   DCE    (strtoul)
   2.206 -@@ -343,6 +349,13 @@
   2.207 +@@ -343,6 +350,13 @@
   2.208   DCE    (pthread_cond_wait)
   2.209   DCE    (pthread_condattr_destroy)
   2.210   DCE    (pthread_condattr_init)
   2.211 @@ -336,7 +370,7 @@
   2.212   
   2.213   // netdb.h
   2.214   DCE    (gethostbyname)
   2.215 -@@ -381,6 +394,7 @@
   2.216 +@@ -381,6 +395,7 @@
   2.217   DCE    (timerfd_gettime)
   2.218   
   2.219   DCE    (if_nametoindex)
   2.220 @@ -344,7 +378,7 @@
   2.221   DCE    (fork)
   2.222   
   2.223   NATIVE (qsort)
   2.224 -@@ -442,8 +456,8 @@
   2.225 +@@ -442,8 +457,8 @@
   2.226   NATIVE (pathconf)
   2.227   
   2.228   // this is wrong. clock should be changed to DCE implementation
   2.229 @@ -355,17 +389,17 @@
   2.230   
   2.231   // setjmp.h
   2.232   NATIVE (__sigsetjmp)
   2.233 -diff -r 61ddc5520f14 model/librt-ns3.version
   2.234 +diff -r ab266495f633 model/librt-ns3.version
   2.235  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   2.236 -+++ b/model/librt-ns3.version	Wed Apr 11 12:38:04 2012 +0900
   2.237 ++++ b/model/librt-ns3.version	Thu Apr 26 09:56:01 2012 +0900
   2.238  @@ -0,0 +1,4 @@
   2.239  +NS3 {
   2.240  +global:
   2.241  +	librt_setup;
   2.242  +};
   2.243 -diff -r 61ddc5520f14 model/linux-socket-fd-factory.cc
   2.244 ---- a/model/linux-socket-fd-factory.cc	Wed Apr 11 10:56:47 2012 +0900
   2.245 -+++ b/model/linux-socket-fd-factory.cc	Wed Apr 11 12:38:04 2012 +0900
   2.246 +diff -r ab266495f633 model/linux-socket-fd-factory.cc
   2.247 +--- a/model/linux-socket-fd-factory.cc	Mon Apr 23 17:29:23 2012 +0900
   2.248 ++++ b/model/linux-socket-fd-factory.cc	Thu Apr 26 09:56:01 2012 +0900
   2.249  @@ -464,6 +464,7 @@
   2.250   void
   2.251   LinuxSocketFdFactory::SetTask (std::string path, std::string value)
   2.252 @@ -382,9 +416,9 @@
   2.253   
   2.254     while (!m_earlySysfs.empty ())
   2.255       {
   2.256 -diff -r 61ddc5520f14 model/net/dce-if.h
   2.257 ---- a/model/net/dce-if.h	Wed Apr 11 10:56:47 2012 +0900
   2.258 -+++ b/model/net/dce-if.h	Wed Apr 11 12:38:04 2012 +0900
   2.259 +diff -r ab266495f633 model/net/dce-if.h
   2.260 +--- a/model/net/dce-if.h	Mon Apr 23 17:29:23 2012 +0900
   2.261 ++++ b/model/net/dce-if.h	Thu Apr 26 09:56:01 2012 +0900
   2.262  @@ -7,6 +7,7 @@
   2.263   #endif
   2.264   
   2.265 @@ -393,10 +427,10 @@
   2.266   
   2.267   
   2.268   #ifdef __cplusplus
   2.269 -diff -r 61ddc5520f14 model/ns3-socket-fd-factory.cc
   2.270 ---- a/model/ns3-socket-fd-factory.cc	Wed Apr 11 10:56:47 2012 +0900
   2.271 -+++ b/model/ns3-socket-fd-factory.cc	Wed Apr 11 12:38:04 2012 +0900
   2.272 -@@ -143,6 +143,7 @@
   2.273 +diff -r ab266495f633 model/ns3-socket-fd-factory.cc
   2.274 +--- a/model/ns3-socket-fd-factory.cc	Mon Apr 23 17:29:23 2012 +0900
   2.275 ++++ b/model/ns3-socket-fd-factory.cc	Thu Apr 26 09:56:01 2012 +0900
   2.276 +@@ -166,6 +166,7 @@
   2.277     else
   2.278       {
   2.279         NS_FATAL_ERROR ("unsupported domain");
   2.280 @@ -404,9 +438,9 @@
   2.281       }
   2.282   
   2.283     return socket;
   2.284 -diff -r 61ddc5520f14 model/sys/dce-socket.h
   2.285 ---- a/model/sys/dce-socket.h	Wed Apr 11 10:56:47 2012 +0900
   2.286 -+++ b/model/sys/dce-socket.h	Wed Apr 11 12:38:04 2012 +0900
   2.287 +diff -r ab266495f633 model/sys/dce-socket.h
   2.288 +--- a/model/sys/dce-socket.h	Mon Apr 23 17:29:23 2012 +0900
   2.289 ++++ b/model/sys/dce-socket.h	Thu Apr 26 09:56:01 2012 +0900
   2.290  @@ -28,6 +28,7 @@
   2.291   ssize_t dce_sendmsg(int s, const struct msghdr *msg, int flags);
   2.292   int dce_getsockname(int s, struct sockaddr *name, socklen_t *namelen);
   2.293 @@ -415,9 +449,9 @@
   2.294   
   2.295   #ifdef __cplusplus
   2.296   }
   2.297 -diff -r 61ddc5520f14 test/test-select.cc
   2.298 ---- a/test/test-select.cc	Wed Apr 11 10:56:47 2012 +0900
   2.299 -+++ b/test/test-select.cc	Wed Apr 11 12:38:04 2012 +0900
   2.300 +diff -r ab266495f633 test/test-select.cc
   2.301 +--- a/test/test-select.cc	Mon Apr 23 17:29:23 2012 +0900
   2.302 ++++ b/test/test-select.cc	Thu Apr 26 09:56:01 2012 +0900
   2.303  @@ -43,9 +43,20 @@
   2.304     struct timeval timeout =
   2.305     { 0, 0 };
   2.306 @@ -440,9 +474,9 @@
   2.307   }
   2.308   
   2.309   static bool
   2.310 -diff -r 61ddc5520f14 wscript
   2.311 ---- a/wscript	Wed Apr 11 10:56:47 2012 +0900
   2.312 -+++ b/wscript	Wed Apr 11 12:38:04 2012 +0900
   2.313 +diff -r ab266495f633 wscript
   2.314 +--- a/wscript	Mon Apr 23 17:29:23 2012 +0900
   2.315 ++++ b/wscript	Thu Apr 26 09:56:01 2012 +0900
   2.316  @@ -71,6 +71,17 @@
   2.317           conf.end_msg(libpthread, True)
   2.318       conf.env['LIBPTHREAD_FILE'] = libpthread
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/dns_bind9.patch	Fri May 11 17:03:32 2012 +0900
     3.3 @@ -0,0 +1,851 @@
     3.4 +diff -r 7d0d6d7cda40 example/dce-unbound.cc
     3.5 +--- a/example/dce-unbound.cc	Thu Apr 26 11:21:55 2012 +0900
     3.6 ++++ b/example/dce-unbound.cc	Fri Apr 27 19:40:18 2012 +0900
     3.7 +@@ -47,8 +47,8 @@
     3.8 + 
     3.9 +   DceManagerHelper processManager;
    3.10 +   processManager.SetLoader ("ns3::DlmLoaderFactory");
    3.11 +-  // processManager.SetTaskManagerAttribute ("FiberManagerType",
    3.12 +-  //                                         EnumValue (0));
    3.13 ++  processManager.SetTaskManagerAttribute ("FiberManagerType",
    3.14 ++                                          EnumValue (0));
    3.15 +   processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
    3.16 + 				 "Library", StringValue ("libnet-next-2.6.so"));
    3.17 +   processManager.Install (nodes);
    3.18 +@@ -66,12 +66,25 @@
    3.19 +   DceApplicationHelper process;
    3.20 +   ApplicationContainer apps;
    3.21 + 
    3.22 ++#if 0
    3.23 +   process.SetBinary ("unbound");
    3.24 +   process.ResetArguments ();
    3.25 +   process.ParseArguments ("-d");
    3.26 +   process.SetStackSize (1<<16);
    3.27 +   apps = process.Install (nodes.Get (0));
    3.28 +   apps.Start (Seconds (1.0));
    3.29 ++#else
    3.30 ++  process.SetBinary ("named");
    3.31 ++  process.ResetArguments ();
    3.32 ++  process.ParseArguments ("-4");
    3.33 ++  process.ParseArguments ("-u");
    3.34 ++  process.ParseArguments ("root");
    3.35 ++  process.ParseArguments ("-c");
    3.36 ++  process.ParseArguments ("/etc/namedb/named.conf");
    3.37 ++  process.SetStackSize (1<<16);
    3.38 ++  apps = process.Install (nodes.Get (0));
    3.39 ++  apps.Start (Seconds (1.0));
    3.40 ++#endif
    3.41 + 
    3.42 +   for (int i = 0; i < 20; i++)
    3.43 +     {
    3.44 +diff -r 7d0d6d7cda40 model/dce-netdb.cc
    3.45 +--- a/model/dce-netdb.cc	Thu Apr 26 11:21:55 2012 +0900
    3.46 ++++ b/model/dce-netdb.cc	Fri Apr 27 19:40:18 2012 +0900
    3.47 +@@ -8,6 +8,15 @@
    3.48 + #include <string.h>
    3.49 + #include "process.h"
    3.50 + #include "errno.h"
    3.51 ++#include <net/if.h>
    3.52 ++#include <netinet/in.h>
    3.53 ++#include <sys/types.h>
    3.54 ++#include <ifaddrs.h>
    3.55 ++#include <linux/netlink.h>
    3.56 ++#include <linux/rtnetlink.h>
    3.57 ++#include "sys/dce-socket.h"
    3.58 ++#include "dce-unistd.h"
    3.59 ++#include "dce-signal.h"
    3.60 + 
    3.61 + NS_LOG_COMPONENT_DEFINE ("DceNetdb");
    3.62 + 
    3.63 +@@ -188,3 +197,719 @@
    3.64 + 
    3.65 +   fprintf (*Current ()->process->pstderr, "%s : %s\n", string, "ERROR");
    3.66 + }
    3.67 ++
    3.68 ++// Copy from glibc source
    3.69 ++// eglibc-2.11.1/sysdeps/unix/sysv/linux/ifaddr.c
    3.70 ++struct netlink_res
    3.71 ++{
    3.72 ++  struct netlink_res *next;
    3.73 ++  struct nlmsghdr *nlh;
    3.74 ++  size_t size;			/* Size of response.  */
    3.75 ++  uint32_t seq;			/* sequential number we used.  */
    3.76 ++};
    3.77 ++struct netlink_handle
    3.78 ++{
    3.79 ++  int fd;			/* Netlink file descriptor.  */
    3.80 ++  pid_t pid;			/* Process ID.  */
    3.81 ++  uint32_t seq;			/* The sequence number we use currently.  */
    3.82 ++  struct netlink_res *nlm_list;	/* Pointer to list of responses.  */
    3.83 ++  struct netlink_res *end_ptr;	/* For faster append of new entries.  */
    3.84 ++};
    3.85 ++struct sockaddr_ll_max
    3.86 ++  {
    3.87 ++    unsigned short int sll_family;
    3.88 ++    unsigned short int sll_protocol;
    3.89 ++    int sll_ifindex;
    3.90 ++    unsigned short int sll_hatype;
    3.91 ++    unsigned char sll_pkttype;
    3.92 ++    unsigned char sll_halen;
    3.93 ++    unsigned char sll_addr[24];
    3.94 ++  };
    3.95 ++struct ifaddrs_storage
    3.96 ++{
    3.97 ++  struct ifaddrs ifa;
    3.98 ++  union
    3.99 ++  {
   3.100 ++    /* Save space for the biggest of the four used sockaddr types and
   3.101 ++       avoid a lot of casts.  */
   3.102 ++    struct sockaddr sa;
   3.103 ++    struct sockaddr_ll_max sl;
   3.104 ++    struct sockaddr_in s4;
   3.105 ++    struct sockaddr_in6 s6;
   3.106 ++  } addr, netmask, broadaddr;
   3.107 ++  char name[IF_NAMESIZE + 1];
   3.108 ++};
   3.109 ++#define PAGE_SIZE 4096
   3.110 ++static int
   3.111 ++netlink_request (struct netlink_handle *h, int type)
   3.112 ++{
   3.113 ++  int ret;
   3.114 ++  struct sockaddr_nl snl;
   3.115 ++  int save_errno;
   3.116 ++  struct netlink_res *nlm_next;
   3.117 ++  struct sockaddr_nl nladdr;
   3.118 ++  struct nlmsghdr *nlmh;
   3.119 ++  ssize_t read_len;
   3.120 ++  bool done = false;
   3.121 ++
   3.122 ++  struct
   3.123 ++  {
   3.124 ++    struct nlmsghdr nlh;
   3.125 ++    struct rtgenmsg g;
   3.126 ++  } req;
   3.127 ++
   3.128 ++  memset (&snl, 0, sizeof snl);
   3.129 ++  snl.nl_family = AF_NETLINK;
   3.130 ++
   3.131 ++  memset (&req, 0, sizeof req);
   3.132 ++  req.nlh.nlmsg_len = sizeof req;
   3.133 ++  req.nlh.nlmsg_type = type;
   3.134 ++  req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
   3.135 ++  req.nlh.nlmsg_pid = h->pid;
   3.136 ++  req.nlh.nlmsg_seq = ++h->seq;
   3.137 ++  req.g.rtgen_family = AF_UNSPEC;
   3.138 ++
   3.139 ++  ret = dce_sendto (h->fd, (void *) &req, sizeof req, 0,
   3.140 ++                (struct sockaddr *) &snl, sizeof snl);
   3.141 ++  if (ret < 0)
   3.142 ++    {
   3.143 ++      return -1;
   3.144 ++    }
   3.145 ++
   3.146 ++  char *buf;
   3.147 ++  const size_t buf_size = PAGE_SIZE;
   3.148 ++  buf = (char *)dce_malloc (buf_size);
   3.149 ++  if (!buf)
   3.150 ++    return -1;
   3.151 ++  struct iovec iov = { buf, buf_size };
   3.152 ++
   3.153 ++  while (! done)
   3.154 ++    {
   3.155 ++      struct msghdr msg =
   3.156 ++        {
   3.157 ++          (void *) &nladdr, sizeof (nladdr),
   3.158 ++          &iov, 1,
   3.159 ++          NULL, 0,
   3.160 ++          0
   3.161 ++        };
   3.162 ++
   3.163 ++      read_len = dce_recvmsg (h->fd, &msg, 0);
   3.164 ++      if (read_len < 0)
   3.165 ++        goto out_fail;
   3.166 ++
   3.167 ++      if (nladdr.nl_pid != 0)
   3.168 ++        continue;
   3.169 ++
   3.170 ++      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
   3.171 ++        goto out_fail;
   3.172 ++
   3.173 ++      size_t count = 0;
   3.174 ++      size_t remaining_len = read_len;
   3.175 ++      for (nlmh = (struct nlmsghdr *) buf;
   3.176 ++           NLMSG_OK (nlmh, remaining_len);
   3.177 ++           nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
   3.178 ++        {
   3.179 ++          if ((pid_t) nlmh->nlmsg_pid != h->pid
   3.180 ++              || nlmh->nlmsg_seq != h->seq)
   3.181 ++            continue;
   3.182 ++
   3.183 ++          ++count;
   3.184 ++          if (nlmh->nlmsg_type == NLMSG_DONE)
   3.185 ++            {
   3.186 ++              /* We found the end, leave the loop.  */
   3.187 ++              done = true;
   3.188 ++              break;
   3.189 ++            }
   3.190 ++          if (nlmh->nlmsg_type == NLMSG_ERROR)
   3.191 ++            {
   3.192 ++              struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh);
   3.193 ++              if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr)))
   3.194 ++                errno = EIO;
   3.195 ++              else
   3.196 ++                errno = -nlerr->error;
   3.197 ++              goto out_fail;
   3.198 ++            }
   3.199 ++        }
   3.200 ++
   3.201 ++      /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
   3.202 ++         there is no point to record it.  */
   3.203 ++      if (count == 0)
   3.204 ++        continue;
   3.205 ++
   3.206 ++      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
   3.207 ++                                                + read_len);
   3.208 ++      if (nlm_next == NULL)
   3.209 ++        goto out_fail;
   3.210 ++      nlm_next->next = NULL;
   3.211 ++      nlm_next->nlh = (struct nlmsghdr *)memcpy (nlm_next + 1, buf, read_len);
   3.212 ++      nlm_next->size = read_len;
   3.213 ++      nlm_next->seq = h->seq;
   3.214 ++      if (h->nlm_list == NULL)
   3.215 ++        h->nlm_list = nlm_next;
   3.216 ++      else
   3.217 ++        h->end_ptr->next = nlm_next;
   3.218 ++      h->end_ptr = nlm_next;
   3.219 ++    }
   3.220 ++
   3.221 ++  dce_free (buf);
   3.222 ++  return 0;
   3.223 ++
   3.224 ++out_fail:
   3.225 ++  dce_free (buf);
   3.226 ++  return -1;
   3.227 ++}
   3.228 ++
   3.229 ++static int
   3.230 ++map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max)
   3.231 ++{
   3.232 ++  int i;
   3.233 ++
   3.234 ++  for (i = 0; i < max; i++)
   3.235 ++    {
   3.236 ++      if (map[i] == -1)
   3.237 ++	{
   3.238 ++	  map[i] = index;
   3.239 ++	  if (i > 0)
   3.240 ++	    ifas[i - 1].ifa.ifa_next = &ifas[i].ifa;
   3.241 ++	  return i;
   3.242 ++	}
   3.243 ++      else if (map[i] == index)
   3.244 ++	return i;
   3.245 ++    }
   3.246 ++  /* This should never be reached. If this will be reached, we have
   3.247 ++     a very big problem.  */
   3.248 ++  dce_abort ();
   3.249 ++}
   3.250 ++
   3.251 ++static void
   3.252 ++__netlink_free_handle (struct netlink_handle *h)
   3.253 ++{
   3.254 ++  struct netlink_res *ptr;
   3.255 ++  int saved_errno = errno;
   3.256 ++
   3.257 ++  ptr = h->nlm_list;
   3.258 ++  while (ptr != NULL)
   3.259 ++    {
   3.260 ++      struct netlink_res *tmpptr;
   3.261 ++
   3.262 ++      tmpptr = ptr->next;
   3.263 ++      free (ptr);
   3.264 ++      ptr = tmpptr;
   3.265 ++    }
   3.266 ++
   3.267 ++  Current ()->err = saved_errno;
   3.268 ++}
   3.269 ++
   3.270 ++/*
   3.271 ++ * Try to emulate netlink socket query to work both ns3 stack and
   3.272 ++ * linux stack.
   3.273 ++ */
   3.274 ++int
   3.275 ++dce_getifaddrs (struct ifaddrs **ifap)
   3.276 ++{
   3.277 ++  struct netlink_handle nh = {0, 0, 0, NULL, NULL};
   3.278 ++  struct sockaddr_nl nladdr;
   3.279 ++  struct netlink_res *nlp;
   3.280 ++  struct ifaddrs_storage *ifas;
   3.281 ++  unsigned int i, newlink, newaddr, newaddr_idx;
   3.282 ++  int *map_newlink_data;
   3.283 ++  size_t ifa_data_size = 0;  /* Size to allocate for all ifa_data.  */
   3.284 ++  char *ifa_data_ptr;	/* Pointer to the unused part of memory for
   3.285 ++                           ifa_data.  */
   3.286 ++  int result = 0;
   3.287 ++
   3.288 ++  nh.fd = dce_socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
   3.289 ++  if (nh.fd < 0)
   3.290 ++    {
   3.291 ++      Current ()->err = EINVAL;
   3.292 ++      return -1;
   3.293 ++    }
   3.294 ++
   3.295 ++  memset (&nladdr, 0, sizeof (nladdr));
   3.296 ++  nladdr.nl_family = AF_NETLINK;
   3.297 ++  if (dce_bind (nh.fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0)
   3.298 ++    {
   3.299 ++      dce_close (nh.fd);
   3.300 ++      Current ()->err = EINVAL;
   3.301 ++      return -1;
   3.302 ++    }
   3.303 ++  socklen_t addr_len = sizeof (nladdr);
   3.304 ++  if (dce_getsockname (nh.fd, (struct sockaddr *) &nladdr, &addr_len) < 0)
   3.305 ++    {
   3.306 ++      dce_close (nh.fd);
   3.307 ++      Current ()->err = EINVAL;
   3.308 ++      return -1;
   3.309 ++    }
   3.310 ++  nh.pid = nladdr.nl_pid;
   3.311 ++
   3.312 ++
   3.313 ++  if (netlink_request (&nh, RTM_GETLINK) < 0)
   3.314 ++    {
   3.315 ++      dce_close (nh.fd);
   3.316 ++      Current ()->err = EINVAL;
   3.317 ++      return -1;
   3.318 ++    }
   3.319 ++
   3.320 ++  ++nh.seq;
   3.321 ++  if (netlink_request (&nh, RTM_GETADDR) < 0)
   3.322 ++    {
   3.323 ++      dce_close (nh.fd);
   3.324 ++      Current ()->err = EINVAL;
   3.325 ++      return -1;
   3.326 ++    }
   3.327 ++
   3.328 ++
   3.329 ++
   3.330 ++  newlink = newaddr = 0;
   3.331 ++  for (nlp = nh.nlm_list; nlp; nlp = nlp->next)
   3.332 ++    {
   3.333 ++      struct nlmsghdr *nlh;
   3.334 ++      size_t size = nlp->size;
   3.335 ++
   3.336 ++      if (nlp->nlh == NULL)
   3.337 ++	continue;
   3.338 ++
   3.339 ++      /* Walk through all entries we got from the kernel and look, which
   3.340 ++	 message type they contain.  */
   3.341 ++      for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
   3.342 ++	{
   3.343 ++	  /* Check if the message is what we want.  */
   3.344 ++	  if ((pid_t) nlh->nlmsg_pid != nh.pid || nlh->nlmsg_seq != nlp->seq)
   3.345 ++	    continue;
   3.346 ++
   3.347 ++	  if (nlh->nlmsg_type == NLMSG_DONE)
   3.348 ++	    break;		/* ok */
   3.349 ++
   3.350 ++	  if (nlh->nlmsg_type == RTM_NEWLINK)
   3.351 ++	    {
   3.352 ++	      /* A RTM_NEWLINK message can have IFLA_STATS data. We need to
   3.353 ++		 know the size before creating the list to allocate enough
   3.354 ++		 memory.  */
   3.355 ++	      struct ifinfomsg *ifim = (struct ifinfomsg *) NLMSG_DATA (nlh);
   3.356 ++	      struct rtattr *rta = IFLA_RTA (ifim);
   3.357 ++	      size_t rtasize = IFLA_PAYLOAD (nlh);
   3.358 ++
   3.359 ++	      while (RTA_OK (rta, rtasize))
   3.360 ++		{
   3.361 ++		  size_t rta_payload = RTA_PAYLOAD (rta);
   3.362 ++
   3.363 ++		  if (rta->rta_type == IFLA_STATS)
   3.364 ++		    {
   3.365 ++		      ifa_data_size += rta_payload;
   3.366 ++		      break;
   3.367 ++		    }
   3.368 ++		  else
   3.369 ++		    rta = RTA_NEXT (rta, rtasize);
   3.370 ++		}
   3.371 ++	      ++newlink;
   3.372 ++	    }
   3.373 ++	  else if (nlh->nlmsg_type == RTM_NEWADDR)
   3.374 ++	    ++newaddr;
   3.375 ++	}
   3.376 ++    }
   3.377 ++
   3.378 ++  /* Return if no interface is up.  */
   3.379 ++  if ((newlink + newaddr) == 0)
   3.380 ++    goto exit_free;
   3.381 ++
   3.382 ++  /* Allocate memory for all entries we have and initialize next
   3.383 ++     pointer.  */
   3.384 ++  ifas = (struct ifaddrs_storage *) calloc (1,
   3.385 ++					    (newlink + newaddr)
   3.386 ++					    * sizeof (struct ifaddrs_storage)
   3.387 ++					    + ifa_data_size);
   3.388 ++  if (ifas == NULL)
   3.389 ++    {
   3.390 ++      result = -1;
   3.391 ++      goto exit_free;
   3.392 ++    }
   3.393 ++
   3.394 ++  /* Table for mapping kernel index to entry in our list.  */
   3.395 ++  map_newlink_data = (int *)alloca (newlink * sizeof (int));
   3.396 ++  memset (map_newlink_data, '\xff', newlink * sizeof (int));
   3.397 ++
   3.398 ++  ifa_data_ptr = (char *) &ifas[newlink + newaddr];
   3.399 ++  newaddr_idx = 0;		/* Counter for newaddr index.  */
   3.400 ++
   3.401 ++  /* Walk through the list of data we got from the kernel.  */
   3.402 ++  for (nlp = nh.nlm_list; nlp; nlp = nlp->next)
   3.403 ++    {
   3.404 ++      struct nlmsghdr *nlh;
   3.405 ++      size_t size = nlp->size;
   3.406 ++
   3.407 ++      if (nlp->nlh == NULL)
   3.408 ++	continue;
   3.409 ++
   3.410 ++      /* Walk through one message and look at the type: If it is our
   3.411 ++	 message, we need RTM_NEWLINK/RTM_NEWADDR and stop if we reach
   3.412 ++	 the end or we find the end marker (in this case we ignore the
   3.413 ++	 following data.  */
   3.414 ++      for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
   3.415 ++	{
   3.416 ++	  int ifa_index = 0;
   3.417 ++
   3.418 ++	  /* Check if the message is the one we want */
   3.419 ++	  if ((pid_t) nlh->nlmsg_pid != nh.pid || nlh->nlmsg_seq != nlp->seq)
   3.420 ++	    continue;
   3.421 ++
   3.422 ++	  if (nlh->nlmsg_type == NLMSG_DONE)
   3.423 ++	    break;		/* ok */
   3.424 ++
   3.425 ++	  if (nlh->nlmsg_type == RTM_NEWLINK)
   3.426 ++	    {
   3.427 ++	      /* We found a new interface. Now extract everything from the
   3.428 ++		 interface data we got and need.  */
   3.429 ++	      struct ifinfomsg *ifim = (struct ifinfomsg *) NLMSG_DATA (nlh);
   3.430 ++	      struct rtattr *rta = IFLA_RTA (ifim);
   3.431 ++	      size_t rtasize = IFLA_PAYLOAD (nlh);
   3.432 ++
   3.433 ++	      /* Interfaces are stored in the first "newlink" entries
   3.434 ++		 of our list, starting in the order as we got from the
   3.435 ++		 kernel.  */
   3.436 ++	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
   3.437 ++				       map_newlink_data, newlink);
   3.438 ++	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
   3.439 ++
   3.440 ++	      while (RTA_OK (rta, rtasize))
   3.441 ++		{
   3.442 ++		  char *rta_data = (char *)RTA_DATA (rta);
   3.443 ++		  size_t rta_payload = RTA_PAYLOAD (rta);
   3.444 ++
   3.445 ++		  switch (rta->rta_type)
   3.446 ++		    {
   3.447 ++		    case IFLA_ADDRESS:
   3.448 ++		      if (rta_payload <= sizeof (ifas[ifa_index].addr))
   3.449 ++			{
   3.450 ++			  ifas[ifa_index].addr.sl.sll_family = AF_PACKET;
   3.451 ++			  memcpy (ifas[ifa_index].addr.sl.sll_addr,
   3.452 ++				  (char *) rta_data, rta_payload);
   3.453 ++			  ifas[ifa_index].addr.sl.sll_halen = rta_payload;
   3.454 ++			  ifas[ifa_index].addr.sl.sll_ifindex
   3.455 ++			    = ifim->ifi_index;
   3.456 ++			  ifas[ifa_index].addr.sl.sll_hatype = ifim->ifi_type;
   3.457 ++
   3.458 ++			  ifas[ifa_index].ifa.ifa_addr
   3.459 ++			    = &ifas[ifa_index].addr.sa;
   3.460 ++			}
   3.461 ++		      break;
   3.462 ++
   3.463 ++		    case IFLA_BROADCAST:
   3.464 ++		      if (rta_payload <= sizeof (ifas[ifa_index].broadaddr))
   3.465 ++			{
   3.466 ++			  ifas[ifa_index].broadaddr.sl.sll_family = AF_PACKET;
   3.467 ++			  memcpy (ifas[ifa_index].broadaddr.sl.sll_addr,
   3.468 ++				  (char *) rta_data, rta_payload);
   3.469 ++			  ifas[ifa_index].broadaddr.sl.sll_halen = rta_payload;
   3.470 ++			  ifas[ifa_index].broadaddr.sl.sll_ifindex
   3.471 ++			    = ifim->ifi_index;
   3.472 ++			  ifas[ifa_index].broadaddr.sl.sll_hatype
   3.473 ++			    = ifim->ifi_type;
   3.474 ++
   3.475 ++			  ifas[ifa_index].ifa.ifa_broadaddr
   3.476 ++			    = &ifas[ifa_index].broadaddr.sa;
   3.477 ++			}
   3.478 ++		      break;
   3.479 ++
   3.480 ++		    case IFLA_IFNAME:	/* Name of Interface */
   3.481 ++		      if ((rta_payload + 1) <= sizeof (ifas[ifa_index].name))
   3.482 ++			{
   3.483 ++			  ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
   3.484 ++			  *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
   3.485 ++					       rta_payload) = '\0';
   3.486 ++			}
   3.487 ++		      break;
   3.488 ++
   3.489 ++		    case IFLA_STATS:	/* Statistics of Interface */
   3.490 ++		      ifas[ifa_index].ifa.ifa_data = ifa_data_ptr;
   3.491 ++		      ifa_data_ptr += rta_payload;
   3.492 ++		      memcpy (ifas[ifa_index].ifa.ifa_data, rta_data,
   3.493 ++			      rta_payload);
   3.494 ++		      break;
   3.495 ++
   3.496 ++		    case IFLA_UNSPEC:
   3.497 ++		      break;
   3.498 ++		    case IFLA_MTU:
   3.499 ++		      break;
   3.500 ++		    case IFLA_LINK:
   3.501 ++		      break;
   3.502 ++		    case IFLA_QDISC:
   3.503 ++		      break;
   3.504 ++		    default:
   3.505 ++		      break;
   3.506 ++		    }
   3.507 ++
   3.508 ++		  rta = RTA_NEXT (rta, rtasize);
   3.509 ++		}
   3.510 ++	    }
   3.511 ++	  else if (nlh->nlmsg_type == RTM_NEWADDR)
   3.512 ++	    {
   3.513 ++	      struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlh);
   3.514 ++	      struct rtattr *rta = IFA_RTA (ifam);
   3.515 ++	      size_t rtasize = IFA_PAYLOAD (nlh);
   3.516 ++
   3.517 ++	      /* New Addresses are stored in the order we got them from
   3.518 ++		 the kernel after the interfaces. Theoretically it is possible
   3.519 ++		 that we have holes in the interface part of the list,
   3.520 ++		 but we always have already the interface for this address.  */
   3.521 ++	      ifa_index = newlink + newaddr_idx;
   3.522 ++	      ifas[ifa_index].ifa.ifa_flags
   3.523 ++		= ifas[map_newlink (ifam->ifa_index - 1, ifas,
   3.524 ++				    map_newlink_data, newlink)].ifa.ifa_flags;
   3.525 ++	      if (ifa_index > 0)
   3.526 ++		ifas[ifa_index - 1].ifa.ifa_next = &ifas[ifa_index].ifa;
   3.527 ++	      ++newaddr_idx;
   3.528 ++
   3.529 ++	      while (RTA_OK (rta, rtasize))
   3.530 ++		{
   3.531 ++		  char *rta_data = (char *)RTA_DATA (rta);
   3.532 ++		  size_t rta_payload = RTA_PAYLOAD (rta);
   3.533 ++
   3.534 ++		  switch (rta->rta_type)
   3.535 ++		    {
   3.536 ++		    case IFA_ADDRESS:
   3.537 ++		      {
   3.538 ++			struct sockaddr *sa;
   3.539 ++
   3.540 ++			if (ifas[ifa_index].ifa.ifa_addr != NULL)
   3.541 ++			  {
   3.542 ++			    /* In a point-to-poing network IFA_ADDRESS
   3.543 ++			       contains the destination address, local
   3.544 ++			       address is supplied in IFA_LOCAL attribute.
   3.545 ++			       destination address and broadcast address
   3.546 ++			       are stored in an union, so it doesn't matter
   3.547 ++			       which name we use.  */
   3.548 ++			    ifas[ifa_index].ifa.ifa_broadaddr
   3.549 ++			      = &ifas[ifa_index].broadaddr.sa;
   3.550 ++			    sa = &ifas[ifa_index].broadaddr.sa;
   3.551 ++			  }
   3.552 ++			else
   3.553 ++			  {
   3.554 ++			    ifas[ifa_index].ifa.ifa_addr
   3.555 ++			      = &ifas[ifa_index].addr.sa;
   3.556 ++			    sa = &ifas[ifa_index].addr.sa;
   3.557 ++			  }
   3.558 ++
   3.559 ++			sa->sa_family = ifam->ifa_family;
   3.560 ++
   3.561 ++			switch (ifam->ifa_family)
   3.562 ++			  {
   3.563 ++			  case AF_INET:
   3.564 ++			    /* Size must match that of an address for IPv4.  */
   3.565 ++			    if (rta_payload == 4)
   3.566 ++			      memcpy (&((struct sockaddr_in *) sa)->sin_addr,
   3.567 ++				      rta_data, rta_payload);
   3.568 ++			    break;
   3.569 ++
   3.570 ++			  case AF_INET6:
   3.571 ++			    /* Size must match that of an address for IPv6.  */
   3.572 ++			    if (rta_payload == 16)
   3.573 ++			      {
   3.574 ++				memcpy (&((struct sockaddr_in6 *) sa)->sin6_addr,
   3.575 ++					rta_data, rta_payload);
   3.576 ++				if (IN6_IS_ADDR_LINKLOCAL (rta_data)
   3.577 ++				    || IN6_IS_ADDR_MC_LINKLOCAL (rta_data))
   3.578 ++				  ((struct sockaddr_in6 *) sa)->sin6_scope_id
   3.579 ++				    = ifam->ifa_index;
   3.580 ++			      }
   3.581 ++			    break;
   3.582 ++
   3.583 ++			  default:
   3.584 ++			    if (rta_payload <= sizeof (ifas[ifa_index].addr))
   3.585 ++			      memcpy (sa->sa_data, rta_data, rta_payload);
   3.586 ++			    break;
   3.587 ++			  }
   3.588 ++		      }
   3.589 ++		      break;
   3.590 ++
   3.591 ++		    case IFA_LOCAL:
   3.592 ++		      if (ifas[ifa_index].ifa.ifa_addr != NULL)
   3.593 ++			{
   3.594 ++			  /* If ifa_addr is set and we get IFA_LOCAL,
   3.595 ++			     assume we have a point-to-point network.
   3.596 ++			     Move address to correct field.  */
   3.597 ++			  ifas[ifa_index].broadaddr = ifas[ifa_index].addr;
   3.598 ++			  ifas[ifa_index].ifa.ifa_broadaddr
   3.599 ++			    = &ifas[ifa_index].broadaddr.sa;
   3.600 ++			  memset (&ifas[ifa_index].addr, '\0',
   3.601 ++				  sizeof (ifas[ifa_index].addr));
   3.602 ++			}
   3.603 ++
   3.604 ++		      ifas[ifa_index].ifa.ifa_addr = &ifas[ifa_index].addr.sa;
   3.605 ++		      ifas[ifa_index].ifa.ifa_addr->sa_family
   3.606 ++			= ifam->ifa_family;
   3.607 ++
   3.608 ++		      switch (ifam->ifa_family)
   3.609 ++			{
   3.610 ++			case AF_INET:
   3.611 ++			  /* Size must match that of an address for IPv4.  */
   3.612 ++			  if (rta_payload == 4)
   3.613 ++			    memcpy (&ifas[ifa_index].addr.s4.sin_addr,
   3.614 ++				  rta_data, rta_payload);
   3.615 ++			  break;
   3.616 ++
   3.617 ++			case AF_INET6:
   3.618 ++			  /* Size must match that of an address for IPv6.  */
   3.619 ++			  if (rta_payload == 16)
   3.620 ++			    {
   3.621 ++			      memcpy (&ifas[ifa_index].addr.s6.sin6_addr,
   3.622 ++				      rta_data, rta_payload);
   3.623 ++			      if (IN6_IS_ADDR_LINKLOCAL (rta_data)
   3.624 ++				  || IN6_IS_ADDR_MC_LINKLOCAL (rta_data))
   3.625 ++				ifas[ifa_index].addr.s6.sin6_scope_id =
   3.626 ++				  ifam->ifa_index;
   3.627 ++			    }
   3.628 ++			  break;
   3.629 ++
   3.630 ++			default:
   3.631 ++			  if (rta_payload <= sizeof (ifas[ifa_index].addr))
   3.632 ++			    memcpy (ifas[ifa_index].addr.sa.sa_data,
   3.633 ++				    rta_data, rta_payload);
   3.634 ++			  break;
   3.635 ++			}
   3.636 ++		      break;
   3.637 ++
   3.638 ++		    case IFA_BROADCAST:
   3.639 ++		      /* We get IFA_BROADCAST, so IFA_LOCAL was too much.  */
   3.640 ++		      if (ifas[ifa_index].ifa.ifa_broadaddr != NULL)
   3.641 ++			memset (&ifas[ifa_index].broadaddr, '\0',
   3.642 ++				sizeof (ifas[ifa_index].broadaddr));
   3.643 ++
   3.644 ++		      ifas[ifa_index].ifa.ifa_broadaddr
   3.645 ++			= &ifas[ifa_index].broadaddr.sa;
   3.646 ++		      ifas[ifa_index].ifa.ifa_broadaddr->sa_family
   3.647 ++			= ifam->ifa_family;
   3.648 ++
   3.649 ++		      switch (ifam->ifa_family)
   3.650 ++			{
   3.651 ++			case AF_INET:
   3.652 ++			  /* Size must match that of an address for IPv4.  */
   3.653 ++			  if (rta_payload == 4)
   3.654 ++			    memcpy (&ifas[ifa_index].broadaddr.s4.sin_addr,
   3.655 ++				    rta_data, rta_payload);
   3.656 ++			  break;
   3.657 ++
   3.658 ++			case AF_INET6:
   3.659 ++			  /* Size must match that of an address for IPv6.  */
   3.660 ++			  if (rta_payload == 16)
   3.661 ++			    {
   3.662 ++			      memcpy (&ifas[ifa_index].broadaddr.s6.sin6_addr,
   3.663 ++				      rta_data, rta_payload);
   3.664 ++			      if (IN6_IS_ADDR_LINKLOCAL (rta_data)
   3.665 ++				  || IN6_IS_ADDR_MC_LINKLOCAL (rta_data))
   3.666 ++				ifas[ifa_index].broadaddr.s6.sin6_scope_id
   3.667 ++				  = ifam->ifa_index;
   3.668 ++			    }
   3.669 ++			  break;
   3.670 ++
   3.671 ++			default:
   3.672 ++			  if (rta_payload <= sizeof (ifas[ifa_index].addr))
   3.673 ++			    memcpy (&ifas[ifa_index].broadaddr.sa.sa_data,
   3.674 ++				    rta_data, rta_payload);
   3.675 ++			  break;
   3.676 ++			}
   3.677 ++		      break;
   3.678 ++
   3.679 ++		    case IFA_LABEL:
   3.680 ++		      if (rta_payload + 1 <= sizeof (ifas[ifa_index].name))
   3.681 ++			{
   3.682 ++			  ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
   3.683 ++			  *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
   3.684 ++					       rta_payload) = '\0';
   3.685 ++			}
   3.686 ++		      else
   3.687 ++			abort ();
   3.688 ++		      break;
   3.689 ++
   3.690 ++		    case IFA_UNSPEC:
   3.691 ++		      break;
   3.692 ++		    case IFA_CACHEINFO:
   3.693 ++		      break;
   3.694 ++		    default:
   3.695 ++		      break;
   3.696 ++		    }
   3.697 ++
   3.698 ++		  rta = RTA_NEXT (rta, rtasize);
   3.699 ++		}
   3.700 ++
   3.701 ++	      /* If we didn't get the interface name with the
   3.702 ++		 address, use the name from the interface entry.  */
   3.703 ++	      if (ifas[ifa_index].ifa.ifa_name == NULL)
   3.704 ++		ifas[ifa_index].ifa.ifa_name
   3.705 ++		  = ifas[map_newlink (ifam->ifa_index - 1, ifas,
   3.706 ++				      map_newlink_data, newlink)].ifa.ifa_name;
   3.707 ++
   3.708 ++	      /* Calculate the netmask.  */
   3.709 ++	      if (ifas[ifa_index].ifa.ifa_addr
   3.710 ++		  && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_UNSPEC
   3.711 ++		  && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_PACKET)
   3.712 ++		{
   3.713 ++		  uint32_t max_prefixlen = 0;
   3.714 ++		  char *cp = NULL;
   3.715 ++
   3.716 ++		  ifas[ifa_index].ifa.ifa_netmask
   3.717 ++		    = &ifas[ifa_index].netmask.sa;
   3.718 ++
   3.719 ++		  switch (ifas[ifa_index].ifa.ifa_addr->sa_family)
   3.720 ++		    {
   3.721 ++		    case AF_INET:
   3.722 ++		      cp = (char *) &ifas[ifa_index].netmask.s4.sin_addr;
   3.723 ++		      max_prefixlen = 32;
   3.724 ++		      break;
   3.725 ++
   3.726 ++		    case AF_INET6:
   3.727 ++		      cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr;
   3.728 ++		      max_prefixlen = 128;
   3.729 ++		      break;
   3.730 ++		    }
   3.731 ++
   3.732 ++		  ifas[ifa_index].ifa.ifa_netmask->sa_family
   3.733 ++		    = ifas[ifa_index].ifa.ifa_addr->sa_family;
   3.734 ++
   3.735 ++		  if (cp != NULL)
   3.736 ++		    {
   3.737 ++		      char c;
   3.738 ++		      unsigned int preflen;
   3.739 ++
   3.740 ++		      if ((max_prefixlen > 0) &&
   3.741 ++			  (ifam->ifa_prefixlen > max_prefixlen))
   3.742 ++			preflen = max_prefixlen;
   3.743 ++		      else
   3.744 ++			preflen = ifam->ifa_prefixlen;
   3.745 ++
   3.746 ++		      for (i = 0; i < (preflen / 8); i++)
   3.747 ++			*cp++ = 0xff;
   3.748 ++		      c = 0xff;
   3.749 ++		      c <<= (8 - (preflen % 8));
   3.750 ++		      *cp = c;
   3.751 ++		    }
   3.752 ++		}
   3.753 ++	    }
   3.754 ++	}
   3.755 ++    }
   3.756 ++
   3.757 ++  NS_ASSERT (ifa_data_ptr <= (char *) &ifas[newlink + newaddr] + ifa_data_size);
   3.758 ++
   3.759 ++  if (newaddr_idx > 0)
   3.760 ++    {
   3.761 ++      for (i = 0; i < newlink; ++i)
   3.762 ++	if (map_newlink_data[i] == -1)
   3.763 ++	  {
   3.764 ++	    /* We have fewer links then we anticipated.  Adjust the
   3.765 ++	       forward pointer to the first address entry.  */
   3.766 ++	    ifas[i - 1].ifa.ifa_next = &ifas[newlink].ifa;
   3.767 ++	  }
   3.768 ++
   3.769 ++      if (i == 0 && newlink > 0)
   3.770 ++	/* No valid link, but we allocated memory.  We have to
   3.771 ++	   populate the first entry.  */
   3.772 ++	memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage));
   3.773 ++    }
   3.774 ++
   3.775 ++  *ifap = &ifas[0].ifa;
   3.776 ++
   3.777 ++ exit_free:
   3.778 ++  __netlink_free_handle (&nh);
   3.779 ++  dce_close (nh.fd);
   3.780 ++
   3.781 ++  return 0;
   3.782 ++}
   3.783 +diff -r 7d0d6d7cda40 model/dce-netdb.h
   3.784 +--- a/model/dce-netdb.h	Thu Apr 26 11:21:55 2012 +0900
   3.785 ++++ b/model/dce-netdb.h	Fri Apr 27 19:40:18 2012 +0900
   3.786 +@@ -18,6 +18,7 @@
   3.787 +                        socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
   3.788 + 
   3.789 + void dce_herror(const char *string);
   3.790 ++int dce_getifaddrs (struct ifaddrs **ifap);
   3.791 + 
   3.792 + #ifdef __cplusplus
   3.793 + }
   3.794 +diff -r 7d0d6d7cda40 model/dce-syslog.cc
   3.795 +--- a/model/dce-syslog.cc	Thu Apr 26 11:21:55 2012 +0900
   3.796 ++++ b/model/dce-syslog.cc	Fri Apr 27 19:40:18 2012 +0900
   3.797 +@@ -66,6 +66,7 @@
   3.798 +   Process *process = Current ()->process;
   3.799 + 
   3.800 +   vfprintf (process->syslog, message, args);
   3.801 ++  fprintf (process->syslog, "\n");
   3.802 + }
   3.803 + 
   3.804 + void
   3.805 +diff -r 7d0d6d7cda40 model/libc-dce.cc
   3.806 +--- a/model/libc-dce.cc	Thu Apr 26 11:21:55 2012 +0900
   3.807 ++++ b/model/libc-dce.cc	Fri Apr 27 19:40:18 2012 +0900
   3.808 +@@ -89,6 +89,7 @@
   3.809 + #include <inttypes.h>
   3.810 + #include <error.h>
   3.811 + #include <netinet/ether.h>
   3.812 ++#include <nl_types.h>
   3.813 + 
   3.814 + extern void __cxa_finalize (void *d);
   3.815 + extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
   3.816 +diff -r 7d0d6d7cda40 model/libc-ns3.h
   3.817 +--- a/model/libc-ns3.h	Thu Apr 26 11:21:55 2012 +0900
   3.818 ++++ b/model/libc-ns3.h	Fri Apr 27 19:40:18 2012 +0900
   3.819 +@@ -167,6 +167,8 @@
   3.820 + DCE_WITH_ALIAS2 (fileno,fileno_unlocked)
   3.821 + 
   3.822 + DCE    (perror)
   3.823 ++NATIVE (flockfile)
   3.824 ++NATIVE (funlockfile)
   3.825 + 
   3.826 + // stdarg
   3.827 + DCE    (vprintf)
   3.828 +@@ -369,6 +371,8 @@
   3.829 + DCE    (gethostbyname)
   3.830 + DCE    (gethostbyname2)
   3.831 + DCE    (getaddrinfo)
   3.832 ++DCE    (getifaddrs)
   3.833 ++NATIVE (freeifaddrs)
   3.834 + // these three calls will effectively use /etc/passwd on the base system 
   3.835 + NATIVE (gethostent)
   3.836 + NATIVE (sethostent)
   3.837 +@@ -440,6 +444,8 @@
   3.838 + 
   3.839 + // sys/resource.h
   3.840 + NATIVE (getrusage) // not sure if native call will give stats about the requested process..
   3.841 ++NATIVE (getrlimit)
   3.842 ++NATIVE (setrlimit)
   3.843 + 
   3.844 + // syslog.h
   3.845 + DCE    (openlog)
   3.846 +@@ -478,6 +484,8 @@
   3.847 + NATIVE (bindtextdomain)
   3.848 + NATIVE (textdomain)
   3.849 + NATIVE (gettext)
   3.850 ++NATIVE (catopen)
   3.851 ++NATIVE (catgets)
   3.852 + 
   3.853 + // signal.h
   3.854 + DCE (sigprocmask)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/dns_unbound.patch	Fri May 11 17:03:32 2012 +0900
     4.3 @@ -0,0 +1,424 @@
     4.4 +diff -r 6a5297994128 example/dce-unbound.cc
     4.5 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.6 ++++ b/example/dce-unbound.cc	Thu Apr 26 11:21:55 2012 +0900
     4.7 +@@ -0,0 +1,98 @@
     4.8 ++#include "ns3/core-module.h"
     4.9 ++#include "ns3/network-module.h"
    4.10 ++#include "ns3/dce-module.h"
    4.11 ++#include "ns3/point-to-point-module.h"
    4.12 ++#include "ns3/csma-module.h"
    4.13 ++#include "ns3/wifi-module.h"
    4.14 ++#include "ns3/mobility-module.h"
    4.15 ++#include <fstream>
    4.16 ++
    4.17 ++using namespace ns3;
    4.18 ++
    4.19 ++static void RunIp (Ptr<Node> node, Time at, std::string str)
    4.20 ++{
    4.21 ++  DceApplicationHelper process;
    4.22 ++  ApplicationContainer apps;
    4.23 ++  process.SetBinary ("ip");
    4.24 ++  process.SetStackSize (1<<16);
    4.25 ++  process.ResetArguments();
    4.26 ++  process.ParseArguments(str.c_str ());
    4.27 ++  apps = process.Install (node);
    4.28 ++  apps.Start (at);
    4.29 ++}
    4.30 ++
    4.31 ++static void AddAddress (Ptr<Node> node, Time at, const char *name, const std::string prefixAddr,
    4.32 ++                        int number, std::string suffixAddr)
    4.33 ++{
    4.34 ++  std::ostringstream oss;
    4.35 ++  oss << "-f inet addr add " << prefixAddr << number << suffixAddr << " dev " << name;
    4.36 ++  RunIp (node, at, oss.str ());
    4.37 ++}
    4.38 ++
    4.39 ++int main (int argc, char *argv[])
    4.40 ++{
    4.41 ++  CommandLine cmd;
    4.42 ++  cmd.Parse (argc, argv);
    4.43 ++
    4.44 ++  NodeContainer nodes;
    4.45 ++  nodes.Create (2);
    4.46 ++
    4.47 ++  NetDeviceContainer devices;
    4.48 ++
    4.49 ++  PointToPointHelper p2p;
    4.50 ++  p2p.SetDeviceAttribute ("DataRate", StringValue ("5Gbps"));
    4.51 ++  p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
    4.52 ++  devices = p2p.Install (nodes);
    4.53 ++  p2p.EnablePcapAll ("process-unbound");
    4.54 ++
    4.55 ++  DceManagerHelper processManager;
    4.56 ++  processManager.SetLoader ("ns3::DlmLoaderFactory");
    4.57 ++  // processManager.SetTaskManagerAttribute ("FiberManagerType",
    4.58 ++  //                                         EnumValue (0));
    4.59 ++  processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
    4.60 ++				 "Library", StringValue ("libnet-next-2.6.so"));
    4.61 ++  processManager.Install (nodes);
    4.62 ++
    4.63 ++  for (int n=0; n < 2; n++)
    4.64 ++    {
    4.65 ++      AddAddress (nodes.Get (n), Seconds (0.1), "sim0", "10.0.0.", 2 + n, "/8" );
    4.66 ++      RunIp (nodes.Get (n), Seconds (0.11), "link set sim0 up arp off");
    4.67 ++      RunIp (nodes.Get (n), Seconds (0.2), "link show");
    4.68 ++      RunIp (nodes.Get (n), Seconds (0.3), "route show table all");
    4.69 ++      RunIp (nodes.Get (n), Seconds (0.4), "addr list");
    4.70 ++    }
    4.71 ++  RunIp (nodes.Get (1), Seconds (1.2), "route add default via 10.0.0.2 dev sim0");
    4.72 ++
    4.73 ++  DceApplicationHelper process;
    4.74 ++  ApplicationContainer apps;
    4.75 ++
    4.76 ++  process.SetBinary ("unbound");
    4.77 ++  process.ResetArguments ();
    4.78 ++  process.ParseArguments ("-d");
    4.79 ++  process.SetStackSize (1<<16);
    4.80 ++  apps = process.Install (nodes.Get (0));
    4.81 ++  apps.Start (Seconds (1.0));
    4.82 ++
    4.83 ++  for (int i = 0; i < 20; i++)
    4.84 ++    {
    4.85 ++      process.SetBinary ("unbound-host");
    4.86 ++      process.ResetArguments ();
    4.87 ++      process.ParseArguments ("www.example.com");
    4.88 ++      process.ParseArguments ("-d");
    4.89 ++      process.ParseArguments ("-d");
    4.90 ++      process.ParseArguments ("-v");
    4.91 ++      process.ParseArguments ("-r");
    4.92 ++      process.ParseArguments ("-f");
    4.93 ++      process.ParseArguments ("/etc/root.key");
    4.94 ++      apps = process.Install (nodes.Get (1));
    4.95 ++
    4.96 ++      apps.Start (Seconds (1+ 10*i));
    4.97 ++    }
    4.98 ++
    4.99 ++
   4.100 ++  Simulator::Stop (Seconds (2000000.0));
   4.101 ++  Simulator::Run ();
   4.102 ++  Simulator::Destroy ();
   4.103 ++
   4.104 ++  return 0;
   4.105 ++}
   4.106 +diff -r 6a5297994128 model/dce-credentials.cc
   4.107 +--- a/model/dce-credentials.cc	Thu Apr 26 09:56:01 2012 +0900
   4.108 ++++ b/model/dce-credentials.cc	Thu Apr 26 11:21:55 2012 +0900
   4.109 +@@ -53,3 +53,15 @@
   4.110 +   int ret = eaccess (rPath.c_str (), mode);
   4.111 +   return ret;
   4.112 + }
   4.113 ++
   4.114 ++int dce_chown(const char *path, uid_t owner, gid_t group)
   4.115 ++{
   4.116 ++  // XXX
   4.117 ++  return 0;
   4.118 ++}
   4.119 ++
   4.120 ++int dce_initgroups(const char *user, gid_t group)
   4.121 ++{
   4.122 ++  // XXX
   4.123 ++  return 0;
   4.124 ++}
   4.125 +diff -r 6a5297994128 model/dce-stdio.cc
   4.126 +--- a/model/dce-stdio.cc	Thu Apr 26 09:56:01 2012 +0900
   4.127 ++++ b/model/dce-stdio.cc	Thu Apr 26 11:21:55 2012 +0900
   4.128 +@@ -722,6 +722,16 @@
   4.129 +   va_end (ap);
   4.130 +   return retval;
   4.131 + }
   4.132 ++int dce___vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
   4.133 ++						size_t __slen,
   4.134 ++						__const char *__restrict __format, _G_va_list __ap)
   4.135 ++{
   4.136 ++  NS_LOG_FUNCTION (Current () << UtilsGetNodeId ());
   4.137 ++  NS_ASSERT (Current () != 0);
   4.138 ++
   4.139 ++  int retval = vsnprintf (__s, __n, __format, __ap);
   4.140 ++  return retval;
   4.141 ++}
   4.142 + void dce___fpurge (FILE *stream)
   4.143 + {
   4.144 +   NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << stream);
   4.145 +diff -r 6a5297994128 model/dce-stdio.h
   4.146 +--- a/model/dce-stdio.h	Thu Apr 26 09:56:01 2012 +0900
   4.147 ++++ b/model/dce-stdio.h	Thu Apr 26 11:21:55 2012 +0900
   4.148 +@@ -62,6 +62,9 @@
   4.149 + 					   __const char *__restrict __format, ...);
   4.150 + int dce___snprintf_chk (char *__restrict __s, size_t __n, int __flag,
   4.151 + 						size_t __slen, __const char *__restrict __format, ...);
   4.152 ++int dce___vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
   4.153 ++						size_t __slen,
   4.154 ++                         __const char *__restrict __format, _G_va_list __ap);
   4.155 + 
   4.156 + void dce___fpurge (FILE *stream);
   4.157 + size_t dce___fpending(FILE *stream);
   4.158 +diff -r 6a5297994128 model/dce-syslog.cc
   4.159 +--- a/model/dce-syslog.cc	Thu Apr 26 09:56:01 2012 +0900
   4.160 ++++ b/model/dce-syslog.cc	Thu Apr 26 11:21:55 2012 +0900
   4.161 +@@ -67,3 +67,14 @@
   4.162 + 
   4.163 +   vfprintf (process->syslog, message, args);
   4.164 + }
   4.165 ++
   4.166 ++void
   4.167 ++dce___syslog_chk (int __pri, int __flag, __const char *__fmt, ...)
   4.168 ++{
   4.169 ++  NS_ASSERT (Current () != 0);
   4.170 ++
   4.171 ++  va_list ap;
   4.172 ++  va_start (ap, __fmt);
   4.173 ++  dce_vsyslog (__pri, __fmt, ap);
   4.174 ++  va_end (ap);
   4.175 ++}
   4.176 +diff -r 6a5297994128 model/dce-syslog.h
   4.177 +--- a/model/dce-syslog.h	Thu Apr 26 09:56:01 2012 +0900
   4.178 ++++ b/model/dce-syslog.h	Thu Apr 26 11:21:55 2012 +0900
   4.179 +@@ -19,4 +19,7 @@
   4.180 + void
   4.181 + dce_vsyslog (int priority, const char *message, va_list args);
   4.182 + 
   4.183 ++void
   4.184 ++dce___syslog_chk (int __pri, int __flag, __const char *__fmt, ...);
   4.185 ++
   4.186 + #endif // DCE_SYSLOG_H
   4.187 +diff -r 6a5297994128 model/dce-unistd.h
   4.188 +--- a/model/dce-unistd.h	Thu Apr 26 09:56:01 2012 +0900
   4.189 ++++ b/model/dce-unistd.h	Thu Apr 26 11:21:55 2012 +0900
   4.190 +@@ -74,6 +74,8 @@
   4.191 + 
   4.192 + ssize_t dce_pread(int fd, void *buf, size_t count, off_t offset);
   4.193 + ssize_t dce_pwrite(int fd, const void *buf, size_t count, off_t offset);
   4.194 ++int dce_chown(const char *path, uid_t owner, gid_t group);
   4.195 ++int dce_initgroups(const char *user, gid_t group);
   4.196 + 
   4.197 + #ifdef __cplusplus
   4.198 + }
   4.199 +diff -r 6a5297994128 model/dce.cc
   4.200 +--- a/model/dce.cc	Thu Apr 26 09:56:01 2012 +0900
   4.201 ++++ b/model/dce.cc	Thu Apr 26 11:21:55 2012 +0900
   4.202 +@@ -141,7 +141,7 @@
   4.203 +       current->err = EPERM;
   4.204 +       return -1;
   4.205 +     }
   4.206 +-  if (sgid != (gid_t)-1 ||
   4.207 ++  if (sgid != (gid_t)-1 &&
   4.208 +       !is_set_ucapable (sgid))
   4.209 +     {
   4.210 +       current->err = EPERM;
   4.211 +diff -r 6a5297994128 model/dlm-loader-factory.cc
   4.212 +--- a/model/dlm-loader-factory.cc	Thu Apr 26 09:56:01 2012 +0900
   4.213 ++++ b/model/dlm-loader-factory.cc	Thu Apr 26 11:21:55 2012 +0900
   4.214 +@@ -3,6 +3,7 @@
   4.215 + #include "ns3/fatal-error.h"
   4.216 + #include <list>
   4.217 + #include <dlfcn.h>
   4.218 ++#include <sys/stat.h>
   4.219 + 
   4.220 + NS_LOG_COMPONENT_DEFINE ("DlmLoaderFactory");
   4.221 + 
   4.222 +@@ -34,6 +35,10 @@
   4.223 +   virtual void Unload (void *module);
   4.224 +   virtual void *Lookup (void *module, std::string symbol);
   4.225 + private:
   4.226 ++  bool SearchFile (std::string filename, std::string *fullname) const;
   4.227 ++  std::list<std::string> GetSearchDirectories (void) const;
   4.228 ++  std::list<std::string> Split (std::string input, std::string sep) const;
   4.229 ++  bool Exists (std::string filename) const;
   4.230 +   Lmid_t m_lmid;
   4.231 +   std::list<void *> m_loaded;
   4.232 + };
   4.233 +@@ -83,11 +88,98 @@
   4.234 +       ::dlclose (*i);
   4.235 +     }
   4.236 + }
   4.237 ++std::list<std::string>
   4.238 ++DlmLoader::Split (std::string input, std::string sep) const
   4.239 ++{
   4.240 ++  NS_LOG_FUNCTION (this << input << sep);
   4.241 ++  std::list<std::string> retval;
   4.242 ++  std::string::size_type cur = 0, next;
   4.243 ++  while (true)
   4.244 ++    {
   4.245 ++      next = input.find (sep, cur);
   4.246 ++      if (next == cur)
   4.247 ++	{
   4.248 ++	  cur ++;
   4.249 ++	  continue;
   4.250 ++	} 
   4.251 ++      else if (next == std::string::npos)
   4.252 ++	{
   4.253 ++	  if (input.size () != cur)
   4.254 ++	    {
   4.255 ++	      retval.push_back (input.substr (cur, input.size () - cur));
   4.256 ++	    }
   4.257 ++	  break;
   4.258 ++	}
   4.259 ++      retval.push_back (input.substr (cur, next - cur));
   4.260 ++      cur = next + 1;
   4.261 ++    }
   4.262 ++  return retval;
   4.263 ++}
   4.264 ++std::list<std::string>
   4.265 ++DlmLoader::GetSearchDirectories (void) const
   4.266 ++{
   4.267 ++  NS_LOG_FUNCTION (this);
   4.268 ++  std::list<std::string> directories;
   4.269 ++  char *ldLibraryPath = getenv ("LD_LIBRARY_PATH");
   4.270 ++  if (ldLibraryPath != 0)
   4.271 ++    {
   4.272 ++      std::list<std::string> tmp = Split (ldLibraryPath, ":");
   4.273 ++      directories.insert (directories.end (), 
   4.274 ++			  tmp.begin (),
   4.275 ++			  tmp.end ());
   4.276 ++    }
   4.277 ++  char *path = getenv ("PATH");
   4.278 ++  if (path != 0)
   4.279 ++    {
   4.280 ++      std::list<std::string> tmp = Split (path, ":");
   4.281 ++      directories.insert (directories.end (), 
   4.282 ++			  tmp.begin (),
   4.283 ++			  tmp.end ());
   4.284 ++    }
   4.285 ++  directories.push_back ("/lib");
   4.286 ++  directories.push_back ("/usr/lib");
   4.287 ++  directories.push_back (".");
   4.288 ++  return directories;
   4.289 ++}
   4.290 ++bool
   4.291 ++DlmLoader::Exists (std::string filename) const
   4.292 ++{
   4.293 ++  //NS_LOG_FUNCTION (this << filename);
   4.294 ++  struct stat st;
   4.295 ++  int retval = ::stat (filename.c_str (), &st);
   4.296 ++  return retval == 0;
   4.297 ++}
   4.298 ++bool
   4.299 ++DlmLoader::SearchFile (std::string filename, std::string *fullname) const
   4.300 ++{
   4.301 ++  NS_LOG_FUNCTION (this << filename);
   4.302 ++  if (Exists (filename))
   4.303 ++    {
   4.304 ++      *fullname = filename;
   4.305 ++      NS_LOG_DEBUG ("Found: " << filename << " as " << *fullname);
   4.306 ++      return true;
   4.307 ++    }
   4.308 ++  std::list<std::string> dirs = GetSearchDirectories ();
   4.309 ++  for (std::list<std::string>::const_iterator i = dirs.begin (); i != dirs.end (); i++)
   4.310 ++    {
   4.311 ++      if (Exists (*i + "/" + filename))
   4.312 ++	{
   4.313 ++	  *fullname = *i + "/" + filename;
   4.314 ++	  NS_LOG_DEBUG ("Found: " << filename << " as " << *fullname);
   4.315 ++	  return true;
   4.316 ++	}
   4.317 ++    }
   4.318 ++  return false;
   4.319 ++}
   4.320 + void *
   4.321 + DlmLoader::Load (std::string filename, int flag)
   4.322 + {
   4.323 ++  std::string fullname;
   4.324 ++  bool found;
   4.325 +   NS_LOG_FUNCTION (this << filename << flag);
   4.326 +-  void *module = dlmopen (m_lmid, filename.c_str (), flag);
   4.327 ++  found = SearchFile (filename, &fullname);
   4.328 ++  NS_ASSERT (found);
   4.329 ++  void *module = dlmopen (m_lmid, fullname.c_str (), flag);
   4.330 +   m_loaded.push_back (module);
   4.331 +   return module;
   4.332 + }
   4.333 +diff -r 6a5297994128 model/libc-dce.cc
   4.334 +--- a/model/libc-dce.cc	Thu Apr 26 09:56:01 2012 +0900
   4.335 ++++ b/model/libc-dce.cc	Thu Apr 26 11:21:55 2012 +0900
   4.336 +@@ -129,11 +129,13 @@
   4.337 +      __THROW;
   4.338 + extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
   4.339 +                   _G_va_list) __THROW;
   4.340 ++extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...);
   4.341 + 
   4.342 + typedef void (*func_t) (...);
   4.343 + 
   4.344 + extern "C" {
   4.345 + 
   4.346 ++extern void *__memcpy_chk(void *dest, const void *src, size_t n, size_t __destlen);
   4.347 + void libc_dce (struct Libc **libc)
   4.348 + {
   4.349 +   *libc = new Libc;
   4.350 +diff -r 6a5297994128 model/libc-ns3.h
   4.351 +--- a/model/libc-ns3.h	Thu Apr 26 09:56:01 2012 +0900
   4.352 ++++ b/model/libc-ns3.h	Thu Apr 26 11:21:55 2012 +0900
   4.353 +@@ -83,6 +83,7 @@
   4.354 + DCE    (writev)
   4.355 + NATIVE (memset)
   4.356 + NATIVE (memcpy)
   4.357 ++NATIVE (__memcpy_chk)
   4.358 + NATIVE (bcopy)
   4.359 + NATIVE (memcmp)
   4.360 + NATIVE (memmove)
   4.361 +@@ -102,6 +103,7 @@
   4.362 + NATIVE_EXPLICIT (strchr, char* (*) (char *, int))
   4.363 + NATIVE_EXPLICIT (strrchr, const char * (*) (const char *, int))
   4.364 + //DCE (strrchr)
   4.365 ++NATIVE_EXPLICIT (strstr, const char * (*) (const char *, const char *))
   4.366 + NATIVE (strcasecmp)
   4.367 + NATIVE (strncasecmp)
   4.368 + 
   4.369 +@@ -129,6 +131,7 @@
   4.370 + DCE    (__vfprintf_chk)
   4.371 + DCE    (__fprintf_chk)
   4.372 + DCE    (__snprintf_chk)
   4.373 ++DCE    (__vsnprintf_chk)
   4.374 + 
   4.375 + DCE_WITH_ALIAS2 (fgetc,fgetc_unlocked)
   4.376 + NATIVE (getc)
   4.377 +@@ -357,6 +360,10 @@
   4.378 + NATIVE (pthread_rwlock_destroy)
   4.379 + NATIVE (pthread_setcancelstate)
   4.380 + NATIVE (pthread_sigmask)
   4.381 ++NATIVE (pthread_spin_init)
   4.382 ++NATIVE (pthread_spin_lock)
   4.383 ++NATIVE (pthread_spin_unlock)
   4.384 ++NATIVE (pthread_spin_destroy)
   4.385 + 
   4.386 + // netdb.h
   4.387 + DCE    (gethostbyname)
   4.388 +@@ -440,6 +447,7 @@
   4.389 + DCE    (setlogmask)
   4.390 + DCE    (syslog)
   4.391 + DCE    (vsyslog)
   4.392 ++DCE    (__syslog_chk)
   4.393 + 
   4.394 + // unistd.h
   4.395 + NATIVE (sysconf)
   4.396 +@@ -455,6 +463,8 @@
   4.397 + DCE (eaccess)
   4.398 + DCE (pipe)
   4.399 + NATIVE (pathconf)
   4.400 ++DCE (chown)
   4.401 ++DCE (initgroups)
   4.402 + 
   4.403 + // this is wrong. clock should be changed to DCE implementation
   4.404 + DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
   4.405 +diff -r 6a5297994128 wscript
   4.406 +--- a/wscript	Thu Apr 26 09:56:01 2012 +0900
   4.407 ++++ b/wscript	Thu Apr 26 11:21:55 2012 +0900
   4.408 +@@ -37,6 +37,8 @@
   4.409 + 
   4.410 +     conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed')
   4.411 +     conf.env.append_value('LINKFLAGS', '-pthread')
   4.412 ++    conf.env.append_value('LINKFLAGS', '-Wl,--dynamic-linker=' +
   4.413 ++                             os.path.abspath ('../build/lib/ldso'))
   4.414 +     conf.check (lib='dl', mandatory = True)
   4.415 +     conf.check_cc(fragment='int main() {__get_cpu_features();}\n', msg='Checking for glibc get_cpu_features', define_name='HAVE_GETCPUFEATURES', mandatory=False)
   4.416 +      
   4.417 +@@ -277,6 +279,10 @@
   4.418 +                        target='bin/dce-linux',
   4.419 +                        source=['example/dce-linux.cc'])
   4.420 + 
   4.421 ++    module.add_example(needed = ['core', 'network', 'dce', 'wifi', 'point-to-point', 'csma', 'mobility' ],
   4.422 ++                       target='bin/dce-unbound',
   4.423 ++                       source=['example/dce-unbound.cc'])
   4.424 ++
   4.425 + # Add a script to build system 
   4.426 + def build_a_script(bld, name, needed = [], **kw):
   4.427 +     external = [i for i in needed if not i == name]
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/fedora8-nontimerfd-etc.patch	Fri May 11 17:03:32 2012 +0900
     5.3 @@ -0,0 +1,306 @@
     5.4 +diff -r ae3103c9ee50 -r 88ac4b927923 model/dce-dirent.cc
     5.5 +--- a/model/dce-dirent.cc	Fri Apr 27 19:40:18 2012 +0900
     5.6 ++++ b/model/dce-dirent.cc	Fri May 11 17:03:08 2012 +0900
     5.7 +@@ -247,7 +247,7 @@
     5.8 +   std::string vPath = UtilsGetRealFilePath (std::string (dirp));
     5.9 + 
    5.10 +   struct dirent **nl = 0;
    5.11 +-  int ret = scandir ( vPath.c_str () , &nl, filter, compar);
    5.12 ++  int ret = scandir ( vPath.c_str () , &nl, filter, (int (*)(const void*, const void*))compar);
    5.13 + 
    5.14 +   if ( (ret > 0) && nl )
    5.15 +     {
    5.16 +diff -r ae3103c9ee50 -r 88ac4b927923 model/dce-stdlib.h
    5.17 +--- a/model/dce-stdlib.h	Fri Apr 27 19:40:18 2012 +0900
    5.18 ++++ b/model/dce-stdlib.h	Fri May 11 17:03:08 2012 +0900
    5.19 +@@ -23,6 +23,7 @@
    5.20 + int dce_unsetenv (const char *name);
    5.21 + int dce_clearenv (void);
    5.22 + 
    5.23 ++
    5.24 + #ifdef __cplusplus
    5.25 + }
    5.26 + #endif
    5.27 +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-dce.c
    5.28 +--- a/model/libc-dce.c	Fri Apr 27 19:40:18 2012 +0900
    5.29 ++++ b/model/libc-dce.c	Fri May 11 17:03:08 2012 +0900
    5.30 +@@ -32,7 +32,9 @@
    5.31 + #include "dce-cxa.h"
    5.32 + #include "dce-string.h"
    5.33 + #include "dce-global-variables.h"
    5.34 ++#ifdef HAVE_SYS_TIMER_H
    5.35 + #include "sys/dce-timerfd.h"
    5.36 ++#endif
    5.37 + #include "dce-random.h"
    5.38 + #include "net/dce-if.h"
    5.39 + #include "dce-umask.h"
    5.40 +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-dce.cc
    5.41 +--- a/model/libc-dce.cc	Fri Apr 27 19:40:18 2012 +0900
    5.42 ++++ b/model/libc-dce.cc	Fri May 11 17:03:08 2012 +0900
    5.43 +@@ -12,7 +12,9 @@
    5.44 + #include "sys/dce-mman.h"
    5.45 + #include "sys/dce-stat.h"
    5.46 + #include "sys/dce-select.h"
    5.47 ++#ifdef HAVE_SYS_TIMER_H
    5.48 + #include "sys/dce-timerfd.h"
    5.49 ++#endif
    5.50 + #include "dce-unistd.h"
    5.51 + #include "dce-netdb.h"
    5.52 + #include "dce-pthread.h"
    5.53 +@@ -67,7 +69,9 @@
    5.54 + #include <sys/ioctl.h>
    5.55 + #include <sys/io.h>
    5.56 + #include <sys/mman.h>
    5.57 ++#ifdef HAVE_SYS_TIMER_H
    5.58 + #include <sys/timerfd.h>
    5.59 ++#endif
    5.60 + #include <sys/time.h>
    5.61 + #include <sys/types.h>
    5.62 + #include <sys/resource.h>
    5.63 +@@ -150,6 +154,7 @@
    5.64 + #define NATIVE_EXPLICIT(name, type)				\
    5.65 +   (*libc)->name ## _fn = (func_t)((type)name);
    5.66 + 
    5.67 ++(*libc)->memcpy_fn = memcpy;
    5.68 + #include "libc-ns3.h"
    5.69 + }
    5.70 + } // extern "C"
    5.71 +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-ns3.h
    5.72 +--- a/model/libc-ns3.h	Fri Apr 27 19:40:18 2012 +0900
    5.73 ++++ b/model/libc-ns3.h	Fri May 11 17:03:08 2012 +0900
    5.74 +@@ -82,7 +82,6 @@
    5.75 + DCE    (write)
    5.76 + DCE    (writev)
    5.77 + NATIVE (memset)
    5.78 +-NATIVE (memcpy)
    5.79 + NATIVE (__memcpy_chk)
    5.80 + NATIVE (bcopy)
    5.81 + NATIVE (memcmp)
    5.82 +@@ -400,10 +399,13 @@
    5.83 + 
    5.84 + NATIVE (toupper)
    5.85 + NATIVE (tolower)
    5.86 ++NATIVE (_tolower)
    5.87 + 
    5.88 ++#ifdef HAVE_SYS_TIMER_H
    5.89 + DCE    (timerfd_create)
    5.90 + DCE    (timerfd_settime)
    5.91 + DCE    (timerfd_gettime)
    5.92 ++#endif
    5.93 + 
    5.94 + DCE    (if_nametoindex)
    5.95 + DCE    (if_indextoname)
    5.96 +@@ -435,7 +437,8 @@
    5.97 + NATIVE (__xpg_basename)
    5.98 + 
    5.99 + DCE    (truncate)
   5.100 +-DCE    (ftruncate)
   5.101 ++//DCE    (ftruncate)
   5.102 ++DCE_WITH_ALIAS2 (ftruncate,ftruncate64)
   5.103 + 
   5.104 + // pwd.h
   5.105 + NATIVE (getpwnam)
   5.106 +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc.cc
   5.107 +--- a/model/libc.cc	Fri Apr 27 19:40:18 2012 +0900
   5.108 ++++ b/model/libc.cc	Fri May 11 17:03:08 2012 +0900
   5.109 +@@ -57,6 +57,12 @@
   5.110 + 
   5.111 + #include "libc-ns3.h" // do the work
   5.112 + 
   5.113 ++void *memcpy(void *dest, const void *src, size_t n)
   5.114 ++{
   5.115 ++  return g_libc.memcpy_fn (dest, src, n);
   5.116 ++}
   5.117 ++
   5.118 ++
   5.119 + // weak_alias (strtol, __strtol_internal);
   5.120 + // weak_alias (wctype_l, __wctype_l);
   5.121 + // weak_alias (strdup, __strdup);
   5.122 +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc.h
   5.123 +--- a/model/libc.h	Fri Apr 27 19:40:18 2012 +0900
   5.124 ++++ b/model/libc.h	Fri May 11 17:03:08 2012 +0900
   5.125 +@@ -1,6 +1,7 @@
   5.126 + #ifndef LIBC_H
   5.127 + #define LIBC_H
   5.128 + 
   5.129 ++typedef unsigned int size_t;
   5.130 + struct Libc
   5.131 + {
   5.132 + 
   5.133 +@@ -9,6 +10,7 @@
   5.134 + #define DCET(rtype, name) DCE(name)
   5.135 + 
   5.136 + #include "libc-ns3.h"
   5.137 ++void *(*memcpy_fn)(void *dest, const void *src, size_t n);
   5.138 + 
   5.139 + };
   5.140 + 
   5.141 +diff -r ae3103c9ee50 -r 88ac4b927923 ns3waf/__init__.py
   5.142 +--- a/ns3waf/__init__.py	Fri Apr 27 19:40:18 2012 +0900
   5.143 ++++ b/ns3waf/__init__.py	Fri May 11 17:03:08 2012 +0900
   5.144 +@@ -446,7 +446,7 @@
   5.145 + }
   5.146 + """)
   5.147 +         os.close(handle)
   5.148 +-        kw['source'] = kw['source'] + [os.path.relpath(filename, self._bld.bldnode.abspath())]
   5.149 ++        kw['source'] = kw['source'] + [os.path.join(filename, self._bld.bldnode.abspath())]
   5.150 +         self.add_test(needed, **kw)
   5.151 + 
   5.152 +     def add_test(self, needed = [], **kw):
   5.153 +@@ -464,7 +464,7 @@
   5.154 + 
   5.155 +         kw['includes'] = kw.get('includes', []) + self._source_dirs
   5.156 + 
   5.157 +-        tmp = self._bld.path.relpath_gen(self._bld.srcnode)
   5.158 ++        tmp = self._bld.path(self._bld.srcnode)
   5.159 +         objects = []
   5.160 +         for src in kw['source'][0:-1]:
   5.161 +             src_target = '%s_object' % src
   5.162 +diff -r ae3103c9ee50 -r 88ac4b927923 test/test-poll.cc
   5.163 +--- a/test/test-poll.cc	Fri Apr 27 19:40:18 2012 +0900
   5.164 ++++ b/test/test-poll.cc	Fri May 11 17:03:08 2012 +0900
   5.165 +@@ -1,7 +1,6 @@
   5.166 + #include <stdlib.h>
   5.167 + #include <sys/time.h>
   5.168 + #include <sys/types.h>
   5.169 +-#include <sys/timerfd.h>
   5.170 + #include <unistd.h>
   5.171 + #include <pthread.h>
   5.172 + #include <stdio.h>
   5.173 +diff -r ae3103c9ee50 -r 88ac4b927923 test/test-select.cc
   5.174 +--- a/test/test-select.cc	Fri Apr 27 19:40:18 2012 +0900
   5.175 ++++ b/test/test-select.cc	Fri May 11 17:03:08 2012 +0900
   5.176 +@@ -2,7 +2,9 @@
   5.177 + #include <sys/time.h>
   5.178 + #include <sys/types.h>
   5.179 + #include <sys/select.h>
   5.180 ++#ifdef HAVE_SYS_TIMER_H
   5.181 + #include <sys/timerfd.h>
   5.182 ++#endif
   5.183 + #include <unistd.h>
   5.184 + #include <pthread.h>
   5.185 + #include <stdio.h>
   5.186 +@@ -18,6 +20,7 @@
   5.187 + #include "test-macros.h"
   5.188 + 
   5.189 + // test, that select () with timeout={0,0} exits immediately
   5.190 ++#ifdef HAVE_SYS_TIMER_H
   5.191 + static void
   5.192 + test_select_null_null (void)
   5.193 + {
   5.194 +@@ -58,6 +61,7 @@
   5.195 + 
   5.196 +   close (timerfd);
   5.197 + }
   5.198 ++#endif
   5.199 + 
   5.200 + static bool
   5.201 + test_select_read (int fd, int timeOutSec, bool needSuccess)
   5.202 +@@ -771,6 +775,7 @@
   5.203 +   TEST_ASSERT (FD_ISSET (sockfd, &wfds));
   5.204 + }
   5.205 + 
   5.206 ++#ifdef HAVE_SYS_TIMER_H
   5.207 + // test, that select () returns correctly if there is two fds for reading and only one available
   5.208 + // solved with else mustWait=false
   5.209 + static void test_select_rfds (void)
   5.210 +@@ -804,6 +809,7 @@
   5.211 +   // no fds must be ready and select() should complete without errors
   5.212 +   TEST_ASSERT_EQUAL (nfds, 1);
   5.213 + }
   5.214 ++#endif
   5.215 + 
   5.216 + int
   5.217 + main (int argc, char *argv[])
   5.218 +@@ -815,10 +821,14 @@
   5.219 +     {
   5.220 +       test_select_stdin ();
   5.221 +       test_select_stdout_stdin ();
   5.222 ++#ifdef HAVE_SYS_TIMER_H
   5.223 +       test_select_null_null ();
   5.224 ++#endif
   5.225 +       test_select_stdout ();
   5.226 +       test_select_rfds_wfds ();
   5.227 ++#ifdef HAVE_SYS_TIMER_H
   5.228 +       test_select_rfds ();
   5.229 ++#endif
   5.230 +       launch (client1, server1);
   5.231 +       launch (client2, server2);
   5.232 +       launch (client3, server3);
   5.233 +diff -r ae3103c9ee50 -r 88ac4b927923 wscript
   5.234 +--- a/wscript	Fri Apr 27 19:40:18 2012 +0900
   5.235 ++++ b/wscript	Fri May 11 17:03:08 2012 +0900
   5.236 +@@ -34,6 +34,7 @@
   5.237 +     conf.check(header_name='sys/types.h', define_name='HAVE_SYS_TYPES_H', mandatory=False)
   5.238 +     conf.check(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H', mandatory=False)
   5.239 +     conf.check(header_name='dirent.h', define_name='HAVE_DIRENT_H', mandatory=False)
   5.240 ++    conf.check(header_name='sys/timerfd.h', define_name='HAVE_SYS_TIMER_H', mandatory=False)
   5.241 + 
   5.242 +     conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed')
   5.243 +     conf.env.append_value('LINKFLAGS', '-pthread')
   5.244 +@@ -88,7 +89,8 @@
   5.245 + 
   5.246 +     if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack):
   5.247 +         conf.check(header_name='sim.h',
   5.248 +-                   includes=os.path.join(Options.options.kernel_stack, 'sim/include'))
   5.249 ++                   includes=[os.path.join(Options.options.kernel_stack, 'sim/include'),
   5.250 ++			    os.path.join(Options.options.kernel_stack, 'net-next-2.6/include')])
   5.251 +       #  conf.check()
   5.252 +         conf.env['KERNEL_STACK'] = Options.options.kernel_stack
   5.253 + 
   5.254 +@@ -161,7 +163,6 @@
   5.255 +              ['test-netdb', []],
   5.256 +              ['test-env', []],
   5.257 +              ['test-cond', ['PTHREAD']],
   5.258 +-             ['test-timer-fd', []],
   5.259 +              ['test-stdlib', []],
   5.260 +              ['test-select', ['PTHREAD']],
   5.261 +              ['test-random', []],
   5.262 +@@ -181,6 +182,10 @@
   5.263 +              ['test-socket', []],
   5.264 +              ['test-bug-multi-select', []],
   5.265 +              ]
   5.266 ++
   5.267 ++    if module._bld.env['HAVE_SYS_TIMER_H']:
   5.268 ++        tests = tests + ['test-timer-fd', []],
   5.269 ++
   5.270 +     for name,uselib in tests:
   5.271 +         module.add_test(**dce_kw(target='bin_dce/' + name, source = ['test/' + name + '.cc'],
   5.272 +                                  use = uselib + ['lib/test']))
   5.273 +@@ -188,7 +193,6 @@
   5.274 + def build_dce_examples(module):
   5.275 +     dce_examples = [['udp-server', []],
   5.276 +                     ['udp-client', []],
   5.277 +-                    ['udp-perf', ['m']],
   5.278 +                     ['tcp-server', []],
   5.279 +                     ['tcp-client', []],
   5.280 +                     ['tcp-loopback', []],
   5.281 +@@ -198,6 +202,9 @@
   5.282 +                     ['udp-echo-client', []],
   5.283 + #                    ['little-cout', []],
   5.284 +                     ]
   5.285 ++    if module._bld.env['HAVE_SYS_TIMER_H']:
   5.286 ++        dce_examples = dce_examples + ['udp-perf', ['m']],
   5.287 ++
   5.288 +     for name,lib in dce_examples:
   5.289 +         module.add_example(**dce_kw(target = 'bin_dce/' + name, 
   5.290 +                                     source = ['example/' + name + '.cc'],
   5.291 +@@ -350,7 +357,6 @@
   5.292 +         'model/dce-string.cc',
   5.293 +         'model/dce-env.cc',
   5.294 +         'model/dce-pthread-cond.cc',
   5.295 +-        'model/dce-timerfd.cc',
   5.296 +         'model/dce-time.cc',
   5.297 +         'model/dce-stat.cc',
   5.298 +         'model/dce-syslog.cc',
   5.299 +@@ -411,6 +417,10 @@
   5.300 +         'helper/ccn-client-helper.h',
   5.301 +         'helper/ipv4-dce-routing-helper.h',
   5.302 +         ]
   5.303 ++
   5.304 ++    if bld.env['HAVE_SYS_TIMER_H']:
   5.305 ++        module_source = module+source + 'model/dce-timerfd.cc',
   5.306 ++
   5.307 +     module_source = module_source + kernel_source
   5.308 +     module_headers = module_headers + kernel_headers
   5.309 +     uselib = ns3waf.modules_uselib(bld, ['core', 'network', 'internet', 'netlink'])
     6.1 --- a/series	Wed Apr 11 12:41:12 2012 +0900
     6.2 +++ b/series	Fri May 11 17:03:32 2012 +0900
     6.3 @@ -1,5 +1,8 @@
     6.4  120406-dce-quagga-support.patch
     6.5  120410-dce-umip-support.patch
     6.6 +dns_unbound.patch
     6.7 +dns_bind9.patch
     6.8 +fedora8-nontimerfd-etc.patch
     6.9  dlm-loader-fix.patch
    6.10  floating_groupd.patch
    6.11  mpitest.patch