# HG changeset patch # User Hajime Tazaki # Date 1336723412 -32400 # Node ID 5ca51e147e7f8b5d4f3c0d800a4964707a91d963 # Parent f86f5b19833f2ebecb5e0ed7b290a62f7e582d79 unbound, bind9, fedora8 added diff -r f86f5b19833f -r 5ca51e147e7f 120406-dce-quagga-support.patch --- a/120406-dce-quagga-support.patch Wed Apr 11 12:41:12 2012 +0900 +++ b/120406-dce-quagga-support.patch Fri May 11 17:03:32 2012 +0900 @@ -825,7 +825,7 @@ -#endif /* QUAGGA_HELPER_H */ diff -r 28c0c7f781c1 model/dce-fd.cc --- a/model/dce-fd.cc Thu Mar 29 17:00:46 2012 +0200 -+++ b/model/dce-fd.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/model/dce-fd.cc Mon Apr 23 17:29:23 2012 +0900 @@ -345,12 +345,6 @@ Ptr factory = 0; @@ -841,7 +841,7 @@ factory = manager->GetObject (); diff -r 28c0c7f781c1 model/libc-ns3.h --- a/model/libc-ns3.h Thu Mar 29 17:00:46 2012 +0200 -+++ b/model/libc-ns3.h Wed Apr 11 10:56:47 2012 +0900 ++++ b/model/libc-ns3.h Mon Apr 23 17:29:23 2012 +0900 @@ -412,7 +412,7 @@ DCE (ftruncate) @@ -862,7 +862,7 @@ diff -r 28c0c7f781c1 model/linux-socket-fd-factory.cc --- a/model/linux-socket-fd-factory.cc Thu Mar 29 17:00:46 2012 +0200 -+++ b/model/linux-socket-fd-factory.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/model/linux-socket-fd-factory.cc Mon Apr 23 17:29:23 2012 +0900 @@ -254,6 +254,10 @@ { LinuxSocketFdFactory *self = (LinuxSocketFdFactory *)kernel; @@ -885,9 +885,89 @@ struct SimDevice *dev = m_exported->dev_create (PeekPointer (device), (enum SimDevFlags)flags); Ptr listener = Create (device, this); +diff -r 28c0c7f781c1 model/ns3-socket-fd-factory.cc +--- a/model/ns3-socket-fd-factory.cc Thu Mar 29 17:00:46 2012 +0200 ++++ b/model/ns3-socket-fd-factory.cc Mon Apr 23 17:29:23 2012 +0900 +@@ -98,6 +98,29 @@ + break; + } + } ++ else if (domain == PF_INET6) ++ { ++ switch (type) { ++ case SOCK_RAW: { ++ TypeId tid = TypeId::LookupByName ("ns3::Ipv6RawSocketFactory"); ++ Ptr factory = GetObject (tid); ++ sock = factory->CreateSocket (); ++ sock->SetAttribute ("Protocol", UintegerValue (protocol)); ++ socket = new UnixDatagramSocketFd (sock); ++ } break; ++ case SOCK_DGRAM: { ++ } break; ++ case SOCK_STREAM: { ++ TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory"); ++ Ptr factory = GetObject (tid); ++ sock = factory->CreateSocket (); ++ socket = new UnixStreamSocketFd (sock); ++ } break; ++ default: ++ NS_FATAL_ERROR ("missing socket type"); ++ break; ++ } ++ } + else if (domain == PF_NETLINK) + { + switch (type) { +diff -r 28c0c7f781c1 model/unix-socket-fd.cc +--- a/model/unix-socket-fd.cc Thu Mar 29 17:00:46 2012 +0200 ++++ b/model/unix-socket-fd.cc Mon Apr 23 17:29:23 2012 +0900 +@@ -33,6 +33,7 @@ + #include "ns3/boolean.h" + #include "ns3/simulator.h" + #include "ns3/netlink-socket-address.h" ++#include "ns3/inet6-socket-address.h" + #include + #include + #include // need ICMP_FILTER +@@ -634,6 +635,15 @@ + InetSocketAddress inet = InetSocketAddress (ipv4, port); + return inet; + } ++ else if (my_addr->sa_family == AF_INET6) ++ { ++ const struct sockaddr_in6 *addr = (const struct sockaddr_in6 *)my_addr; ++ Ipv6Address ipv6; ++ ipv6.Set ((uint8_t *)addr->sin6_addr.s6_addr); ++ uint16_t port = ntohs (addr->sin6_port); ++ Inet6SocketAddress inet = Inet6SocketAddress (ipv6, port); ++ return inet; ++ } + else if (my_addr->sa_family == AF_NETLINK) + { + const struct sockaddr_nl *addr = (const struct sockaddr_nl *)my_addr; +@@ -670,6 +680,19 @@ + inet_addr->sin_addr.s_addr = htonl (ns_inetaddr.GetIpv4 ().Get ()); + *addrlen = sizeof(struct sockaddr_in); + } ++ else if (Inet6SocketAddress::IsMatchingType (nsaddr)) ++ { ++ Inet6SocketAddress ns_inetaddr = Inet6SocketAddress::ConvertFrom (nsaddr); ++ if (*addrlen < sizeof (struct sockaddr_in6)) ++ { ++ return -1; ++ } ++ struct sockaddr_in6 *inet_addr = (struct sockaddr_in6 *)addr; ++ inet_addr->sin6_family = AF_INET; ++ inet_addr->sin6_port = htons (ns_inetaddr.GetPort ()); ++ ns_inetaddr.GetIpv6 ().GetBytes (inet_addr->sin6_addr.s6_addr); ++ *addrlen = sizeof(struct sockaddr_in6); ++ } + else if (NetlinkSocketAddress::IsMatchingType(nsaddr)) + { + NetlinkSocketAddress ns_nladdr = NetlinkSocketAddress::ConvertFrom (nsaddr); diff -r 28c0c7f781c1 model/utils.cc --- a/model/utils.cc Thu Mar 29 17:00:46 2012 +0200 -+++ b/model/utils.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/model/utils.cc Mon Apr 23 17:29:23 2012 +0900 @@ -191,6 +191,11 @@ void UtilsDoSignal (void) { @@ -902,7 +982,7 @@ for (std::vector::iterator i = current->process->signalHandlers.begin (); diff -r 28c0c7f781c1 test/dce-manager-test.cc --- a/test/dce-manager-test.cc Thu Mar 29 17:00:46 2012 +0200 -+++ b/test/dce-manager-test.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/test/dce-manager-test.cc Mon Apr 23 17:29:23 2012 +0900 @@ -161,13 +161,15 @@ { "test-random", 0, "", false }, { "test-local-socket", 0, "", false }, @@ -922,7 +1002,7 @@ // Prepare directories and files for test-stdio diff -r 28c0c7f781c1 test/test-bug-multi-select.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/test/test-bug-multi-select.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/test/test-bug-multi-select.cc Mon Apr 23 17:29:23 2012 +0900 @@ -0,0 +1,199 @@ +#include +#include @@ -1125,7 +1205,7 @@ +} diff -r 28c0c7f781c1 test/test-socket.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/test/test-socket.cc Wed Apr 11 10:56:47 2012 +0900 ++++ b/test/test-socket.cc Mon Apr 23 17:29:23 2012 +0900 @@ -0,0 +1,395 @@ +#define _GNU_SOURCE 1 +#include @@ -1524,7 +1604,7 @@ +} diff -r 28c0c7f781c1 test/wscript --- a/test/wscript Thu Mar 29 17:00:46 2012 +0200 -+++ b/test/wscript Wed Apr 11 10:56:47 2012 +0900 ++++ b/test/wscript Mon Apr 23 17:29:23 2012 +0900 @@ -31,6 +31,8 @@ new_test(bld, 'test-netdb', '') new_test(bld, 'test-env', '') @@ -1536,7 +1616,7 @@ new_test(bld, 'test-select', 'PTHREAD') diff -r 28c0c7f781c1 utils/setenv.sh --- a/utils/setenv.sh Thu Mar 29 17:00:46 2012 +0200 -+++ b/utils/setenv.sh Wed Apr 11 10:56:47 2012 +0900 ++++ b/utils/setenv.sh Mon Apr 23 17:29:23 2012 +0900 @@ -1,6 +1,6 @@ #!/bin/bash # Set environnement for ns3 dce @@ -1547,7 +1627,7 @@ BASE=$PWD diff -r 28c0c7f781c1 wscript --- a/wscript Thu Mar 29 17:00:46 2012 +0200 -+++ b/wscript Wed Apr 11 10:56:47 2012 +0900 ++++ b/wscript Mon Apr 23 17:29:23 2012 +0900 @@ -26,6 +26,7 @@ ns3waf.check_modules(conf, ['point-to-point', 'tap-bridge', 'netanim'], mandatory = False) ns3waf.check_modules(conf, ['wifi', 'point-to-point', 'csma', 'mobility'], mandatory = False) diff -r f86f5b19833f -r 5ca51e147e7f 120410-dce-umip-support.patch --- a/120410-dce-umip-support.patch Wed Apr 11 12:41:12 2012 +0900 +++ b/120410-dce-umip-support.patch Fri May 11 17:03:32 2012 +0900 @@ -1,8 +1,8 @@ support umip(mip6d) with ns-3-linux for NEMO/MIP6 -diff -r 61ddc5520f14 model/dce-fd.cc ---- a/model/dce-fd.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-fd.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-fd.cc +--- a/model/dce-fd.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-fd.cc Thu Apr 26 09:56:01 2012 +0900 @@ -367,11 +367,30 @@ } @@ -34,9 +34,9 @@ int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen) { Thread *current = Current (); -diff -r 61ddc5520f14 model/dce-manager.cc ---- a/model/dce-manager.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-manager.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-manager.cc +--- a/model/dce-manager.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-manager.cc Thu Apr 26 09:56:01 2012 +0900 @@ -1096,6 +1096,22 @@ libpthread_setup = (void (*)(const struct Libc *))(symbol); libpthread_setup (libc); @@ -60,9 +60,9 @@ // finally, call into 'main'. h = ld->Load (filename, RTLD_GLOBAL); -diff -r 61ddc5520f14 model/dce-poll.cc ---- a/model/dce-poll.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-poll.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-poll.cc +--- a/model/dce-poll.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-poll.cc Thu Apr 26 09:56:01 2012 +0900 @@ -180,7 +180,12 @@ } } @@ -77,9 +77,9 @@ { current->err = EINVAL; return -1; -diff -r 61ddc5520f14 model/dce-signal.cc ---- a/model/dce-signal.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-signal.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-signal.cc +--- a/model/dce-signal.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-signal.cc Thu Apr 26 09:56:01 2012 +0900 @@ -3,6 +3,7 @@ #include "process.h" #include "ns3/log.h" @@ -106,9 +106,9 @@ int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) { Thread *current = Current (); -diff -r 61ddc5520f14 model/dce-signal.h ---- a/model/dce-signal.h Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-signal.h Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-signal.h +--- a/model/dce-signal.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-signal.h Thu Apr 26 09:56:01 2012 +0900 @@ -17,6 +17,7 @@ int dce_pthread_kill (pthread_t thread, int sig); void dce_abort (); @@ -117,9 +117,33 @@ #ifdef __cplusplus } -diff -r 61ddc5520f14 model/dce-time.cc ---- a/model/dce-time.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-time.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-string.cc +--- a/model/dce-string.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-string.cc Thu Apr 26 09:56:01 2012 +0900 +@@ -26,3 +26,9 @@ + /// \todo Do actual checking + strcpy (__dest, __src); + } ++ ++char *dce_strrchr(char *s, int c) ++{ ++ return strrchr (s, c); ++} ++ +diff -r ab266495f633 model/dce-string.h +--- a/model/dce-string.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-string.h Thu Apr 26 09:56:01 2012 +0900 +@@ -12,6 +12,7 @@ + char *dce___strcpy_chk (char *__restrict __dest, + const char *__restrict __src, + size_t __destlen); ++char *dce_strrchr(char *s, int c); + + #ifdef __cplusplus + } +diff -r ab266495f633 model/dce-time.cc +--- a/model/dce-time.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-time.cc Thu Apr 26 09:56:01 2012 +0900 @@ -54,3 +54,12 @@ return asctime_r (tm, Current ()->process->asctime_result); @@ -133,9 +157,9 @@ + *tp = UtilsTimeToTimespec (UtilsSimulationTimeToTime (Now ())); + return 0; +} -diff -r 61ddc5520f14 model/dce-time.h ---- a/model/dce-time.h Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce-time.h Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce-time.h +--- a/model/dce-time.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce-time.h Thu Apr 26 09:56:01 2012 +0900 @@ -3,6 +3,7 @@ #include "sys/dce-time.h" @@ -153,9 +177,9 @@ #ifdef __cplusplus } -diff -r 61ddc5520f14 model/dce.cc ---- a/model/dce.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/dce.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/dce.cc +--- a/model/dce.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/dce.cc Thu Apr 26 09:56:01 2012 +0900 @@ -22,6 +22,8 @@ #include #include @@ -265,9 +289,9 @@ #ifdef HAVE_GETCPUFEATURES extern "C" { -diff -r 61ddc5520f14 model/elf-cache.cc ---- a/model/elf-cache.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/elf-cache.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/elf-cache.cc +--- a/model/elf-cache.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/elf-cache.cc Thu Apr 26 09:56:01 2012 +0900 @@ -26,6 +26,9 @@ overriden.from = "libpthread.so.0"; overriden.to = "libpthread-ns3.so"; @@ -278,9 +302,9 @@ } std::string -diff -r 61ddc5520f14 model/libc-ns3.h ---- a/model/libc-ns3.h Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/libc-ns3.h Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/libc-ns3.h +--- a/model/libc-ns3.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/libc-ns3.h Thu Apr 26 09:56:01 2012 +0900 @@ -73,6 +73,7 @@ NATIVE (ntohl) NATIVE (ntohs) @@ -289,7 +313,17 @@ DCE (getsockname) DCE (getpeername) DCE (bind) -@@ -214,6 +215,7 @@ +@@ -99,7 +100,8 @@ + NATIVE (strnlen) + // because C++ defines both const and non-const functions + NATIVE_EXPLICIT (strchr, char* (*) (char *, int)) +-NATIVE_EXPLICIT (strrchr, char * (*) (char *, int)) ++NATIVE_EXPLICIT (strrchr, const char * (*) (const char *, int)) ++//DCE (strrchr) + NATIVE (strcasecmp) + NATIVE (strncasecmp) + +@@ -214,6 +216,7 @@ DCE (setregid) DCE (setresuid) DCE (setresgid) @@ -297,7 +331,7 @@ NATIVE (inet_aton) NATIVE (inet_ntoa) DCE (inet_ntop) -@@ -223,6 +225,8 @@ +@@ -223,6 +226,8 @@ NATIVE (inet_lnaof) NATIVE (inet_netof) NATIVE (inet_addr) @@ -306,7 +340,7 @@ DCE (mmap) DCE (mmap64) DCE (munmap) -@@ -254,6 +258,7 @@ +@@ -254,6 +259,7 @@ DCE (realloc) DCE (gettimeofday) DCE (time) @@ -314,7 +348,7 @@ DCE (isatty) DCE (send) DCE (sendto) -@@ -279,6 +284,7 @@ +@@ -279,6 +285,7 @@ NATIVE (sigaddset) NATIVE (sigdelset) NATIVE (sigismember) @@ -322,7 +356,7 @@ DCE_WITH_ALIAS2(strtol, __strtol_internal) DCET (long long int, strtoll) DCE (strtoul) -@@ -343,6 +349,13 @@ +@@ -343,6 +350,13 @@ DCE (pthread_cond_wait) DCE (pthread_condattr_destroy) DCE (pthread_condattr_init) @@ -336,7 +370,7 @@ // netdb.h DCE (gethostbyname) -@@ -381,6 +394,7 @@ +@@ -381,6 +395,7 @@ DCE (timerfd_gettime) DCE (if_nametoindex) @@ -344,7 +378,7 @@ DCE (fork) NATIVE (qsort) -@@ -442,8 +456,8 @@ +@@ -442,8 +457,8 @@ NATIVE (pathconf) // this is wrong. clock should be changed to DCE implementation @@ -355,17 +389,17 @@ // setjmp.h NATIVE (__sigsetjmp) -diff -r 61ddc5520f14 model/librt-ns3.version +diff -r ab266495f633 model/librt-ns3.version --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/model/librt-ns3.version Wed Apr 11 12:38:04 2012 +0900 ++++ b/model/librt-ns3.version Thu Apr 26 09:56:01 2012 +0900 @@ -0,0 +1,4 @@ +NS3 { +global: + librt_setup; +}; -diff -r 61ddc5520f14 model/linux-socket-fd-factory.cc ---- a/model/linux-socket-fd-factory.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/linux-socket-fd-factory.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/linux-socket-fd-factory.cc +--- a/model/linux-socket-fd-factory.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/linux-socket-fd-factory.cc Thu Apr 26 09:56:01 2012 +0900 @@ -464,6 +464,7 @@ void LinuxSocketFdFactory::SetTask (std::string path, std::string value) @@ -382,9 +416,9 @@ while (!m_earlySysfs.empty ()) { -diff -r 61ddc5520f14 model/net/dce-if.h ---- a/model/net/dce-if.h Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/net/dce-if.h Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/net/dce-if.h +--- a/model/net/dce-if.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/net/dce-if.h Thu Apr 26 09:56:01 2012 +0900 @@ -7,6 +7,7 @@ #endif @@ -393,10 +427,10 @@ #ifdef __cplusplus -diff -r 61ddc5520f14 model/ns3-socket-fd-factory.cc ---- a/model/ns3-socket-fd-factory.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/ns3-socket-fd-factory.cc Wed Apr 11 12:38:04 2012 +0900 -@@ -143,6 +143,7 @@ +diff -r ab266495f633 model/ns3-socket-fd-factory.cc +--- a/model/ns3-socket-fd-factory.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/ns3-socket-fd-factory.cc Thu Apr 26 09:56:01 2012 +0900 +@@ -166,6 +166,7 @@ else { NS_FATAL_ERROR ("unsupported domain"); @@ -404,9 +438,9 @@ } return socket; -diff -r 61ddc5520f14 model/sys/dce-socket.h ---- a/model/sys/dce-socket.h Wed Apr 11 10:56:47 2012 +0900 -+++ b/model/sys/dce-socket.h Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 model/sys/dce-socket.h +--- a/model/sys/dce-socket.h Mon Apr 23 17:29:23 2012 +0900 ++++ b/model/sys/dce-socket.h Thu Apr 26 09:56:01 2012 +0900 @@ -28,6 +28,7 @@ ssize_t dce_sendmsg(int s, const struct msghdr *msg, int flags); int dce_getsockname(int s, struct sockaddr *name, socklen_t *namelen); @@ -415,9 +449,9 @@ #ifdef __cplusplus } -diff -r 61ddc5520f14 test/test-select.cc ---- a/test/test-select.cc Wed Apr 11 10:56:47 2012 +0900 -+++ b/test/test-select.cc Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 test/test-select.cc +--- a/test/test-select.cc Mon Apr 23 17:29:23 2012 +0900 ++++ b/test/test-select.cc Thu Apr 26 09:56:01 2012 +0900 @@ -43,9 +43,20 @@ struct timeval timeout = { 0, 0 }; @@ -440,9 +474,9 @@ } static bool -diff -r 61ddc5520f14 wscript ---- a/wscript Wed Apr 11 10:56:47 2012 +0900 -+++ b/wscript Wed Apr 11 12:38:04 2012 +0900 +diff -r ab266495f633 wscript +--- a/wscript Mon Apr 23 17:29:23 2012 +0900 ++++ b/wscript Thu Apr 26 09:56:01 2012 +0900 @@ -71,6 +71,17 @@ conf.end_msg(libpthread, True) conf.env['LIBPTHREAD_FILE'] = libpthread diff -r f86f5b19833f -r 5ca51e147e7f dns_bind9.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dns_bind9.patch Fri May 11 17:03:32 2012 +0900 @@ -0,0 +1,851 @@ +diff -r 7d0d6d7cda40 example/dce-unbound.cc +--- a/example/dce-unbound.cc Thu Apr 26 11:21:55 2012 +0900 ++++ b/example/dce-unbound.cc Fri Apr 27 19:40:18 2012 +0900 +@@ -47,8 +47,8 @@ + + DceManagerHelper processManager; + processManager.SetLoader ("ns3::DlmLoaderFactory"); +- // processManager.SetTaskManagerAttribute ("FiberManagerType", +- // EnumValue (0)); ++ processManager.SetTaskManagerAttribute ("FiberManagerType", ++ EnumValue (0)); + processManager.SetNetworkStack("ns3::LinuxSocketFdFactory", + "Library", StringValue ("libnet-next-2.6.so")); + processManager.Install (nodes); +@@ -66,12 +66,25 @@ + DceApplicationHelper process; + ApplicationContainer apps; + ++#if 0 + process.SetBinary ("unbound"); + process.ResetArguments (); + process.ParseArguments ("-d"); + process.SetStackSize (1<<16); + apps = process.Install (nodes.Get (0)); + apps.Start (Seconds (1.0)); ++#else ++ process.SetBinary ("named"); ++ process.ResetArguments (); ++ process.ParseArguments ("-4"); ++ process.ParseArguments ("-u"); ++ process.ParseArguments ("root"); ++ process.ParseArguments ("-c"); ++ process.ParseArguments ("/etc/namedb/named.conf"); ++ process.SetStackSize (1<<16); ++ apps = process.Install (nodes.Get (0)); ++ apps.Start (Seconds (1.0)); ++#endif + + for (int i = 0; i < 20; i++) + { +diff -r 7d0d6d7cda40 model/dce-netdb.cc +--- a/model/dce-netdb.cc Thu Apr 26 11:21:55 2012 +0900 ++++ b/model/dce-netdb.cc Fri Apr 27 19:40:18 2012 +0900 +@@ -8,6 +8,15 @@ + #include + #include "process.h" + #include "errno.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include "sys/dce-socket.h" ++#include "dce-unistd.h" ++#include "dce-signal.h" + + NS_LOG_COMPONENT_DEFINE ("DceNetdb"); + +@@ -188,3 +197,719 @@ + + fprintf (*Current ()->process->pstderr, "%s : %s\n", string, "ERROR"); + } ++ ++// Copy from glibc source ++// eglibc-2.11.1/sysdeps/unix/sysv/linux/ifaddr.c ++struct netlink_res ++{ ++ struct netlink_res *next; ++ struct nlmsghdr *nlh; ++ size_t size; /* Size of response. */ ++ uint32_t seq; /* sequential number we used. */ ++}; ++struct netlink_handle ++{ ++ int fd; /* Netlink file descriptor. */ ++ pid_t pid; /* Process ID. */ ++ uint32_t seq; /* The sequence number we use currently. */ ++ struct netlink_res *nlm_list; /* Pointer to list of responses. */ ++ struct netlink_res *end_ptr; /* For faster append of new entries. */ ++}; ++struct sockaddr_ll_max ++ { ++ unsigned short int sll_family; ++ unsigned short int sll_protocol; ++ int sll_ifindex; ++ unsigned short int sll_hatype; ++ unsigned char sll_pkttype; ++ unsigned char sll_halen; ++ unsigned char sll_addr[24]; ++ }; ++struct ifaddrs_storage ++{ ++ struct ifaddrs ifa; ++ union ++ { ++ /* Save space for the biggest of the four used sockaddr types and ++ avoid a lot of casts. */ ++ struct sockaddr sa; ++ struct sockaddr_ll_max sl; ++ struct sockaddr_in s4; ++ struct sockaddr_in6 s6; ++ } addr, netmask, broadaddr; ++ char name[IF_NAMESIZE + 1]; ++}; ++#define PAGE_SIZE 4096 ++static int ++netlink_request (struct netlink_handle *h, int type) ++{ ++ int ret; ++ struct sockaddr_nl snl; ++ int save_errno; ++ struct netlink_res *nlm_next; ++ struct sockaddr_nl nladdr; ++ struct nlmsghdr *nlmh; ++ ssize_t read_len; ++ bool done = false; ++ ++ struct ++ { ++ struct nlmsghdr nlh; ++ struct rtgenmsg g; ++ } req; ++ ++ memset (&snl, 0, sizeof snl); ++ snl.nl_family = AF_NETLINK; ++ ++ memset (&req, 0, sizeof req); ++ req.nlh.nlmsg_len = sizeof req; ++ req.nlh.nlmsg_type = type; ++ req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; ++ req.nlh.nlmsg_pid = h->pid; ++ req.nlh.nlmsg_seq = ++h->seq; ++ req.g.rtgen_family = AF_UNSPEC; ++ ++ ret = dce_sendto (h->fd, (void *) &req, sizeof req, 0, ++ (struct sockaddr *) &snl, sizeof snl); ++ if (ret < 0) ++ { ++ return -1; ++ } ++ ++ char *buf; ++ const size_t buf_size = PAGE_SIZE; ++ buf = (char *)dce_malloc (buf_size); ++ if (!buf) ++ return -1; ++ struct iovec iov = { buf, buf_size }; ++ ++ while (! done) ++ { ++ struct msghdr msg = ++ { ++ (void *) &nladdr, sizeof (nladdr), ++ &iov, 1, ++ NULL, 0, ++ 0 ++ }; ++ ++ read_len = dce_recvmsg (h->fd, &msg, 0); ++ if (read_len < 0) ++ goto out_fail; ++ ++ if (nladdr.nl_pid != 0) ++ continue; ++ ++ if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0)) ++ goto out_fail; ++ ++ size_t count = 0; ++ size_t remaining_len = read_len; ++ for (nlmh = (struct nlmsghdr *) buf; ++ NLMSG_OK (nlmh, remaining_len); ++ nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len)) ++ { ++ if ((pid_t) nlmh->nlmsg_pid != h->pid ++ || nlmh->nlmsg_seq != h->seq) ++ continue; ++ ++ ++count; ++ if (nlmh->nlmsg_type == NLMSG_DONE) ++ { ++ /* We found the end, leave the loop. */ ++ done = true; ++ break; ++ } ++ if (nlmh->nlmsg_type == NLMSG_ERROR) ++ { ++ struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh); ++ if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) ++ errno = EIO; ++ else ++ errno = -nlerr->error; ++ goto out_fail; ++ } ++ } ++ ++ /* If there was nothing with the expected nlmsg_pid and nlmsg_seq, ++ there is no point to record it. */ ++ if (count == 0) ++ continue; ++ ++ nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res) ++ + read_len); ++ if (nlm_next == NULL) ++ goto out_fail; ++ nlm_next->next = NULL; ++ nlm_next->nlh = (struct nlmsghdr *)memcpy (nlm_next + 1, buf, read_len); ++ nlm_next->size = read_len; ++ nlm_next->seq = h->seq; ++ if (h->nlm_list == NULL) ++ h->nlm_list = nlm_next; ++ else ++ h->end_ptr->next = nlm_next; ++ h->end_ptr = nlm_next; ++ } ++ ++ dce_free (buf); ++ return 0; ++ ++out_fail: ++ dce_free (buf); ++ return -1; ++} ++ ++static int ++map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max) ++{ ++ int i; ++ ++ for (i = 0; i < max; i++) ++ { ++ if (map[i] == -1) ++ { ++ map[i] = index; ++ if (i > 0) ++ ifas[i - 1].ifa.ifa_next = &ifas[i].ifa; ++ return i; ++ } ++ else if (map[i] == index) ++ return i; ++ } ++ /* This should never be reached. If this will be reached, we have ++ a very big problem. */ ++ dce_abort (); ++} ++ ++static void ++__netlink_free_handle (struct netlink_handle *h) ++{ ++ struct netlink_res *ptr; ++ int saved_errno = errno; ++ ++ ptr = h->nlm_list; ++ while (ptr != NULL) ++ { ++ struct netlink_res *tmpptr; ++ ++ tmpptr = ptr->next; ++ free (ptr); ++ ptr = tmpptr; ++ } ++ ++ Current ()->err = saved_errno; ++} ++ ++/* ++ * Try to emulate netlink socket query to work both ns3 stack and ++ * linux stack. ++ */ ++int ++dce_getifaddrs (struct ifaddrs **ifap) ++{ ++ struct netlink_handle nh = {0, 0, 0, NULL, NULL}; ++ struct sockaddr_nl nladdr; ++ struct netlink_res *nlp; ++ struct ifaddrs_storage *ifas; ++ unsigned int i, newlink, newaddr, newaddr_idx; ++ int *map_newlink_data; ++ size_t ifa_data_size = 0; /* Size to allocate for all ifa_data. */ ++ char *ifa_data_ptr; /* Pointer to the unused part of memory for ++ ifa_data. */ ++ int result = 0; ++ ++ nh.fd = dce_socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); ++ if (nh.fd < 0) ++ { ++ Current ()->err = EINVAL; ++ return -1; ++ } ++ ++ memset (&nladdr, 0, sizeof (nladdr)); ++ nladdr.nl_family = AF_NETLINK; ++ if (dce_bind (nh.fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0) ++ { ++ dce_close (nh.fd); ++ Current ()->err = EINVAL; ++ return -1; ++ } ++ socklen_t addr_len = sizeof (nladdr); ++ if (dce_getsockname (nh.fd, (struct sockaddr *) &nladdr, &addr_len) < 0) ++ { ++ dce_close (nh.fd); ++ Current ()->err = EINVAL; ++ return -1; ++ } ++ nh.pid = nladdr.nl_pid; ++ ++ ++ if (netlink_request (&nh, RTM_GETLINK) < 0) ++ { ++ dce_close (nh.fd); ++ Current ()->err = EINVAL; ++ return -1; ++ } ++ ++ ++nh.seq; ++ if (netlink_request (&nh, RTM_GETADDR) < 0) ++ { ++ dce_close (nh.fd); ++ Current ()->err = EINVAL; ++ return -1; ++ } ++ ++ ++ ++ newlink = newaddr = 0; ++ for (nlp = nh.nlm_list; nlp; nlp = nlp->next) ++ { ++ struct nlmsghdr *nlh; ++ size_t size = nlp->size; ++ ++ if (nlp->nlh == NULL) ++ continue; ++ ++ /* Walk through all entries we got from the kernel and look, which ++ message type they contain. */ ++ for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size)) ++ { ++ /* Check if the message is what we want. */ ++ if ((pid_t) nlh->nlmsg_pid != nh.pid || nlh->nlmsg_seq != nlp->seq) ++ continue; ++ ++ if (nlh->nlmsg_type == NLMSG_DONE) ++ break; /* ok */ ++ ++ if (nlh->nlmsg_type == RTM_NEWLINK) ++ { ++ /* A RTM_NEWLINK message can have IFLA_STATS data. We need to ++ know the size before creating the list to allocate enough ++ memory. */ ++ struct ifinfomsg *ifim = (struct ifinfomsg *) NLMSG_DATA (nlh); ++ struct rtattr *rta = IFLA_RTA (ifim); ++ size_t rtasize = IFLA_PAYLOAD (nlh); ++ ++ while (RTA_OK (rta, rtasize)) ++ { ++ size_t rta_payload = RTA_PAYLOAD (rta); ++ ++ if (rta->rta_type == IFLA_STATS) ++ { ++ ifa_data_size += rta_payload; ++ break; ++ } ++ else ++ rta = RTA_NEXT (rta, rtasize); ++ } ++ ++newlink; ++ } ++ else if (nlh->nlmsg_type == RTM_NEWADDR) ++ ++newaddr; ++ } ++ } ++ ++ /* Return if no interface is up. */ ++ if ((newlink + newaddr) == 0) ++ goto exit_free; ++ ++ /* Allocate memory for all entries we have and initialize next ++ pointer. */ ++ ifas = (struct ifaddrs_storage *) calloc (1, ++ (newlink + newaddr) ++ * sizeof (struct ifaddrs_storage) ++ + ifa_data_size); ++ if (ifas == NULL) ++ { ++ result = -1; ++ goto exit_free; ++ } ++ ++ /* Table for mapping kernel index to entry in our list. */ ++ map_newlink_data = (int *)alloca (newlink * sizeof (int)); ++ memset (map_newlink_data, '\xff', newlink * sizeof (int)); ++ ++ ifa_data_ptr = (char *) &ifas[newlink + newaddr]; ++ newaddr_idx = 0; /* Counter for newaddr index. */ ++ ++ /* Walk through the list of data we got from the kernel. */ ++ for (nlp = nh.nlm_list; nlp; nlp = nlp->next) ++ { ++ struct nlmsghdr *nlh; ++ size_t size = nlp->size; ++ ++ if (nlp->nlh == NULL) ++ continue; ++ ++ /* Walk through one message and look at the type: If it is our ++ message, we need RTM_NEWLINK/RTM_NEWADDR and stop if we reach ++ the end or we find the end marker (in this case we ignore the ++ following data. */ ++ for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size)) ++ { ++ int ifa_index = 0; ++ ++ /* Check if the message is the one we want */ ++ if ((pid_t) nlh->nlmsg_pid != nh.pid || nlh->nlmsg_seq != nlp->seq) ++ continue; ++ ++ if (nlh->nlmsg_type == NLMSG_DONE) ++ break; /* ok */ ++ ++ if (nlh->nlmsg_type == RTM_NEWLINK) ++ { ++ /* We found a new interface. Now extract everything from the ++ interface data we got and need. */ ++ struct ifinfomsg *ifim = (struct ifinfomsg *) NLMSG_DATA (nlh); ++ struct rtattr *rta = IFLA_RTA (ifim); ++ size_t rtasize = IFLA_PAYLOAD (nlh); ++ ++ /* Interfaces are stored in the first "newlink" entries ++ of our list, starting in the order as we got from the ++ kernel. */ ++ ifa_index = map_newlink (ifim->ifi_index - 1, ifas, ++ map_newlink_data, newlink); ++ ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags; ++ ++ while (RTA_OK (rta, rtasize)) ++ { ++ char *rta_data = (char *)RTA_DATA (rta); ++ size_t rta_payload = RTA_PAYLOAD (rta); ++ ++ switch (rta->rta_type) ++ { ++ case IFLA_ADDRESS: ++ if (rta_payload <= sizeof (ifas[ifa_index].addr)) ++ { ++ ifas[ifa_index].addr.sl.sll_family = AF_PACKET; ++ memcpy (ifas[ifa_index].addr.sl.sll_addr, ++ (char *) rta_data, rta_payload); ++ ifas[ifa_index].addr.sl.sll_halen = rta_payload; ++ ifas[ifa_index].addr.sl.sll_ifindex ++ = ifim->ifi_index; ++ ifas[ifa_index].addr.sl.sll_hatype = ifim->ifi_type; ++ ++ ifas[ifa_index].ifa.ifa_addr ++ = &ifas[ifa_index].addr.sa; ++ } ++ break; ++ ++ case IFLA_BROADCAST: ++ if (rta_payload <= sizeof (ifas[ifa_index].broadaddr)) ++ { ++ ifas[ifa_index].broadaddr.sl.sll_family = AF_PACKET; ++ memcpy (ifas[ifa_index].broadaddr.sl.sll_addr, ++ (char *) rta_data, rta_payload); ++ ifas[ifa_index].broadaddr.sl.sll_halen = rta_payload; ++ ifas[ifa_index].broadaddr.sl.sll_ifindex ++ = ifim->ifi_index; ++ ifas[ifa_index].broadaddr.sl.sll_hatype ++ = ifim->ifi_type; ++ ++ ifas[ifa_index].ifa.ifa_broadaddr ++ = &ifas[ifa_index].broadaddr.sa; ++ } ++ break; ++ ++ case IFLA_IFNAME: /* Name of Interface */ ++ if ((rta_payload + 1) <= sizeof (ifas[ifa_index].name)) ++ { ++ ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name; ++ *(char *) __mempcpy (ifas[ifa_index].name, rta_data, ++ rta_payload) = '\0'; ++ } ++ break; ++ ++ case IFLA_STATS: /* Statistics of Interface */ ++ ifas[ifa_index].ifa.ifa_data = ifa_data_ptr; ++ ifa_data_ptr += rta_payload; ++ memcpy (ifas[ifa_index].ifa.ifa_data, rta_data, ++ rta_payload); ++ break; ++ ++ case IFLA_UNSPEC: ++ break; ++ case IFLA_MTU: ++ break; ++ case IFLA_LINK: ++ break; ++ case IFLA_QDISC: ++ break; ++ default: ++ break; ++ } ++ ++ rta = RTA_NEXT (rta, rtasize); ++ } ++ } ++ else if (nlh->nlmsg_type == RTM_NEWADDR) ++ { ++ struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlh); ++ struct rtattr *rta = IFA_RTA (ifam); ++ size_t rtasize = IFA_PAYLOAD (nlh); ++ ++ /* New Addresses are stored in the order we got them from ++ the kernel after the interfaces. Theoretically it is possible ++ that we have holes in the interface part of the list, ++ but we always have already the interface for this address. */ ++ ifa_index = newlink + newaddr_idx; ++ ifas[ifa_index].ifa.ifa_flags ++ = ifas[map_newlink (ifam->ifa_index - 1, ifas, ++ map_newlink_data, newlink)].ifa.ifa_flags; ++ if (ifa_index > 0) ++ ifas[ifa_index - 1].ifa.ifa_next = &ifas[ifa_index].ifa; ++ ++newaddr_idx; ++ ++ while (RTA_OK (rta, rtasize)) ++ { ++ char *rta_data = (char *)RTA_DATA (rta); ++ size_t rta_payload = RTA_PAYLOAD (rta); ++ ++ switch (rta->rta_type) ++ { ++ case IFA_ADDRESS: ++ { ++ struct sockaddr *sa; ++ ++ if (ifas[ifa_index].ifa.ifa_addr != NULL) ++ { ++ /* In a point-to-poing network IFA_ADDRESS ++ contains the destination address, local ++ address is supplied in IFA_LOCAL attribute. ++ destination address and broadcast address ++ are stored in an union, so it doesn't matter ++ which name we use. */ ++ ifas[ifa_index].ifa.ifa_broadaddr ++ = &ifas[ifa_index].broadaddr.sa; ++ sa = &ifas[ifa_index].broadaddr.sa; ++ } ++ else ++ { ++ ifas[ifa_index].ifa.ifa_addr ++ = &ifas[ifa_index].addr.sa; ++ sa = &ifas[ifa_index].addr.sa; ++ } ++ ++ sa->sa_family = ifam->ifa_family; ++ ++ switch (ifam->ifa_family) ++ { ++ case AF_INET: ++ /* Size must match that of an address for IPv4. */ ++ if (rta_payload == 4) ++ memcpy (&((struct sockaddr_in *) sa)->sin_addr, ++ rta_data, rta_payload); ++ break; ++ ++ case AF_INET6: ++ /* Size must match that of an address for IPv6. */ ++ if (rta_payload == 16) ++ { ++ memcpy (&((struct sockaddr_in6 *) sa)->sin6_addr, ++ rta_data, rta_payload); ++ if (IN6_IS_ADDR_LINKLOCAL (rta_data) ++ || IN6_IS_ADDR_MC_LINKLOCAL (rta_data)) ++ ((struct sockaddr_in6 *) sa)->sin6_scope_id ++ = ifam->ifa_index; ++ } ++ break; ++ ++ default: ++ if (rta_payload <= sizeof (ifas[ifa_index].addr)) ++ memcpy (sa->sa_data, rta_data, rta_payload); ++ break; ++ } ++ } ++ break; ++ ++ case IFA_LOCAL: ++ if (ifas[ifa_index].ifa.ifa_addr != NULL) ++ { ++ /* If ifa_addr is set and we get IFA_LOCAL, ++ assume we have a point-to-point network. ++ Move address to correct field. */ ++ ifas[ifa_index].broadaddr = ifas[ifa_index].addr; ++ ifas[ifa_index].ifa.ifa_broadaddr ++ = &ifas[ifa_index].broadaddr.sa; ++ memset (&ifas[ifa_index].addr, '\0', ++ sizeof (ifas[ifa_index].addr)); ++ } ++ ++ ifas[ifa_index].ifa.ifa_addr = &ifas[ifa_index].addr.sa; ++ ifas[ifa_index].ifa.ifa_addr->sa_family ++ = ifam->ifa_family; ++ ++ switch (ifam->ifa_family) ++ { ++ case AF_INET: ++ /* Size must match that of an address for IPv4. */ ++ if (rta_payload == 4) ++ memcpy (&ifas[ifa_index].addr.s4.sin_addr, ++ rta_data, rta_payload); ++ break; ++ ++ case AF_INET6: ++ /* Size must match that of an address for IPv6. */ ++ if (rta_payload == 16) ++ { ++ memcpy (&ifas[ifa_index].addr.s6.sin6_addr, ++ rta_data, rta_payload); ++ if (IN6_IS_ADDR_LINKLOCAL (rta_data) ++ || IN6_IS_ADDR_MC_LINKLOCAL (rta_data)) ++ ifas[ifa_index].addr.s6.sin6_scope_id = ++ ifam->ifa_index; ++ } ++ break; ++ ++ default: ++ if (rta_payload <= sizeof (ifas[ifa_index].addr)) ++ memcpy (ifas[ifa_index].addr.sa.sa_data, ++ rta_data, rta_payload); ++ break; ++ } ++ break; ++ ++ case IFA_BROADCAST: ++ /* We get IFA_BROADCAST, so IFA_LOCAL was too much. */ ++ if (ifas[ifa_index].ifa.ifa_broadaddr != NULL) ++ memset (&ifas[ifa_index].broadaddr, '\0', ++ sizeof (ifas[ifa_index].broadaddr)); ++ ++ ifas[ifa_index].ifa.ifa_broadaddr ++ = &ifas[ifa_index].broadaddr.sa; ++ ifas[ifa_index].ifa.ifa_broadaddr->sa_family ++ = ifam->ifa_family; ++ ++ switch (ifam->ifa_family) ++ { ++ case AF_INET: ++ /* Size must match that of an address for IPv4. */ ++ if (rta_payload == 4) ++ memcpy (&ifas[ifa_index].broadaddr.s4.sin_addr, ++ rta_data, rta_payload); ++ break; ++ ++ case AF_INET6: ++ /* Size must match that of an address for IPv6. */ ++ if (rta_payload == 16) ++ { ++ memcpy (&ifas[ifa_index].broadaddr.s6.sin6_addr, ++ rta_data, rta_payload); ++ if (IN6_IS_ADDR_LINKLOCAL (rta_data) ++ || IN6_IS_ADDR_MC_LINKLOCAL (rta_data)) ++ ifas[ifa_index].broadaddr.s6.sin6_scope_id ++ = ifam->ifa_index; ++ } ++ break; ++ ++ default: ++ if (rta_payload <= sizeof (ifas[ifa_index].addr)) ++ memcpy (&ifas[ifa_index].broadaddr.sa.sa_data, ++ rta_data, rta_payload); ++ break; ++ } ++ break; ++ ++ case IFA_LABEL: ++ if (rta_payload + 1 <= sizeof (ifas[ifa_index].name)) ++ { ++ ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name; ++ *(char *) __mempcpy (ifas[ifa_index].name, rta_data, ++ rta_payload) = '\0'; ++ } ++ else ++ abort (); ++ break; ++ ++ case IFA_UNSPEC: ++ break; ++ case IFA_CACHEINFO: ++ break; ++ default: ++ break; ++ } ++ ++ rta = RTA_NEXT (rta, rtasize); ++ } ++ ++ /* If we didn't get the interface name with the ++ address, use the name from the interface entry. */ ++ if (ifas[ifa_index].ifa.ifa_name == NULL) ++ ifas[ifa_index].ifa.ifa_name ++ = ifas[map_newlink (ifam->ifa_index - 1, ifas, ++ map_newlink_data, newlink)].ifa.ifa_name; ++ ++ /* Calculate the netmask. */ ++ if (ifas[ifa_index].ifa.ifa_addr ++ && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_UNSPEC ++ && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_PACKET) ++ { ++ uint32_t max_prefixlen = 0; ++ char *cp = NULL; ++ ++ ifas[ifa_index].ifa.ifa_netmask ++ = &ifas[ifa_index].netmask.sa; ++ ++ switch (ifas[ifa_index].ifa.ifa_addr->sa_family) ++ { ++ case AF_INET: ++ cp = (char *) &ifas[ifa_index].netmask.s4.sin_addr; ++ max_prefixlen = 32; ++ break; ++ ++ case AF_INET6: ++ cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr; ++ max_prefixlen = 128; ++ break; ++ } ++ ++ ifas[ifa_index].ifa.ifa_netmask->sa_family ++ = ifas[ifa_index].ifa.ifa_addr->sa_family; ++ ++ if (cp != NULL) ++ { ++ char c; ++ unsigned int preflen; ++ ++ if ((max_prefixlen > 0) && ++ (ifam->ifa_prefixlen > max_prefixlen)) ++ preflen = max_prefixlen; ++ else ++ preflen = ifam->ifa_prefixlen; ++ ++ for (i = 0; i < (preflen / 8); i++) ++ *cp++ = 0xff; ++ c = 0xff; ++ c <<= (8 - (preflen % 8)); ++ *cp = c; ++ } ++ } ++ } ++ } ++ } ++ ++ NS_ASSERT (ifa_data_ptr <= (char *) &ifas[newlink + newaddr] + ifa_data_size); ++ ++ if (newaddr_idx > 0) ++ { ++ for (i = 0; i < newlink; ++i) ++ if (map_newlink_data[i] == -1) ++ { ++ /* We have fewer links then we anticipated. Adjust the ++ forward pointer to the first address entry. */ ++ ifas[i - 1].ifa.ifa_next = &ifas[newlink].ifa; ++ } ++ ++ if (i == 0 && newlink > 0) ++ /* No valid link, but we allocated memory. We have to ++ populate the first entry. */ ++ memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage)); ++ } ++ ++ *ifap = &ifas[0].ifa; ++ ++ exit_free: ++ __netlink_free_handle (&nh); ++ dce_close (nh.fd); ++ ++ return 0; ++} +diff -r 7d0d6d7cda40 model/dce-netdb.h +--- a/model/dce-netdb.h Thu Apr 26 11:21:55 2012 +0900 ++++ b/model/dce-netdb.h Fri Apr 27 19:40:18 2012 +0900 +@@ -18,6 +18,7 @@ + socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags); + + void dce_herror(const char *string); ++int dce_getifaddrs (struct ifaddrs **ifap); + + #ifdef __cplusplus + } +diff -r 7d0d6d7cda40 model/dce-syslog.cc +--- a/model/dce-syslog.cc Thu Apr 26 11:21:55 2012 +0900 ++++ b/model/dce-syslog.cc Fri Apr 27 19:40:18 2012 +0900 +@@ -66,6 +66,7 @@ + Process *process = Current ()->process; + + vfprintf (process->syslog, message, args); ++ fprintf (process->syslog, "\n"); + } + + void +diff -r 7d0d6d7cda40 model/libc-dce.cc +--- a/model/libc-dce.cc Thu Apr 26 11:21:55 2012 +0900 ++++ b/model/libc-dce.cc Fri Apr 27 19:40:18 2012 +0900 +@@ -89,6 +89,7 @@ + #include + #include + #include ++#include + + extern void __cxa_finalize (void *d); + extern int __cxa_atexit (void (*func) (void *), void *arg, void *d); +diff -r 7d0d6d7cda40 model/libc-ns3.h +--- a/model/libc-ns3.h Thu Apr 26 11:21:55 2012 +0900 ++++ b/model/libc-ns3.h Fri Apr 27 19:40:18 2012 +0900 +@@ -167,6 +167,8 @@ + DCE_WITH_ALIAS2 (fileno,fileno_unlocked) + + DCE (perror) ++NATIVE (flockfile) ++NATIVE (funlockfile) + + // stdarg + DCE (vprintf) +@@ -369,6 +371,8 @@ + DCE (gethostbyname) + DCE (gethostbyname2) + DCE (getaddrinfo) ++DCE (getifaddrs) ++NATIVE (freeifaddrs) + // these three calls will effectively use /etc/passwd on the base system + NATIVE (gethostent) + NATIVE (sethostent) +@@ -440,6 +444,8 @@ + + // sys/resource.h + NATIVE (getrusage) // not sure if native call will give stats about the requested process.. ++NATIVE (getrlimit) ++NATIVE (setrlimit) + + // syslog.h + DCE (openlog) +@@ -478,6 +484,8 @@ + NATIVE (bindtextdomain) + NATIVE (textdomain) + NATIVE (gettext) ++NATIVE (catopen) ++NATIVE (catgets) + + // signal.h + DCE (sigprocmask) diff -r f86f5b19833f -r 5ca51e147e7f dns_unbound.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dns_unbound.patch Fri May 11 17:03:32 2012 +0900 @@ -0,0 +1,424 @@ +diff -r 6a5297994128 example/dce-unbound.cc +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/example/dce-unbound.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -0,0 +1,98 @@ ++#include "ns3/core-module.h" ++#include "ns3/network-module.h" ++#include "ns3/dce-module.h" ++#include "ns3/point-to-point-module.h" ++#include "ns3/csma-module.h" ++#include "ns3/wifi-module.h" ++#include "ns3/mobility-module.h" ++#include ++ ++using namespace ns3; ++ ++static void RunIp (Ptr node, Time at, std::string str) ++{ ++ DceApplicationHelper process; ++ ApplicationContainer apps; ++ process.SetBinary ("ip"); ++ process.SetStackSize (1<<16); ++ process.ResetArguments(); ++ process.ParseArguments(str.c_str ()); ++ apps = process.Install (node); ++ apps.Start (at); ++} ++ ++static void AddAddress (Ptr node, Time at, const char *name, const std::string prefixAddr, ++ int number, std::string suffixAddr) ++{ ++ std::ostringstream oss; ++ oss << "-f inet addr add " << prefixAddr << number << suffixAddr << " dev " << name; ++ RunIp (node, at, oss.str ()); ++} ++ ++int main (int argc, char *argv[]) ++{ ++ CommandLine cmd; ++ cmd.Parse (argc, argv); ++ ++ NodeContainer nodes; ++ nodes.Create (2); ++ ++ NetDeviceContainer devices; ++ ++ PointToPointHelper p2p; ++ p2p.SetDeviceAttribute ("DataRate", StringValue ("5Gbps")); ++ p2p.SetChannelAttribute ("Delay", StringValue ("1ms")); ++ devices = p2p.Install (nodes); ++ p2p.EnablePcapAll ("process-unbound"); ++ ++ DceManagerHelper processManager; ++ processManager.SetLoader ("ns3::DlmLoaderFactory"); ++ // processManager.SetTaskManagerAttribute ("FiberManagerType", ++ // EnumValue (0)); ++ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory", ++ "Library", StringValue ("libnet-next-2.6.so")); ++ processManager.Install (nodes); ++ ++ for (int n=0; n < 2; n++) ++ { ++ AddAddress (nodes.Get (n), Seconds (0.1), "sim0", "10.0.0.", 2 + n, "/8" ); ++ RunIp (nodes.Get (n), Seconds (0.11), "link set sim0 up arp off"); ++ RunIp (nodes.Get (n), Seconds (0.2), "link show"); ++ RunIp (nodes.Get (n), Seconds (0.3), "route show table all"); ++ RunIp (nodes.Get (n), Seconds (0.4), "addr list"); ++ } ++ RunIp (nodes.Get (1), Seconds (1.2), "route add default via 10.0.0.2 dev sim0"); ++ ++ DceApplicationHelper process; ++ ApplicationContainer apps; ++ ++ process.SetBinary ("unbound"); ++ process.ResetArguments (); ++ process.ParseArguments ("-d"); ++ process.SetStackSize (1<<16); ++ apps = process.Install (nodes.Get (0)); ++ apps.Start (Seconds (1.0)); ++ ++ for (int i = 0; i < 20; i++) ++ { ++ process.SetBinary ("unbound-host"); ++ process.ResetArguments (); ++ process.ParseArguments ("www.example.com"); ++ process.ParseArguments ("-d"); ++ process.ParseArguments ("-d"); ++ process.ParseArguments ("-v"); ++ process.ParseArguments ("-r"); ++ process.ParseArguments ("-f"); ++ process.ParseArguments ("/etc/root.key"); ++ apps = process.Install (nodes.Get (1)); ++ ++ apps.Start (Seconds (1+ 10*i)); ++ } ++ ++ ++ Simulator::Stop (Seconds (2000000.0)); ++ Simulator::Run (); ++ Simulator::Destroy (); ++ ++ return 0; ++} +diff -r 6a5297994128 model/dce-credentials.cc +--- a/model/dce-credentials.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-credentials.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -53,3 +53,15 @@ + int ret = eaccess (rPath.c_str (), mode); + return ret; + } ++ ++int dce_chown(const char *path, uid_t owner, gid_t group) ++{ ++ // XXX ++ return 0; ++} ++ ++int dce_initgroups(const char *user, gid_t group) ++{ ++ // XXX ++ return 0; ++} +diff -r 6a5297994128 model/dce-stdio.cc +--- a/model/dce-stdio.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-stdio.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -722,6 +722,16 @@ + va_end (ap); + return retval; + } ++int dce___vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, ++ size_t __slen, ++ __const char *__restrict __format, _G_va_list __ap) ++{ ++ NS_LOG_FUNCTION (Current () << UtilsGetNodeId ()); ++ NS_ASSERT (Current () != 0); ++ ++ int retval = vsnprintf (__s, __n, __format, __ap); ++ return retval; ++} + void dce___fpurge (FILE *stream) + { + NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << stream); +diff -r 6a5297994128 model/dce-stdio.h +--- a/model/dce-stdio.h Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-stdio.h Thu Apr 26 11:21:55 2012 +0900 +@@ -62,6 +62,9 @@ + __const char *__restrict __format, ...); + int dce___snprintf_chk (char *__restrict __s, size_t __n, int __flag, + size_t __slen, __const char *__restrict __format, ...); ++int dce___vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, ++ size_t __slen, ++ __const char *__restrict __format, _G_va_list __ap); + + void dce___fpurge (FILE *stream); + size_t dce___fpending(FILE *stream); +diff -r 6a5297994128 model/dce-syslog.cc +--- a/model/dce-syslog.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-syslog.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -67,3 +67,14 @@ + + vfprintf (process->syslog, message, args); + } ++ ++void ++dce___syslog_chk (int __pri, int __flag, __const char *__fmt, ...) ++{ ++ NS_ASSERT (Current () != 0); ++ ++ va_list ap; ++ va_start (ap, __fmt); ++ dce_vsyslog (__pri, __fmt, ap); ++ va_end (ap); ++} +diff -r 6a5297994128 model/dce-syslog.h +--- a/model/dce-syslog.h Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-syslog.h Thu Apr 26 11:21:55 2012 +0900 +@@ -19,4 +19,7 @@ + void + dce_vsyslog (int priority, const char *message, va_list args); + ++void ++dce___syslog_chk (int __pri, int __flag, __const char *__fmt, ...); ++ + #endif // DCE_SYSLOG_H +diff -r 6a5297994128 model/dce-unistd.h +--- a/model/dce-unistd.h Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce-unistd.h Thu Apr 26 11:21:55 2012 +0900 +@@ -74,6 +74,8 @@ + + ssize_t dce_pread(int fd, void *buf, size_t count, off_t offset); + ssize_t dce_pwrite(int fd, const void *buf, size_t count, off_t offset); ++int dce_chown(const char *path, uid_t owner, gid_t group); ++int dce_initgroups(const char *user, gid_t group); + + #ifdef __cplusplus + } +diff -r 6a5297994128 model/dce.cc +--- a/model/dce.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dce.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -141,7 +141,7 @@ + current->err = EPERM; + return -1; + } +- if (sgid != (gid_t)-1 || ++ if (sgid != (gid_t)-1 && + !is_set_ucapable (sgid)) + { + current->err = EPERM; +diff -r 6a5297994128 model/dlm-loader-factory.cc +--- a/model/dlm-loader-factory.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/dlm-loader-factory.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -3,6 +3,7 @@ + #include "ns3/fatal-error.h" + #include + #include ++#include + + NS_LOG_COMPONENT_DEFINE ("DlmLoaderFactory"); + +@@ -34,6 +35,10 @@ + virtual void Unload (void *module); + virtual void *Lookup (void *module, std::string symbol); + private: ++ bool SearchFile (std::string filename, std::string *fullname) const; ++ std::list GetSearchDirectories (void) const; ++ std::list Split (std::string input, std::string sep) const; ++ bool Exists (std::string filename) const; + Lmid_t m_lmid; + std::list m_loaded; + }; +@@ -83,11 +88,98 @@ + ::dlclose (*i); + } + } ++std::list ++DlmLoader::Split (std::string input, std::string sep) const ++{ ++ NS_LOG_FUNCTION (this << input << sep); ++ std::list retval; ++ std::string::size_type cur = 0, next; ++ while (true) ++ { ++ next = input.find (sep, cur); ++ if (next == cur) ++ { ++ cur ++; ++ continue; ++ } ++ else if (next == std::string::npos) ++ { ++ if (input.size () != cur) ++ { ++ retval.push_back (input.substr (cur, input.size () - cur)); ++ } ++ break; ++ } ++ retval.push_back (input.substr (cur, next - cur)); ++ cur = next + 1; ++ } ++ return retval; ++} ++std::list ++DlmLoader::GetSearchDirectories (void) const ++{ ++ NS_LOG_FUNCTION (this); ++ std::list directories; ++ char *ldLibraryPath = getenv ("LD_LIBRARY_PATH"); ++ if (ldLibraryPath != 0) ++ { ++ std::list tmp = Split (ldLibraryPath, ":"); ++ directories.insert (directories.end (), ++ tmp.begin (), ++ tmp.end ()); ++ } ++ char *path = getenv ("PATH"); ++ if (path != 0) ++ { ++ std::list tmp = Split (path, ":"); ++ directories.insert (directories.end (), ++ tmp.begin (), ++ tmp.end ()); ++ } ++ directories.push_back ("/lib"); ++ directories.push_back ("/usr/lib"); ++ directories.push_back ("."); ++ return directories; ++} ++bool ++DlmLoader::Exists (std::string filename) const ++{ ++ //NS_LOG_FUNCTION (this << filename); ++ struct stat st; ++ int retval = ::stat (filename.c_str (), &st); ++ return retval == 0; ++} ++bool ++DlmLoader::SearchFile (std::string filename, std::string *fullname) const ++{ ++ NS_LOG_FUNCTION (this << filename); ++ if (Exists (filename)) ++ { ++ *fullname = filename; ++ NS_LOG_DEBUG ("Found: " << filename << " as " << *fullname); ++ return true; ++ } ++ std::list dirs = GetSearchDirectories (); ++ for (std::list::const_iterator i = dirs.begin (); i != dirs.end (); i++) ++ { ++ if (Exists (*i + "/" + filename)) ++ { ++ *fullname = *i + "/" + filename; ++ NS_LOG_DEBUG ("Found: " << filename << " as " << *fullname); ++ return true; ++ } ++ } ++ return false; ++} + void * + DlmLoader::Load (std::string filename, int flag) + { ++ std::string fullname; ++ bool found; + NS_LOG_FUNCTION (this << filename << flag); +- void *module = dlmopen (m_lmid, filename.c_str (), flag); ++ found = SearchFile (filename, &fullname); ++ NS_ASSERT (found); ++ void *module = dlmopen (m_lmid, fullname.c_str (), flag); + m_loaded.push_back (module); + return module; + } +diff -r 6a5297994128 model/libc-dce.cc +--- a/model/libc-dce.cc Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/libc-dce.cc Thu Apr 26 11:21:55 2012 +0900 +@@ -129,11 +129,13 @@ + __THROW; + extern int __obstack_vprintf_chk (struct obstack *, int, const char *, + _G_va_list) __THROW; ++extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...); + + typedef void (*func_t) (...); + + extern "C" { + ++extern void *__memcpy_chk(void *dest, const void *src, size_t n, size_t __destlen); + void libc_dce (struct Libc **libc) + { + *libc = new Libc; +diff -r 6a5297994128 model/libc-ns3.h +--- a/model/libc-ns3.h Thu Apr 26 09:56:01 2012 +0900 ++++ b/model/libc-ns3.h Thu Apr 26 11:21:55 2012 +0900 +@@ -83,6 +83,7 @@ + DCE (writev) + NATIVE (memset) + NATIVE (memcpy) ++NATIVE (__memcpy_chk) + NATIVE (bcopy) + NATIVE (memcmp) + NATIVE (memmove) +@@ -102,6 +103,7 @@ + NATIVE_EXPLICIT (strchr, char* (*) (char *, int)) + NATIVE_EXPLICIT (strrchr, const char * (*) (const char *, int)) + //DCE (strrchr) ++NATIVE_EXPLICIT (strstr, const char * (*) (const char *, const char *)) + NATIVE (strcasecmp) + NATIVE (strncasecmp) + +@@ -129,6 +131,7 @@ + DCE (__vfprintf_chk) + DCE (__fprintf_chk) + DCE (__snprintf_chk) ++DCE (__vsnprintf_chk) + + DCE_WITH_ALIAS2 (fgetc,fgetc_unlocked) + NATIVE (getc) +@@ -357,6 +360,10 @@ + NATIVE (pthread_rwlock_destroy) + NATIVE (pthread_setcancelstate) + NATIVE (pthread_sigmask) ++NATIVE (pthread_spin_init) ++NATIVE (pthread_spin_lock) ++NATIVE (pthread_spin_unlock) ++NATIVE (pthread_spin_destroy) + + // netdb.h + DCE (gethostbyname) +@@ -440,6 +447,7 @@ + DCE (setlogmask) + DCE (syslog) + DCE (vsyslog) ++DCE (__syslog_chk) + + // unistd.h + NATIVE (sysconf) +@@ -455,6 +463,8 @@ + DCE (eaccess) + DCE (pipe) + NATIVE (pathconf) ++DCE (chown) ++DCE (initgroups) + + // this is wrong. clock should be changed to DCE implementation + DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime) +diff -r 6a5297994128 wscript +--- a/wscript Thu Apr 26 09:56:01 2012 +0900 ++++ b/wscript Thu Apr 26 11:21:55 2012 +0900 +@@ -37,6 +37,8 @@ + + conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed') + conf.env.append_value('LINKFLAGS', '-pthread') ++ conf.env.append_value('LINKFLAGS', '-Wl,--dynamic-linker=' + ++ os.path.abspath ('../build/lib/ldso')) + conf.check (lib='dl', mandatory = True) + conf.check_cc(fragment='int main() {__get_cpu_features();}\n', msg='Checking for glibc get_cpu_features', define_name='HAVE_GETCPUFEATURES', mandatory=False) + +@@ -277,6 +279,10 @@ + target='bin/dce-linux', + source=['example/dce-linux.cc']) + ++ module.add_example(needed = ['core', 'network', 'dce', 'wifi', 'point-to-point', 'csma', 'mobility' ], ++ target='bin/dce-unbound', ++ source=['example/dce-unbound.cc']) ++ + # Add a script to build system + def build_a_script(bld, name, needed = [], **kw): + external = [i for i in needed if not i == name] diff -r f86f5b19833f -r 5ca51e147e7f fedora8-nontimerfd-etc.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fedora8-nontimerfd-etc.patch Fri May 11 17:03:32 2012 +0900 @@ -0,0 +1,306 @@ +diff -r ae3103c9ee50 -r 88ac4b927923 model/dce-dirent.cc +--- a/model/dce-dirent.cc Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/dce-dirent.cc Fri May 11 17:03:08 2012 +0900 +@@ -247,7 +247,7 @@ + std::string vPath = UtilsGetRealFilePath (std::string (dirp)); + + struct dirent **nl = 0; +- int ret = scandir ( vPath.c_str () , &nl, filter, compar); ++ int ret = scandir ( vPath.c_str () , &nl, filter, (int (*)(const void*, const void*))compar); + + if ( (ret > 0) && nl ) + { +diff -r ae3103c9ee50 -r 88ac4b927923 model/dce-stdlib.h +--- a/model/dce-stdlib.h Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/dce-stdlib.h Fri May 11 17:03:08 2012 +0900 +@@ -23,6 +23,7 @@ + int dce_unsetenv (const char *name); + int dce_clearenv (void); + ++ + #ifdef __cplusplus + } + #endif +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-dce.c +--- a/model/libc-dce.c Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/libc-dce.c Fri May 11 17:03:08 2012 +0900 +@@ -32,7 +32,9 @@ + #include "dce-cxa.h" + #include "dce-string.h" + #include "dce-global-variables.h" ++#ifdef HAVE_SYS_TIMER_H + #include "sys/dce-timerfd.h" ++#endif + #include "dce-random.h" + #include "net/dce-if.h" + #include "dce-umask.h" +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-dce.cc +--- a/model/libc-dce.cc Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/libc-dce.cc Fri May 11 17:03:08 2012 +0900 +@@ -12,7 +12,9 @@ + #include "sys/dce-mman.h" + #include "sys/dce-stat.h" + #include "sys/dce-select.h" ++#ifdef HAVE_SYS_TIMER_H + #include "sys/dce-timerfd.h" ++#endif + #include "dce-unistd.h" + #include "dce-netdb.h" + #include "dce-pthread.h" +@@ -67,7 +69,9 @@ + #include + #include + #include ++#ifdef HAVE_SYS_TIMER_H + #include ++#endif + #include + #include + #include +@@ -150,6 +154,7 @@ + #define NATIVE_EXPLICIT(name, type) \ + (*libc)->name ## _fn = (func_t)((type)name); + ++(*libc)->memcpy_fn = memcpy; + #include "libc-ns3.h" + } + } // extern "C" +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc-ns3.h +--- a/model/libc-ns3.h Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/libc-ns3.h Fri May 11 17:03:08 2012 +0900 +@@ -82,7 +82,6 @@ + DCE (write) + DCE (writev) + NATIVE (memset) +-NATIVE (memcpy) + NATIVE (__memcpy_chk) + NATIVE (bcopy) + NATIVE (memcmp) +@@ -400,10 +399,13 @@ + + NATIVE (toupper) + NATIVE (tolower) ++NATIVE (_tolower) + ++#ifdef HAVE_SYS_TIMER_H + DCE (timerfd_create) + DCE (timerfd_settime) + DCE (timerfd_gettime) ++#endif + + DCE (if_nametoindex) + DCE (if_indextoname) +@@ -435,7 +437,8 @@ + NATIVE (__xpg_basename) + + DCE (truncate) +-DCE (ftruncate) ++//DCE (ftruncate) ++DCE_WITH_ALIAS2 (ftruncate,ftruncate64) + + // pwd.h + NATIVE (getpwnam) +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc.cc +--- a/model/libc.cc Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/libc.cc Fri May 11 17:03:08 2012 +0900 +@@ -57,6 +57,12 @@ + + #include "libc-ns3.h" // do the work + ++void *memcpy(void *dest, const void *src, size_t n) ++{ ++ return g_libc.memcpy_fn (dest, src, n); ++} ++ ++ + // weak_alias (strtol, __strtol_internal); + // weak_alias (wctype_l, __wctype_l); + // weak_alias (strdup, __strdup); +diff -r ae3103c9ee50 -r 88ac4b927923 model/libc.h +--- a/model/libc.h Fri Apr 27 19:40:18 2012 +0900 ++++ b/model/libc.h Fri May 11 17:03:08 2012 +0900 +@@ -1,6 +1,7 @@ + #ifndef LIBC_H + #define LIBC_H + ++typedef unsigned int size_t; + struct Libc + { + +@@ -9,6 +10,7 @@ + #define DCET(rtype, name) DCE(name) + + #include "libc-ns3.h" ++void *(*memcpy_fn)(void *dest, const void *src, size_t n); + + }; + +diff -r ae3103c9ee50 -r 88ac4b927923 ns3waf/__init__.py +--- a/ns3waf/__init__.py Fri Apr 27 19:40:18 2012 +0900 ++++ b/ns3waf/__init__.py Fri May 11 17:03:08 2012 +0900 +@@ -446,7 +446,7 @@ + } + """) + os.close(handle) +- kw['source'] = kw['source'] + [os.path.relpath(filename, self._bld.bldnode.abspath())] ++ kw['source'] = kw['source'] + [os.path.join(filename, self._bld.bldnode.abspath())] + self.add_test(needed, **kw) + + def add_test(self, needed = [], **kw): +@@ -464,7 +464,7 @@ + + kw['includes'] = kw.get('includes', []) + self._source_dirs + +- tmp = self._bld.path.relpath_gen(self._bld.srcnode) ++ tmp = self._bld.path(self._bld.srcnode) + objects = [] + for src in kw['source'][0:-1]: + src_target = '%s_object' % src +diff -r ae3103c9ee50 -r 88ac4b927923 test/test-poll.cc +--- a/test/test-poll.cc Fri Apr 27 19:40:18 2012 +0900 ++++ b/test/test-poll.cc Fri May 11 17:03:08 2012 +0900 +@@ -1,7 +1,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -r ae3103c9ee50 -r 88ac4b927923 test/test-select.cc +--- a/test/test-select.cc Fri Apr 27 19:40:18 2012 +0900 ++++ b/test/test-select.cc Fri May 11 17:03:08 2012 +0900 +@@ -2,7 +2,9 @@ + #include + #include + #include ++#ifdef HAVE_SYS_TIMER_H + #include ++#endif + #include + #include + #include +@@ -18,6 +20,7 @@ + #include "test-macros.h" + + // test, that select () with timeout={0,0} exits immediately ++#ifdef HAVE_SYS_TIMER_H + static void + test_select_null_null (void) + { +@@ -58,6 +61,7 @@ + + close (timerfd); + } ++#endif + + static bool + test_select_read (int fd, int timeOutSec, bool needSuccess) +@@ -771,6 +775,7 @@ + TEST_ASSERT (FD_ISSET (sockfd, &wfds)); + } + ++#ifdef HAVE_SYS_TIMER_H + // test, that select () returns correctly if there is two fds for reading and only one available + // solved with else mustWait=false + static void test_select_rfds (void) +@@ -804,6 +809,7 @@ + // no fds must be ready and select() should complete without errors + TEST_ASSERT_EQUAL (nfds, 1); + } ++#endif + + int + main (int argc, char *argv[]) +@@ -815,10 +821,14 @@ + { + test_select_stdin (); + test_select_stdout_stdin (); ++#ifdef HAVE_SYS_TIMER_H + test_select_null_null (); ++#endif + test_select_stdout (); + test_select_rfds_wfds (); ++#ifdef HAVE_SYS_TIMER_H + test_select_rfds (); ++#endif + launch (client1, server1); + launch (client2, server2); + launch (client3, server3); +diff -r ae3103c9ee50 -r 88ac4b927923 wscript +--- a/wscript Fri Apr 27 19:40:18 2012 +0900 ++++ b/wscript Fri May 11 17:03:08 2012 +0900 +@@ -34,6 +34,7 @@ + conf.check(header_name='sys/types.h', define_name='HAVE_SYS_TYPES_H', mandatory=False) + conf.check(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H', mandatory=False) + conf.check(header_name='dirent.h', define_name='HAVE_DIRENT_H', mandatory=False) ++ conf.check(header_name='sys/timerfd.h', define_name='HAVE_SYS_TIMER_H', mandatory=False) + + conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed') + conf.env.append_value('LINKFLAGS', '-pthread') +@@ -88,7 +89,8 @@ + + if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack): + conf.check(header_name='sim.h', +- includes=os.path.join(Options.options.kernel_stack, 'sim/include')) ++ includes=[os.path.join(Options.options.kernel_stack, 'sim/include'), ++ os.path.join(Options.options.kernel_stack, 'net-next-2.6/include')]) + # conf.check() + conf.env['KERNEL_STACK'] = Options.options.kernel_stack + +@@ -161,7 +163,6 @@ + ['test-netdb', []], + ['test-env', []], + ['test-cond', ['PTHREAD']], +- ['test-timer-fd', []], + ['test-stdlib', []], + ['test-select', ['PTHREAD']], + ['test-random', []], +@@ -181,6 +182,10 @@ + ['test-socket', []], + ['test-bug-multi-select', []], + ] ++ ++ if module._bld.env['HAVE_SYS_TIMER_H']: ++ tests = tests + ['test-timer-fd', []], ++ + for name,uselib in tests: + module.add_test(**dce_kw(target='bin_dce/' + name, source = ['test/' + name + '.cc'], + use = uselib + ['lib/test'])) +@@ -188,7 +193,6 @@ + def build_dce_examples(module): + dce_examples = [['udp-server', []], + ['udp-client', []], +- ['udp-perf', ['m']], + ['tcp-server', []], + ['tcp-client', []], + ['tcp-loopback', []], +@@ -198,6 +202,9 @@ + ['udp-echo-client', []], + # ['little-cout', []], + ] ++ if module._bld.env['HAVE_SYS_TIMER_H']: ++ dce_examples = dce_examples + ['udp-perf', ['m']], ++ + for name,lib in dce_examples: + module.add_example(**dce_kw(target = 'bin_dce/' + name, + source = ['example/' + name + '.cc'], +@@ -350,7 +357,6 @@ + 'model/dce-string.cc', + 'model/dce-env.cc', + 'model/dce-pthread-cond.cc', +- 'model/dce-timerfd.cc', + 'model/dce-time.cc', + 'model/dce-stat.cc', + 'model/dce-syslog.cc', +@@ -411,6 +417,10 @@ + 'helper/ccn-client-helper.h', + 'helper/ipv4-dce-routing-helper.h', + ] ++ ++ if bld.env['HAVE_SYS_TIMER_H']: ++ module_source = module+source + 'model/dce-timerfd.cc', ++ + module_source = module_source + kernel_source + module_headers = module_headers + kernel_headers + uselib = ns3waf.modules_uselib(bld, ['core', 'network', 'internet', 'netlink']) diff -r f86f5b19833f -r 5ca51e147e7f series --- a/series Wed Apr 11 12:41:12 2012 +0900 +++ b/series Fri May 11 17:03:32 2012 +0900 @@ -1,5 +1,8 @@ 120406-dce-quagga-support.patch 120410-dce-umip-support.patch +dns_unbound.patch +dns_bind9.patch +fedora8-nontimerfd-etc.patch dlm-loader-fix.patch floating_groupd.patch mpitest.patch