--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/120410-linux-umip-support.patch Tue Apr 10 17:14:31 2012 +0900
@@ -0,0 +1,465 @@
+support umip(mip6d) with ns-3-linux for NEMO/MIP6
+
+diff -r e503e546d382 model/dce-fd.cc
+--- a/model/dce-fd.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-fd.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -367,11 +367,30 @@
+ }
+
+ UnixFd *socket = factory->CreateSocket (domain, type, protocol);
++ if (!socket)
++ return -1;
+ socket->IncFdCount ();
+ current->process->openFiles[fd] = new FileUsage (fd, socket);
+
+ return fd;
+ }
++int dce_socketpair (int domain, int type, int protocol, int sv[2])
++{
++ sv[0] = dce_socket (domain, type, protocol);
++ if (sv[0] < 0)
++ {
++ return -1;
++ }
++
++ sv[1] = dce_socket (domain, type, protocol);
++ if (sv[1] < 0)
++ {
++ return -1;
++ }
++
++ return 0;
++}
++
+ int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
+ {
+ Thread *current = Current ();
+diff -r e503e546d382 model/dce-manager.cc
+--- a/model/dce-manager.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-manager.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -1096,6 +1096,22 @@
+ libpthread_setup = (void (*)(const struct Libc *))(symbol);
+ libpthread_setup (libc);
+
++ h = ld->Load ("librt-ns3.so", RTLD_GLOBAL);
++ if (h == 0)
++ {
++ err = ENOMEM;
++ return 0;
++ }
++ symbol = ld->Lookup (h, "librt_setup");
++ if (symbol == 0)
++ {
++ NS_FATAL_ERROR ("This is not our fake librt !");
++ }
++ // construct librt now
++ void (*librt_setup)(const struct Libc *fn);
++ librt_setup = (void (*)(const struct Libc *))(symbol);
++ librt_setup (libc);
++
+ // finally, call into 'main'.
+ h = ld->Load (filename, RTLD_GLOBAL);
+
+diff -r e503e546d382 model/dce-poll.cc
+--- a/model/dce-poll.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-poll.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -180,7 +180,12 @@
+ }
+ }
+ nfds = eventByFd.size ();
+- if (nfds == 0)
++
++ // select(2):
++ // Some code calls select() with all three sets empty, nfds zero, and a
++ // non-NULL timeout as a fairly portable way to sleep with subsecond
++ // precision.
++ if (nfds == 0 && !timeout)
+ {
+ current->err = EINVAL;
+ return -1;
+diff -r e503e546d382 model/dce-signal.cc
+--- a/model/dce-signal.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-signal.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -3,6 +3,7 @@
+ #include "process.h"
+ #include "ns3/log.h"
+ #include "ns3/assert.h"
++#include "waiter.h"
+ #include <vector>
+ #include <errno.h>
+
+@@ -98,6 +99,18 @@
+
+ return 0;
+ }
++
++int dce_sigwait (const sigset_t *set, int *sig)
++{
++ int ret = 0;
++ // current->process->signalHandlers.push_back (handler);
++
++ Waiter waiter;
++ waiter.SetTimeout (Seconds (0.0));
++ waiter.WaitDoSignal ();
++
++ return ret;
++}
+ int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
+ {
+ Thread *current = Current ();
+diff -r e503e546d382 model/dce-signal.h
+--- a/model/dce-signal.h Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-signal.h Tue Apr 10 14:47:37 2012 +0900
+@@ -17,6 +17,7 @@
+ int dce_pthread_kill (pthread_t thread, int sig);
+ void dce_abort ();
+ int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
++int dce_sigwait (const sigset_t *set, int *sig);
+
+ #ifdef __cplusplus
+ }
+diff -r e503e546d382 model/dce-time.cc
+--- a/model/dce-time.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-time.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -54,3 +54,12 @@
+
+ return asctime_r (tm, Current ()->process->asctime_result);
+ }
++
++int dce_clock_gettime(clockid_t which_clock, struct timespec *tp)
++{
++ NS_LOG_FUNCTION (Current () << UtilsGetNodeId ());
++ NS_ASSERT (Current () != 0);
++ NS_ASSERT (tp != 0);
++ *tp = UtilsTimeToTimespec (UtilsSimulationTimeToTime (Now ()));
++ return 0;
++}
+diff -r e503e546d382 model/dce-time.h
+--- a/model/dce-time.h Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce-time.h Tue Apr 10 14:47:37 2012 +0900
+@@ -3,6 +3,7 @@
+
+ #include "sys/dce-time.h"
+ #include <time.h>
++#include <sys/sysinfo.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+@@ -13,6 +14,8 @@
+ struct tm *dce_localtime(const time_t *timep);
+ char *dce_ctime(const time_t *timep);
+ char *dce_asctime(const struct tm *tm);
++int dce_clock_gettime(clockid_t which_clock, struct timespec *tp);
++int dce_sysinfo (struct sysinfo *info);
+
+ #ifdef __cplusplus
+ }
+diff -r e503e546d382 model/dce.cc
+--- a/model/dce.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/dce.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -22,6 +22,8 @@
+ #include <getopt.h>
+ #include <limits.h>
+ #include <fcntl.h>
++#include <net/if.h>
++#include <sys/ioctl.h>
+ #include "dce-random.h"
+ #include "net/dce-if.h"
+ #include "ns3/node.h"
+@@ -639,6 +641,43 @@
+ }
+ unsigned dce_if_nametoindex (const char *ifname)
+ {
++ struct ifreq ifr;
++ int fd = dce_socket (AF_INET, SOCK_DGRAM, 0);
++ if (fd < 0)
++ {
++ return 0;
++ }
++
++ strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
++ if (dce_ioctl (fd, SIOCGIFINDEX, (char *)&ifr) < 0)
++ {
++ // int saved_errno = errno;
++ // close_not_cancel_no_status (fd);
++ // if (saved_errno == EINVAL)
++ // __set_errno (ENOSYS);
++ return 0;
++ }
++ return ifr.ifr_ifindex;
++}
++char *dce_if_indextoname (unsigned ifindex, char *ifname)
++{
++ struct ifreq ifr;
++ int fd = dce_socket (AF_INET, SOCK_DGRAM, 0);
++ if (fd < 0)
++ {
++ return 0;
++ }
++
++ ifr.ifr_ifindex = ifindex;
++ if (dce_ioctl (fd, SIOCGIFNAME, (char *)&ifr) < 0)
++ {
++ return 0;
++ }
++ return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
++}
++#if 0
++unsigned dce_if_nametoindex (const char *ifname)
++{
+ int index = 0;
+ Ptr<Node> node = Current ()->process->manager->GetObject<Node> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
+@@ -654,6 +693,7 @@
+ }
+ return 0;
+ }
++#endif
+ pid_t dce_fork (void)
+ {
+ Thread *thread = Current ();
+@@ -849,6 +889,21 @@
+ static char loc[] = "";
+ return loc;
+ }
++int dce_sysinfo (struct sysinfo *info)
++{
++ Thread *current = Current ();
++ NS_LOG_FUNCTION (current << UtilsGetNodeId ());
++ NS_ASSERT (current != 0);
++ if (!info)
++ {
++ current->err = ENAMETOOLONG;
++ return -1;
++ }
++
++ info->uptime = (long)UtilsSimulationTimeToTime (Now ()).GetSeconds ();
++ // XXX
++ return 0;
++}
+ #ifdef HAVE_GETCPUFEATURES
+ extern "C"
+ {
+diff -r e503e546d382 model/elf-cache.cc
+--- a/model/elf-cache.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/elf-cache.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -26,6 +26,9 @@
+ overriden.from = "libpthread.so.0";
+ overriden.to = "libpthread-ns3.so";
+ m_overriden.push_back (overriden);
++ overriden.from = "librt.so.1";
++ overriden.to = "librt-ns3.so";
++ m_overriden.push_back (overriden);
+ }
+
+ std::string
+diff -r e503e546d382 model/libc-dce.cc
+--- a/model/libc-dce.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/libc-dce.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -52,6 +52,7 @@
+ #include <netdb.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
++#include <netinet/ether.h>
+ #include <poll.h>
+ #include <semaphore.h>
+ #include <signal.h>
+diff -r e503e546d382 model/libc-ns3.h
+--- a/model/libc-ns3.h Mon Apr 09 10:03:33 2012 +0900
++++ b/model/libc-ns3.h Tue Apr 10 14:47:37 2012 +0900
+@@ -73,6 +73,7 @@
+ NATIVE (ntohl)
+ NATIVE (ntohs)
+ DCE (socket)
++DCE (socketpair)
+ DCE (getsockname)
+ DCE (getpeername)
+ DCE (bind)
+@@ -214,6 +215,7 @@
+ DCE (setregid)
+ DCE (setresuid)
+ DCE (setresgid)
++NATIVE (lockf)
+ NATIVE (inet_aton)
+ NATIVE (inet_ntoa)
+ DCE (inet_ntop)
+@@ -223,6 +225,8 @@
+ NATIVE (inet_lnaof)
+ NATIVE (inet_netof)
+ NATIVE (inet_addr)
++NATIVE (inet6_opt_find)
++NATIVE (ether_aton)
+ DCE (mmap)
+ DCE (mmap64)
+ DCE (munmap)
+@@ -254,6 +258,7 @@
+ DCE (realloc)
+ DCE (gettimeofday)
+ DCE (time)
++DCE (sysinfo)
+ DCE (isatty)
+ DCE (send)
+ DCE (sendto)
+@@ -279,6 +284,7 @@
+ NATIVE (sigaddset)
+ NATIVE (sigdelset)
+ NATIVE (sigismember)
++DCE (sigwait)
+ DCE_WITH_ALIAS2(strtol, __strtol_internal)
+ DCET (long long int, strtoll)
+ DCE (strtoul)
+@@ -343,6 +349,13 @@
+ DCE (pthread_cond_wait)
+ DCE (pthread_condattr_destroy)
+ DCE (pthread_condattr_init)
++NATIVE (pthread_rwlock_init)
++NATIVE (pthread_rwlock_unlock)
++NATIVE (pthread_rwlock_wrlock)
++NATIVE (pthread_rwlock_rdlock)
++NATIVE (pthread_rwlock_destroy)
++NATIVE (pthread_setcancelstate)
++NATIVE (pthread_sigmask)
+
+ // netdb.h
+ DCE (gethostbyname)
+@@ -381,6 +394,7 @@
+ DCE (timerfd_gettime)
+
+ DCE (if_nametoindex)
++DCE (if_indextoname)
+ DCE (fork)
+
+ NATIVE (qsort)
+@@ -442,8 +456,8 @@
+ NATIVE (pathconf)
+
+ // this is wrong. clock should be changed to DCE implementation
+-//DCE (__vdso_clock_gettime)
+-NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
++DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
++//NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
+
+ // setjmp.h
+ NATIVE (__sigsetjmp)
+diff -r e503e546d382 model/librt-ns3.version
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ b/model/librt-ns3.version Tue Apr 10 14:47:37 2012 +0900
+@@ -0,0 +1,4 @@
++NS3 {
++global:
++ librt_setup;
++};
+diff -r e503e546d382 model/linux-socket-fd-factory.cc
+--- a/model/linux-socket-fd-factory.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/linux-socket-fd-factory.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -537,6 +537,8 @@
+ this));
+ Set (".net.ipv4.conf.all.forwarding", "1");
+ Set (".net.ipv4.conf.all.log_martians", "1");
++ Set (".net.ipv6.conf.all.forwarding", "1");
++ Set (".net.ipv6.conf.all.proxy_ndp", "1");
+
+ while (!m_earlySysfs.empty ())
+ {
+diff -r e503e546d382 model/linux-socket-fd.cc
+--- a/model/linux-socket-fd.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/linux-socket-fd.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -177,6 +177,7 @@
+ return 0;
+ break;
+ default:
++ return 0;
+ //XXX commands missing
+ NS_FATAL_ERROR ("fcntl not implemented on socket");
+ return -1;
+diff -r e503e546d382 model/net/dce-if.h
+--- a/model/net/dce-if.h Mon Apr 09 10:03:33 2012 +0900
++++ b/model/net/dce-if.h Tue Apr 10 14:47:37 2012 +0900
+@@ -7,6 +7,7 @@
+ #endif
+
+ unsigned dce_if_nametoindex (const char *ifname);
++char *dce_if_indextoname (unsigned ifindex, char *ifname);
+
+
+ #ifdef __cplusplus
+diff -r e503e546d382 model/ns3-socket-fd-factory.cc
+--- a/model/ns3-socket-fd-factory.cc Mon Apr 09 10:03:33 2012 +0900
++++ b/model/ns3-socket-fd-factory.cc Tue Apr 10 14:47:37 2012 +0900
+@@ -142,7 +142,8 @@
+ }
+ else
+ {
+- NS_FATAL_ERROR ("unsupported domain");
++ // NS_FATAL_ERROR ("unsupported domain");
++ return 0;
+ }
+
+ return socket;
+diff -r e503e546d382 model/sys/dce-socket.h
+--- a/model/sys/dce-socket.h Mon Apr 09 10:03:33 2012 +0900
++++ b/model/sys/dce-socket.h Tue Apr 10 14:47:37 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);
+ int dce_getpeername(int s, struct sockaddr *name, socklen_t *namelen);
++int dce_socketpair (int domain, int type, int protocol, int sv[2]);
+
+ #ifdef __cplusplus
+ }
+diff -r e503e546d382 wscript
+--- a/wscript Mon Apr 09 10:03:33 2012 +0900
++++ b/wscript Tue Apr 10 14:47:37 2012 +0900
+@@ -26,7 +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)
+ ns3waf.check_modules(conf, ['point-to-point-layout'], mandatory = False)
+- ns3waf.check_modules(conf, ['topology-read', 'applications'], mandatory = False)
++ ns3waf.check_modules(conf, ['topology-read', 'applications', 'visualizer'], mandatory = False)
+ conf.check_tool('compiler_cc')
+ conf.check(header_name='stdint.h', define_name='HAVE_STDINT_H', mandatory=False)
+ conf.check(header_name='inttypes.h', define_name='HAVE_INTTYPES_H', mandatory=False)
+@@ -71,6 +71,17 @@
+ conf.end_msg(libpthread, True)
+ conf.env['LIBPTHREAD_FILE'] = libpthread
+
++ conf.start_msg('Searching rt library')
++ librt = search_file ([
++ '/lib64/librt.so.1',
++ '/lib/librt.so.1',
++ ])
++ if librt is None:
++ conf.fatal('not found')
++ else:
++ conf.end_msg(librt, True)
++ conf.env['LIBRT_FILE'] = librt
++
+ conf.find_program('readversiondef', var='READVERSIONDEF', mandatory=True)
+
+ if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack):
+@@ -426,6 +437,11 @@
+ rule='%s %s | cat ${SRC[0].abspath()} - > ${TGT}' %
+ (bld.env['READVERSIONDEF'], bld.env['LIBPTHREAD_FILE']))
+
++ bld(source=['model/librt-ns3.version'],
++ target='model/librt.version',
++ rule='%s %s | cat ${SRC[0].abspath()} - > ${TGT}' %
++ (bld.env['READVERSIONDEF'], bld.env['LIBRT_FILE']))
++
+ bld.add_group('dce_use_version_files')
+
+ # The very small libc used to replace the glibc
+@@ -445,3 +461,13 @@
+ linkflags=['-nostdlib', '-lc',
+ '-Wl,--version-script=' + os.path.join('model', 'libpthread.version'),
+ '-Wl,-soname=libpthread.so.0'])
++
++ # The very small librt used to replace the glibc
++ # and forward to the dce_* code
++ bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
++ target='lib/rt-ns3', cflags=['-g'],
++ defines=['LIBSETUP=librt_setup'],
++ linkflags=['-nostdlib', '-lc',
++ '-Wl,--version-script=' + os.path.join('model', 'librt.version'),
++ '-Wl,-soname=librt.so.1'])
++
--- a/series Mon Apr 09 10:03:45 2012 +0900
+++ b/series Tue Apr 10 17:14:31 2012 +0900
@@ -1,6 +1,5 @@
120406-dce-quagga-support.patch
-umip_mip6d_support.patch
-umip_dsmip6_support.patch
+120410-linux-umip-support.patch
dlm-loader-fix.patch
floating_groupd.patch
mpitest.patch
--- a/umip_dsmip6_support.patch Mon Apr 09 10:03:45 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,981 +0,0 @@
-diff -r c2cbaa3a4b46 example/dce-dsmip6d-tap-ha.cc
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/dce-dsmip6d-tap-ha.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -0,0 +1,164 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+
-+//
-+// NEMO (Network Mobility) simulation with umip (mip6d) and net-next-2.6.
-+//
-+// UMIP: http://www.umip.org/git/umip.git
-+// patchset: 0daa3924177f326e26ed8bbb9dc9f0cdf8a51618
-+// build: CFLAGS="-fPIC -g" CXXFLAGS="-fPIC -g" LDFLAGS="-pie -g" ./configure --enable-vt --with-cflags="-DRT_DEBUG_LEVEL=1" --with-builtin-crypto
-+//
-+// Simulation Topology:
-+// Scenario: MR and MNN moves from under AR1 to AR2 with Care-of-Address
-+// alternation. during movement, MNN keeps ping6 to CN.
-+//
-+// +-----------+
-+// | HA |
-+// +-----------+
-+// |sim0
-+// +----+------+
-+// |tap(bridge)| In Simulator
-+// +-----------+
-+// |
-+// ------------------------- |exttap ---------------------------
-+// +----+------+
-+// | host | Real World
-+// +-----------+
-+// |
-+// The Internet
-+
-+#include "ns3/dce-module.h"
-+#include "ns3/helper-module.h"
-+#include "ns3/simulator-module.h"
-+#include "ns3/core-module.h"
-+#include "ns3/mobility-module.h"
-+#include <fstream>
-+#include "ns3/visualizer.h"
-+
-+
-+using namespace ns3;
-+
-+static void RunIp (Ptr<Node> node, Time at, std::string str)
-+{
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ process.SetBinary ("build/debug/ip");
-+ process.SetStackSize (1<<16);
-+ process.ResetArguments();
-+ process.ParseArguments(str.c_str ());
-+ apps = process.Install (node);
-+ apps.Start (at);
-+}
-+
-+static void AddAddress (Ptr<Node> node, Time at, const char *name, const char *address)
-+{
-+ std::ostringstream oss;
-+ oss << "-f inet6 addr add " << address << " dev " << name;
-+ RunIp (node, at, oss.str ());
-+}
-+
-+bool useViz = false;
-+bool useTap = true;
-+
-+int main (int argc, char *argv[])
-+{
-+ CommandLine cmd;
-+ cmd.AddValue ("useViz", "visualization", useViz);
-+ cmd.Parse (argc, argv);
-+
-+ if (useTap)
-+ {
-+ GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
-+ DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->SetAttribute
-+ ("SynchronizationMode", EnumValue (RealtimeSimulatorImpl::SYNC_BEST_EFFORT));
-+ }
-+
-+ NodeContainer ha, tapHost;
-+ ha.Create (1);
-+ tapHost.Create (1);
-+ NodeContainer cn;
-+ cn.Create (1);
-+
-+ CsmaHelper csma;
-+ NetDeviceContainer tapDevs = csma.Install (NodeContainer (tapHost.Get (0), ha));
-+
-+ NetDeviceContainer cn_devices;
-+ // = csma.Install (NodeContainer (ar.Get (0), cn.Get (0)));
-+
-+ csma.EnablePcapAll ("dsmip6d-tap-ha");
-+
-+ DceManagerHelper processManager;
-+ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
-+ "Library", StringValue ("libnet-next-2.6.so"));
-+ processManager.Install (ha);
-+
-+ // Prefix configuration
-+ std::string ha_sim0 ("2001:200:0:8801::3939/64");
-+
-+ // For HA
-+ AddAddress (ha.Get (0), Seconds (0.1), "sim0", ha_sim0.c_str ());
-+ RunIp (ha.Get (0), Seconds (0.11), "link set lo up");
-+ RunIp (ha.Get (0), Seconds (0.11), "link set sim0 up");
-+ RunIp (ha.Get (0), Seconds (3.0), "link set ip6tnl0 up");
-+ RunIp (ha.Get (0), Seconds (3.1), "addr list");
-+ RunIp (ha.Get (0), Seconds (3.2), "-6 route add default via fe80::212:e2ff:fe28:130e dev sim0");
-+ RunIp (ha.Get (0), Seconds (4.13), "-4 addr add 192.168.10.1/24 dev sim0");
-+ RunIp (ha.Get (0), Seconds (4.15), "-4 route add default via 192.168.10.2 dev sim0");
-+
-+ RunIp (ha.Get (0), Seconds (4.0), "addr list");
-+ RunIp (ha.Get (0), Seconds (20.0), "route show table all");
-+
-+ {
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ QuaggaHelper quagga;
-+ Mip6dHelper mip6d;
-+
-+ // HA
-+ mip6d.AddHaServedPrefix (ha.Get (0), Ipv6Address ("2001:1:2::"), Ipv6Prefix (48));
-+ mip6d.EnableHA (ha);
-+ mip6d.EnableDebug (ha);
-+ mip6d.Install (ha);
-+
-+ }
-+
-+ // CN
-+ if (0)
-+ {
-+ // Ping6
-+ /* Install IPv4/IPv6 stack */
-+ InternetStackHelper internetv6;
-+ internetv6.SetIpv4StackInstall (false);
-+ internetv6.Install (cn);
-+
-+ Ipv6AddressHelper ipv6;
-+ ipv6.NewNetwork (Ipv6Address ("2001:1:2:6::"), 64);
-+ Ipv6InterfaceContainer i2 = ipv6.Assign (cn_devices.Get (1));
-+
-+ Ptr<Ipv6StaticRouting> routing = 0;
-+ Ipv6StaticRoutingHelper routingHelper;
-+ routing = routingHelper.GetStaticRouting (cn.Get (0)->GetObject<Ipv6> ());
-+ routing->SetDefaultRoute (Ipv6Address ("2001:1:2:6::2"), 1, Ipv6Address ("::"), 0);
-+ }
-+
-+ // TAP Host
-+ if (useTap)
-+ {
-+ TapBridgeHelper tapBridge (Ipv4Address ("0.0.0.1"));
-+ tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));
-+ tapBridge.SetAttribute ("DeviceName", StringValue ("exttap"));
-+ tapBridge.Install (tapHost.Get(0), tapDevs.Get (0));
-+ }
-+
-+ if (useViz)
-+ {
-+ Visualizer::Run ();
-+ }
-+ else
-+ {
-+ Simulator::Stop (Seconds (600.0));
-+ Simulator::Run ();
-+ }
-+ Simulator::Destroy ();
-+
-+ return 0;
-+}
-diff -r c2cbaa3a4b46 example/dce-dsmip6d-tap-mr.cc
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/dce-dsmip6d-tap-mr.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -0,0 +1,219 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+
-+//
-+// NEMO (Network Mobility) simulation with umip (mip6d) and net-next-2.6.
-+//
-+// UMIP: http://www.umip.org/git/umip.git
-+// patchset: 0daa3924177f326e26ed8bbb9dc9f0cdf8a51618
-+// build: CFLAGS="-fPIC -g" CXXFLAGS="-fPIC -g" LDFLAGS="-pie -g" ./configure --enable-vt --with-cflags="-DRT_DEBUG_LEVEL=1" --with-builtin-crypto
-+//
-+// Simulation Topology:
-+// Scenario: MR and MNN moves from under AR1 to AR2 with Care-of-Address
-+// alternation. during movement, MNN keeps ping6 to CN.
-+//
-+// The Internet
-+// |
-+// +----+------+
-+// | host | Real World
-+// +-----------+
-+// ------------------------- |exttap ---------------------------
-+// +----+------+
-+// |tap(bridge)| In Simulator
-+// +-----------+
-+// |
-+// (IPv4 only)
-+// sim0
-+// +----+------+
-+// | MR |
-+// +-----------+
-+// |sim1
-+// +---------+
-+// | MNN |
-+// +---------+
-+
-+#include "ns3/dce-module.h"
-+#include "ns3/helper-module.h"
-+#include "ns3/simulator-module.h"
-+#include "ns3/core-module.h"
-+#include "ns3/mobility-module.h"
-+#include <fstream>
-+#include "ns3/visualizer.h"
-+
-+
-+using namespace ns3;
-+
-+
-+static void RunIp (Ptr<Node> node, Time at, std::string str)
-+{
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ process.SetBinary ("build/debug/ip");
-+ process.SetStackSize (1<<16);
-+ process.ResetArguments();
-+ process.ParseArguments(str.c_str ());
-+ apps = process.Install (node);
-+ apps.Start (at);
-+}
-+
-+static void AddAddress (Ptr<Node> node, Time at, const char *name, const char *address)
-+{
-+ std::ostringstream oss;
-+ oss << "-f inet6 addr add " << address << " dev " << name;
-+ RunIp (node, at, oss.str ());
-+}
-+
-+static void
-+CourseChangeCallback (std::string path, Ptr<const MobilityModel> model)
-+{
-+ Vector position = model->GetPosition ();
-+ // std::cout << "CourseChange " << path << " x=" << position.x << ", y=" << position.y << ", z=" << position.z << std::endl;
-+}
-+
-+bool useViz = false;
-+bool useTap = true;
-+
-+int main (int argc, char *argv[])
-+{
-+ CommandLine cmd;
-+ cmd.AddValue ("useViz", "visualization", useViz);
-+ cmd.Parse (argc, argv);
-+
-+ if (useTap)
-+ {
-+ GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
-+ DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->SetAttribute
-+ ("SynchronizationMode", EnumValue (RealtimeSimulatorImpl::SYNC_BEST_EFFORT));
-+ }
-+
-+ NodeContainer mr, tapHost;
-+ mr.Create (1);
-+ tapHost.Create (1);
-+ NodeContainer mnn;
-+ mnn.Create (1);
-+
-+ MobilityHelper mobility;
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (mr);
-+
-+ mobility.PushReferenceMobilityModel (mr.Get (0));
-+ Ptr<MobilityModel> parentMobility = mr.Get (0)->GetObject<MobilityModel> ();
-+ Vector pos = parentMobility->GetPosition ();
-+ Ptr<ListPositionAllocator> positionAllocMnn =
-+ CreateObject<ListPositionAllocator> ();
-+ pos.x = 5;
-+ pos.y = 20;
-+ positionAllocMnn->Add (pos);
-+ mobility.SetPositionAllocator (positionAllocMnn);
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (mnn);
-+
-+ WifiHelper wifi = WifiHelper::Default ();
-+ YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
-+ YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
-+ NqosWifiMacHelper mac;
-+ CsmaHelper csma;
-+ phy.SetChannel (phyChannel.Create ());
-+ mac.SetType ("ns3::AdhocWifiMac");
-+ wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
-+
-+ NetDeviceContainer tapDevs = csma.Install (NodeContainer (tapHost.Get (0), mr));
-+
-+ phy.SetChannel (phyChannel.Create ());
-+ NetDeviceContainer mnp_devices = wifi.Install (phy, mac, NodeContainer (mr.Get (0), mnn.Get (0)));
-+
-+ phy.EnablePcapAll ("dsmip6d-tap-mr");
-+ csma.EnablePcapAll ("dsmip6d-tap-mr");
-+
-+ DceManagerHelper processManager;
-+ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
-+ "Library", StringValue ("libnet-next-2.6.so"));
-+ processManager.Install (mr);
-+
-+ // Prefix configuration
-+ std::ostringstream oss;
-+ std::string mnp1 = "2001:1:2:5::1";
-+ std::string ha_addr = "2001:200:0:8801::3939";
-+ std::string mr_hoa = "2001:200:0:8801::3901";
-+
-+ // For MR
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ QuaggaHelper quagga;
-+ Mip6dHelper mip6d;
-+ for (uint32_t i = 0; i< mr.GetN (); i++)
-+ {
-+ RunIp (mr.Get (i), Seconds (0.11), "link set sim0 up");
-+ RunIp (mr.Get (i), Seconds (3.0), "link set ip6tnl0 up");
-+ oss << mnp1 << "/64";
-+ AddAddress (mr.Get (i), Seconds (0.12), "sim1", oss.str ().c_str ());
-+ RunIp (mr.Get (i), Seconds (0.13), "link set sim1 up");
-+
-+ RunIp (mr.Get (i), Seconds (4.2), "addr list");
-+ RunIp (mr.Get (i), Seconds (20.0), "route show table all");
-+
-+ mip6d.AddMobileNetworkPrefix (mr.Get (i), Ipv6Address (mnp1.c_str()), Ipv6Prefix (64));
-+ mip6d.AddHomeAgentAddress (mr.Get (i), Ipv6Address (ha_addr.c_str ()));
-+ mip6d.AddHomeAddress (mr.Get (i), Ipv6Address (mr_hoa.c_str ()), Ipv6Prefix (64));
-+ mip6d.AddEgressInterface (mr.Get (i), "sim0");
-+ }
-+ mip6d.EnableMR (mr);
-+ mip6d.Install (mr);
-+
-+ quagga.EnableRadvd (mr.Get (0), "sim1");
-+ quagga.EnableZebraDebug (mr);
-+ quagga.Install (mr);
-+
-+
-+ // TAP Host
-+ if (useTap)
-+ {
-+ TapBridgeHelper tapBridge (Ipv4Address ("0.0.0.1"));
-+ tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));
-+ tapBridge.SetAttribute ("DeviceName", StringValue ("exttap"));
-+ tapBridge.Install (tapHost.Get(0), tapDevs.Get (0));
-+ }
-+
-+ // MNN
-+ if (1)
-+ {
-+ LogComponentEnable ("Ping6Application", LOG_LEVEL_INFO);
-+ // Ping6
-+ /* Install IPv4/IPv6 stack */
-+ InternetStackHelper internetv6;
-+ internetv6.SetIpv4StackInstall (false);
-+ internetv6.Install (mnn);
-+
-+ Ipv6AddressHelper ipv6;
-+ Ipv6InterfaceContainer i1 = ipv6.AssignWithoutAddress (mnp_devices.Get (1));
-+
-+ uint32_t packetSize = 1024;
-+ uint32_t maxPacketCount = 50000000;
-+ Time interPacketInterval = Seconds (1.);
-+ Ping6Helper ping6;
-+
-+ ping6.SetLocal (Ipv6Address::GetAny ());
-+ ping6.SetRemote (Ipv6Address ("2001:1:2:6::1"));
-+
-+ ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
-+ ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));
-+ ping6.SetAttribute ("PacketSize", UintegerValue (packetSize));
-+ ApplicationContainer apps = ping6.Install (mnn.Get (0));
-+ apps.Start (Seconds (2.0));
-+ // apps.Stop (Seconds (100.0));
-+ }
-+
-+ Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange", MakeCallback (&CourseChangeCallback));
-+
-+ if (useViz)
-+ {
-+ Visualizer::Run ();
-+ }
-+ else
-+ {
-+ Simulator::Stop (Seconds (600.0));
-+ Simulator::Run ();
-+ }
-+ Simulator::Destroy ();
-+
-+ return 0;
-+}
-diff -r c2cbaa3a4b46 example/dce-dsmip6d.cc
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/dce-dsmip6d.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -0,0 +1,309 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+
-+//
-+// NEMO (Network Mobility) simulation with umip (mip6d) and net-next-2.6.
-+//
-+// UMIP: http://www.umip.org/git/umip.git
-+// patchset: 0daa3924177f326e26ed8bbb9dc9f0cdf8a51618
-+// build: CFLAGS="-fPIC -g" CXXFLAGS="-fPIC -g" LDFLAGS="-pie -g" ./configure --enable-vt --with-cflags="-DRT_DEBUG_LEVEL=1" --with-builtin-crypto
-+//
-+// Simulation Topology:
-+// Scenario: MR and MNN moves from under AR1 to AR2 with Care-of-Address
-+// alternation. during movement, MNN keeps ping6 to CN.
-+//
-+// +-----------+
-+// | HA |
-+// +-----------+
-+// |sim0
-+// +----------+------------+
-+// |sim0 |sim0
-+// +--------+ sim2+----+---+ +----+---+
-+// | CN | - - - -| AR1 | | AR2 |
-+// +--------+ +---+----+ +----+---+
-+// |sim1 |sim1
-+// | |
-+// (IPv4 only) (IPv4/IPv6)
-+// sim0 sim0
-+// +----+------+ (Movement) +----+-----+
-+// | MR | <=====> | MR |
-+// +-----------+ +----------+
-+// |sim1 |sim1
-+// +---------+ +---------+
-+// | MNN | | MNN |
-+// +---------+ +---------+
-+
-+#include "ns3/network-module.h"
-+#include "ns3/core-module.h"
-+#include "ns3/internet-module.h"
-+#include "ns3/dce-module.h"
-+#include "ns3/mip6d-helper.h"
-+#include "ns3/csma-helper.h"
-+#include "ns3/wifi-helper.h"
-+#include "ns3/yans-wifi-helper.h"
-+#include "ns3/nqos-wifi-mac-helper.h"
-+#include "ns3/mobility-module.h"
-+#include "ns3/ping6-helper.h"
-+
-+
-+using namespace ns3;
-+
-+static void RunIp (Ptr<Node> 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> node, Time at, const char *name, const char *address)
-+{
-+ std::ostringstream oss;
-+ oss << "-f inet6 addr add " << address << " dev " << name;
-+ RunIp (node, at, oss.str ());
-+}
-+
-+bool usePing = true;
-+int main (int argc, char *argv[])
-+{
-+ CommandLine cmd;
-+ cmd.AddValue ("usePing", "Using Ping6 or not", usePing);
-+ cmd.Parse (argc, argv);
-+
-+ NodeContainer mr, ha, ar;
-+ ha.Create (1);
-+ ar.Create (2);
-+ mr.Create (1);
-+ NodeContainer mnn, cn;
-+ cn.Create (1);
-+ mnn.Create (1);
-+
-+ NetDeviceContainer devices;
-+ MobilityHelper mobility;
-+ Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
-+ positionAlloc->Add (Vector (75.0, -50.0, 0.0)); // HA
-+ positionAlloc->Add (Vector (0.0, 10.0, 0.0)); // AR1
-+ positionAlloc->Add (Vector (150.0, 10.0, 0.0)); // AR2
-+ positionAlloc->Add (Vector (-50.0, 10.0, 0.0)); // CN
-+ mobility.SetPositionAllocator (positionAlloc);
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (ha);
-+ mobility.Install (ar);
-+ mobility.Install (cn);
-+
-+ Ptr<ns3::RandomDiscPositionAllocator> r_position =
-+ CreateObject<RandomDiscPositionAllocator> ();
-+ r_position->SetX (100);
-+ r_position->SetY (50);
-+ r_position->SetRho (UniformVariable (200, 0));
-+ mobility.SetPositionAllocator (r_position);
-+ mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
-+ "Bounds", RectangleValue (Rectangle (0, 200, 30, 60)),
-+ "Speed", RandomVariableValue (ConstantVariable (10)),
-+ "Pause", RandomVariableValue (ConstantVariable (0.2)));
-+ mobility.Install (mr);
-+
-+
-+ mobility.PushReferenceMobilityModel (mr.Get (0));
-+ Ptr<MobilityModel> parentMobility = mr.Get (0)->GetObject<MobilityModel> ();
-+ Vector pos = parentMobility->GetPosition ();
-+ Ptr<ListPositionAllocator> positionAllocMnn =
-+ CreateObject<ListPositionAllocator> ();
-+ pos.x = 5;
-+ pos.y = 20;
-+ positionAllocMnn->Add (pos);
-+ mobility.SetPositionAllocator (positionAllocMnn);
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (mnn);
-+
-+ WifiHelper wifi = WifiHelper::Default ();
-+ YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
-+ YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
-+ NqosWifiMacHelper mac;
-+ CsmaHelper csma;
-+ phy.SetChannel (phyChannel.Create ());
-+ mac.SetType ("ns3::AdhocWifiMac");
-+ wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
-+
-+ devices = csma.Install (NodeContainer (ar.Get (0), ha.Get (0), ar.Get (1)));
-+
-+ phy.SetChannel (phyChannel.Create ());
-+ devices = wifi.Install (phy, mac, NodeContainer (ar.Get (0), mr, ar.Get (1)));
-+
-+ phy.SetChannel (phyChannel.Create ());
-+ NetDeviceContainer mnp_devices = wifi.Install (phy, mac, NodeContainer (mr.Get (0), mnn.Get (0)));
-+
-+ NetDeviceContainer cn_devices = csma.Install (NodeContainer (ar.Get (0), cn.Get (0)));
-+
-+ DceManagerHelper processManager;
-+ // processManager.SetLoader ("ns3::DlmLoaderFactory");
-+ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
-+ "Library", StringValue ("libnet-next-2.6.so"));
-+ processManager.Install (mr);
-+ processManager.Install (ha);
-+ processManager.Install (ar);
-+
-+ // Prefix configuration
-+ std::string ha_sim0 ("2001:1:2:3::1/64");
-+ std::string mnp1 ("2001:1:2:5::1");
-+ std::string mnp2 ("2001:1:2:8::1");
-+
-+ std::vector <std::string> *mnps = new std::vector <std::string>;
-+ mnps->push_back (mnp1);
-+ mnps->push_back (mnp2);
-+
-+ // For HA
-+ AddAddress (ha.Get (0), Seconds (0.1), "sim0", ha_sim0.c_str ());
-+ RunIp (ha.Get (0), Seconds (0.11), "link set lo up");
-+ RunIp (ha.Get (0), Seconds (0.11), "link set sim0 up");
-+ RunIp (ha.Get (0), Seconds (3.0), "link set ip6tnl0 up");
-+ RunIp (ha.Get (0), Seconds (3.1), "addr list");
-+ // RunIp (ha.Get (0), Seconds (3.2), "-6 route add default via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:4::/64 via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:6::/64 via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:7::/64 via 2001:1:2:3::3 dev sim0");
-+ RunIp (ha.Get (0), Seconds (4.13), "-4 addr add 192.168.10.1/24 dev sim0");
-+ RunIp (ha.Get (0), Seconds (4.15), "-4 route add default via 192.168.10.2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (4.15), "-4 route add 192.168.2.0/24 via 192.168.10.3 dev sim0");
-+
-+ // For AR1 (the intermediate node)
-+ AddAddress (ar.Get (0), Seconds (0.1), "sim0", "2001:1:2:3::2/64");
-+ RunIp (ar.Get (0), Seconds (0.11), "link set lo up");
-+ RunIp (ar.Get (0), Seconds (0.11), "link set sim0 up");
-+ RunIp (ar.Get (0), Seconds (0.13), "-4 addr add 192.168.1.1/24 dev sim1");
-+ RunIp (ar.Get (0), Seconds (0.13), "link set sim1 up");
-+ AddAddress (ar.Get (0), Seconds (0.13), "sim2", "2001:1:2:6::2/64");
-+ RunIp (ar.Get (0), Seconds (0.14), "link set sim2 up");
-+ RunIp (ar.Get (0), Seconds (0.15), "-6 route add 2001:1:2::/48 via 2001:1:2:3::1 dev sim0");
-+ RunIp (ar.Get (0), Seconds (0.15), "route show table all");
-+ RunIp (ar.Get (0), Seconds (4.13), "-4 addr add 192.168.10.2/24 dev sim0");
-+
-+ // For AR2 (the intermediate node)
-+ AddAddress (ar.Get (1), Seconds (0.1), "sim0", "2001:1:2:3::3/64");
-+ RunIp (ar.Get (1), Seconds (0.11), "link set lo up");
-+ RunIp (ar.Get (1), Seconds (0.11), "link set sim0 up");
-+ AddAddress (ar.Get (1), Seconds (0.12), "sim1", "2001:1:2:7::2/64");
-+ RunIp (ar.Get (1), Seconds (0.13), "-4 addr add 192.168.2.1/24 dev sim1");
-+ RunIp (ar.Get (1), Seconds (0.13), "link set sim1 up");
-+ std::ostringstream oss;
-+ oss << "-6 route add " << mnp1 << "/64 via 2001:1:2:3::1 dev sim0";
-+ RunIp (ar.Get (1), Seconds (0.15), oss.str ());
-+ RunIp (ar.Get (1), Seconds (0.15), "route show table all");
-+ RunIp (ar.Get (1), Seconds (4.13), "-4 addr add 192.168.10.3/24 dev sim0");
-+
-+ // For MR
-+ for (uint32_t i = 0; i< mr.GetN (); i++)
-+ {
-+ RunIp (mr.Get (i), Seconds (0.11), "link set lo up");
-+ RunIp (mr.Get (i), Seconds (0.11), "link set sim0 up");
-+ RunIp (mr.Get (i), Seconds (3.0), "link set ip6tnl0 up");
-+ // RunIp (mr.Get (i), Seconds (3.1), "addr list");
-+ oss.str ("");
-+ oss << mnps->at (i) << "/64";
-+ AddAddress (mr.Get (i), Seconds (0.12), "sim1", oss.str ().c_str ());
-+ RunIp (mr.Get (i), Seconds (0.13), "link set sim1 up");
-+ }
-+
-+ RunIp (ha.Get (0), Seconds (4.0), "addr list");
-+ RunIp (ar.Get (0), Seconds (4.1), "addr list");
-+ RunIp (mr.Get (0), Seconds (4.2), "addr list");
-+ RunIp (ha.Get (0), Seconds (20.0), "route show table all");
-+ RunIp (mr.Get (0), Seconds (20.0), "route show table all");
-+
-+ {
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ QuaggaHelper quagga;
-+ Mip6dHelper mip6d;
-+
-+ // HA
-+ mip6d.AddHaServedPrefix (ha.Get (0), Ipv6Address ("2001:1:2::"), Ipv6Prefix (48));
-+ mip6d.EnableHA (ha);
-+ mip6d.EnableDSMIP6 (ha);
-+ mip6d.EnableDebug (ha);
-+ mip6d.Install (ha);
-+
-+ // MR
-+ for (uint32_t i = 0; i< mr.GetN (); i++)
-+ {
-+ mip6d.AddMobileNetworkPrefix (mr.Get (i), Ipv6Address (mnps->at (i).c_str()), Ipv6Prefix (64));
-+ std::string ha_addr = ha_sim0;
-+ ha_addr.replace (ha_addr.find ("/"), 3, "\0 ");
-+ mip6d.AddHomeAgentAddress (mr.Get (i), Ipv6Address (ha_addr.c_str ()));
-+ mip6d.AddHomeAddress (mr.Get (i), Ipv6Address ("2001:1:2:3::1000"), Ipv6Prefix (64));
-+ mip6d.AddEgressInterface (mr.Get (i), "sim0");
-+ }
-+ mip6d.EnableMR (mr);
-+ mip6d.EnableDSMIP6 (mr);
-+ mip6d.Install (mr);
-+
-+ quagga.EnableRadvd (mr.Get (0), "sim1", "2001:1:2:5::/64");
-+ quagga.EnableZebraDebug (mr);
-+ quagga.Install (mr);
-+
-+ // AR
-+ quagga.EnableRadvd (ar.Get (0), "sim0", "2001:1:2:3::/64");
-+ quagga.EnableHomeAgentFlag (ar.Get (0), "sim0");
-+ quagga.EnableRadvd (ar.Get (0), "sim2", "2001:1:2:6::/64");
-+ quagga.EnableRadvd (ar.Get (1), "sim1", "2001:1:2:7::/64");
-+ quagga.EnableZebraDebug (ar);
-+ quagga.Install (ar);
-+
-+ // udhcpd
-+ process.SetBinary ("udhcpd");
-+ process.SetStackSize (1<<16);
-+ process.ResetArguments();
-+ apps = process.Install (ar.Get (0));
-+ apps.Start (Seconds (1.0));
-+
-+ }
-+
-+ // MNN
-+ if (usePing)
-+ {
-+ LogComponentEnable ("Ping6Application", LOG_LEVEL_INFO);
-+ // Ping6
-+ /* Install IPv4/IPv6 stack */
-+ InternetStackHelper internetv6;
-+ internetv6.SetIpv4StackInstall (false);
-+ internetv6.Install (mnn);
-+ internetv6.Install (cn);
-+
-+ Ipv6AddressHelper ipv6;
-+ Ipv6InterfaceContainer i1 = ipv6.AssignWithoutAddress (mnp_devices.Get (1));
-+
-+ ipv6.NewNetwork (Ipv6Address ("2001:1:2:6::"), 64);
-+ Ipv6InterfaceContainer i2 = ipv6.Assign (cn_devices.Get (1));
-+
-+ Ptr<Ipv6StaticRouting> routing = 0;
-+ Ipv6StaticRoutingHelper routingHelper;
-+ routing = routingHelper.GetStaticRouting (cn.Get (0)->GetObject<Ipv6> ());
-+ routing->SetDefaultRoute (Ipv6Address ("2001:1:2:6::2"), 1, Ipv6Address ("::"), 0);
-+
-+ uint32_t packetSize = 1024;
-+ uint32_t maxPacketCount = 50000000;
-+ Time interPacketInterval = Seconds (1.);
-+ Ping6Helper ping6;
-+
-+ ping6.SetLocal (Ipv6Address::GetAny ());
-+ ping6.SetRemote (i2.GetAddress (0, 1));
-+
-+ ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
-+ ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));
-+ ping6.SetAttribute ("PacketSize", UintegerValue (packetSize));
-+ ApplicationContainer apps = ping6.Install (mnn.Get (0));
-+ apps.Start (Seconds (2.0));
-+ }
-+
-+ phy.EnablePcapAll ("dce-dsmip6d");
-+ csma.EnablePcapAll ("dce-dsmip6d");
-+
-+ Simulator::Stop (Seconds (600.0));
-+ Simulator::Run ();
-+ Simulator::Destroy ();
-+
-+ return 0;
-+}
-diff -r c2cbaa3a4b46 helper/mip6d-helper.cc
---- a/helper/mip6d-helper.cc Mon Dec 05 14:34:23 2011 +0900
-+++ b/helper/mip6d-helper.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -39,7 +39,8 @@
- m_mrenable (false),
- m_debug (false),
- m_usemanualconf (false),
-- m_ha_served_pfx ("")
-+ m_ha_served_pfx (""),
-+ m_dsmip6enable (false)
- {
- m_mr_mobile_pfx = new std::vector<std::string> ();
- m_mr_egress_if = new std::vector<std::string> ();
-@@ -67,6 +68,7 @@
- bool m_mrenable;
- bool m_debug;
- bool m_usemanualconf;
-+ bool m_dsmip6enable;
- std::string m_ha_served_pfx;
- std::vector<std::string> *m_mr_mobile_pfx;
- std::vector<std::string> *m_mr_egress_if;
-@@ -226,6 +228,24 @@
- return;
- }
-
-+// DSMIP
-+void
-+Mip6dHelper::EnableDSMIP6 (NodeContainer nodes)
-+{
-+ for (uint32_t i = 0; i < nodes.GetN (); i ++)
-+ {
-+ Ptr<Mip6dConfig> mip6d_conf = nodes.Get (i)->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ nodes.Get (i)->AggregateObject (mip6d_conf);
-+ }
-+ mip6d_conf->m_dsmip6enable = true;
-+ }
-+
-+ return;
-+}
-+
- void
- Mip6dHelper::EnableDebug (NodeContainer nodes)
- {
-@@ -288,10 +308,26 @@
- << "#BindingAclPolicy 2001:1:2:3::1000 (2001:1:2:5::/64) allow;" << std::endl
- << "DefaultBindingAclPolicy allow;" << std::endl;
-
-+
-+
- conf << "HaServedPrefix " << mip6d_conf->m_ha_served_pfx << ";" << std::endl;
-+ if (mip6d_conf->m_dsmip6enable)
-+ {
-+ conf << "HaAcceptDsmip6 enabled;"<< std::endl;
-+ }
-+ if (mip6d_conf->m_dsmip6enable)
-+ {
-+ conf << "# The IPv4 address of the HA or the HA name can be given." << std::endl;
-+ conf << "HomeAgentV4Address 192.168.10.1;"<< std::endl;
-+ }
- }
- else if (mip6d_conf->m_mrenable)
- {
-+ if (mip6d_conf->m_dsmip6enable)
-+ {
-+ conf << "MnUseDsmip6 enabled;" << std::endl;
-+ }
-+
- conf << "NodeConfig MN;" << std::endl
- << "DoRouteOptimizationCN enabled;" << std::endl
- << "DoRouteOptimizationMN disabled;" << std::endl
-@@ -302,13 +338,32 @@
- for (std::vector<std::string>::iterator i = mip6d_conf->m_mr_egress_if->begin ();
- i != mip6d_conf->m_mr_egress_if->end (); ++i)
- {
-- conf << "Interface \"" << (*i) << "\";" << std::endl;
-+ if (mip6d_conf->m_dsmip6enable)
-+ {
-+ conf << "Interface \"" << (*i) << "\"{" << std::endl;
-+ conf << " # Specify if this interface should use DHCP to get an IPv4 CoA" << std::endl;
-+ conf << " UseDhcp enabled;" << std::endl;
-+ conf << "}" << std::endl;
-+ }
-+ else
-+ {
-+ conf << "Interface \"" << (*i) << "\";" << std::endl;
-+ }
- }
-
-+
- conf << "MnRouterProbes 1;" << std::endl
-- << "MnHomeLink \"sim0\" {" << std::endl
-- << " IsMobRtr enabled;" << std::endl
-- << " HomeAgentAddress " << mip6d_conf->m_mr_ha_addr << ";" << std::endl;
-+ << "MnHomeLink \"sim0\" {" << std::endl;
-+ if (mip6d_conf->m_dsmip6enable)
-+ {
-+ conf << "# The IPv4 address of the HA or the HA name can be given." << std::endl
-+ << "# If both are given, the HomeAgentName field is ignored." << std::endl
-+ << "HomeAgentV4Address 192.168.10.1;" << std::endl
-+ << "# HomeAgentName <FQDN of the Home Agent>;" << std::endl;
-+ }
-+
-+ conf << " IsMobRtr enabled;" << std::endl
-+ << " HomeAgentAddress " << mip6d_conf->m_mr_ha_addr << ";" << std::endl;
-
- conf << " HomeAddress " << mip6d_conf->m_mr_home_addr << "(";
- for (std::vector<std::string>::iterator i = mip6d_conf->m_mr_mobile_pfx->begin ();
-diff -r c2cbaa3a4b46 helper/mip6d-helper.h
---- a/helper/mip6d-helper.h Mon Dec 05 14:34:23 2011 +0900
-+++ b/helper/mip6d-helper.h Mon Dec 05 14:41:50 2011 +0900
-@@ -93,6 +93,7 @@
- void AddHomeAddress (Ptr<Node> node,
- Ipv6Address addr, Ipv6Prefix plen);
- void EnableMR (NodeContainer nodes);
-+ void EnableDSMIP6 (NodeContainer nodes);
-
- // Common
- void EnableDebug (NodeContainer nodes);
-diff -r c2cbaa3a4b46 model/dce-fd.cc
---- a/model/dce-fd.cc Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/dce-fd.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -383,6 +383,23 @@
-
- return fd;
- }
-+int dce_socketpair (int domain, int type, int protocol, int sv[2])
-+{
-+ sv[0] = dce_socket (domain, type, protocol);
-+ if (sv[0] < 0)
-+ {
-+ return -1;
-+ }
-+
-+ sv[1] = dce_socket (domain, type, protocol);
-+ if (sv[1] < 0)
-+ {
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
- int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
- {
- Thread *current = Current ();
-diff -r c2cbaa3a4b46 model/dce-poll.cc
---- a/model/dce-poll.cc Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/dce-poll.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -180,7 +180,12 @@
- }
- }
- nfds = eventByFd.size ();
-- if (nfds == 0)
-+
-+ // select(2):
-+ // Some code calls select() with all three sets empty, nfds zero, and a
-+ // non-NULL timeout as a fairly portable way to sleep with subsecond
-+ // precision.
-+ if (nfds == 0 && !timeout)
- {
- current->err = EINVAL;
- return -1;
-diff -r c2cbaa3a4b46 model/dce-time.h
---- a/model/dce-time.h Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/dce-time.h Mon Dec 05 14:41:50 2011 +0900
-@@ -3,6 +3,7 @@
-
- #include "sys/dce-time.h"
- #include <time.h>
-+#include <sys/sysinfo.h>
-
- #ifdef __cplusplus
- extern "C" {
-@@ -14,6 +15,7 @@
- char *dce_ctime(const time_t *timep);
- char *dce_asctime(const struct tm *tm);
- int dce_clock_gettime(clockid_t which_clock, struct timespec *tp);
-+int dce_sysinfo (struct sysinfo *info);
-
- #ifdef __cplusplus
- }
-diff -r c2cbaa3a4b46 model/dce.cc
---- a/model/dce.cc Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/dce.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -870,3 +870,18 @@
- static char loc[] = "";
- return loc;
- }
-+int dce_sysinfo (struct sysinfo *info)
-+{
-+ Thread *current = Current ();
-+ NS_LOG_FUNCTION (current << UtilsGetNodeId ());
-+ NS_ASSERT (current != 0);
-+ if (!info)
-+ {
-+ current->err = ENAMETOOLONG;
-+ return -1;
-+ }
-+
-+ info->uptime = (long)UtilsSimulationTimeToTime (Now ()).GetSeconds ();
-+ // XXX
-+ return 0;
-+}
-diff -r c2cbaa3a4b46 model/libc-dce.cc
---- a/model/libc-dce.cc Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/libc-dce.cc Mon Dec 05 14:41:50 2011 +0900
-@@ -51,6 +51,7 @@
- #include <netdb.h>
- #include <net/if.h>
- #include <netinet/in.h>
-+#include <netinet/ether.h>
- #include <poll.h>
- #include <semaphore.h>
- #include <signal.h>
-diff -r c2cbaa3a4b46 model/libc-ns3.h
---- a/model/libc-ns3.h Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/libc-ns3.h Mon Dec 05 14:41:50 2011 +0900
-@@ -73,6 +73,7 @@
- NATIVE (ntohl)
- NATIVE (ntohs)
- DCE (socket)
-+DCE (socketpair)
- DCE (getsockname)
- DCE (getpeername)
- DCE (bind)
-@@ -214,6 +215,7 @@
- DCE (setregid)
- DCE (setresuid)
- DCE (setresgid)
-+NATIVE (lockf)
- NATIVE (inet_aton)
- NATIVE (inet_ntoa)
- DCE (inet_ntop)
-@@ -224,6 +226,7 @@
- NATIVE (inet_netof)
- NATIVE (inet_addr)
- NATIVE (inet6_opt_find)
-+NATIVE (ether_aton)
- DCE (mmap)
- DCE (mmap64)
- DCE (munmap)
-@@ -255,6 +258,7 @@
- DCE (realloc)
- DCE (gettimeofday)
- DCE (time)
-+DCE (sysinfo)
- DCE (isatty)
- DCE (send)
- DCE (sendto)
-diff -r c2cbaa3a4b46 model/sys/dce-socket.h
---- a/model/sys/dce-socket.h Mon Dec 05 14:34:23 2011 +0900
-+++ b/model/sys/dce-socket.h Mon Dec 05 14:41:50 2011 +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);
- int dce_getpeername(int s, struct sockaddr *name, socklen_t *namelen);
-+int dce_socketpair (int domain, int type, int protocol, int sv[2]);
-
- #ifdef __cplusplus
- }
-diff -r c2cbaa3a4b46 wscript
---- a/wscript Mon Dec 05 14:34:23 2011 +0900
-+++ b/wscript Mon Dec 05 14:41:50 2011 +0900
-@@ -272,6 +272,10 @@
- target='bin/dce-mip6d',
- source=['example/dce-mip6d.cc'])
-
-+ module.add_example(needed = ['core', 'internet', 'dce', 'csma', 'mobility', 'wifi', 'visualizer'],
-+ target='bin/dce-dsmip6d',
-+ source=['example/dce-dsmip6d.cc'])
-+
- def build(bld):
- build_netlink(bld)
-
--- a/umip_mip6d_support.patch Mon Apr 09 10:03:45 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1266 +0,0 @@
-support umip(mip6d) with ns-3-linux for NEMO/MIP6
-
-diff -r 66034e9513f1 example/dce-mip6d.cc
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/dce-mip6d.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -0,0 +1,293 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+
-+//
-+// NEMO (Network Mobility) simulation with umip (mip6d) and net-next-2.6.
-+//
-+// UMIP: http://www.umip.org/git/umip.git
-+// patchset: 0daa3924177f326e26ed8bbb9dc9f0cdf8a51618
-+// build: CFLAGS="-fPIC -g" CXXFLAGS="-fPIC -g" LDFLAGS="-pie -g" ./configure --enable-vt --with-cflags="-DRT_DEBUG_LEVEL=1" --with-builtin-crypto
-+//
-+// Simulation Topology:
-+// Scenario: MR and MNN moves from under AR1 to AR2 with Care-of-Address
-+// alternation. during movement, MNN keeps ping6 to CN.
-+//
-+// +-----------+
-+// | HA |
-+// +-----------+
-+// |sim0
-+// +----------+------------+
-+// |sim0 |sim0
-+// +--------+ sim2+----+---+ +----+---+
-+// | CN | - - - -| AR1 | | AR2 |
-+// +--------+ +---+----+ +----+---+
-+// |sim1 |sim1
-+// | |
-+//
-+// sim0 sim0
-+// +----+------+ (Movement) +----+-----+
-+// | MR | <=====> | MR |
-+// +-----------+ +----------+
-+// |sim1 |sim1
-+// +---------+ +---------+
-+// | MNN | | MNN |
-+// +---------+ +---------+
-+
-+#include "ns3/network-module.h"
-+#include "ns3/core-module.h"
-+#include "ns3/internet-module.h"
-+#include "ns3/dce-module.h"
-+#include "ns3/mip6d-helper.h"
-+#include "ns3/csma-helper.h"
-+#include "ns3/wifi-helper.h"
-+#include "ns3/yans-wifi-helper.h"
-+#include "ns3/nqos-wifi-mac-helper.h"
-+#include "ns3/mobility-module.h"
-+#include "ns3/ping6-helper.h"
-+
-+
-+using namespace ns3;
-+
-+static void RunIp (Ptr<Node> 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> node, Time at, const char *name, const char *address)
-+{
-+ std::ostringstream oss;
-+ oss << "-f inet6 addr add " << address << " dev " << name;
-+ RunIp (node, at, oss.str ());
-+}
-+
-+bool usePing = true;
-+int main (int argc, char *argv[])
-+{
-+ CommandLine cmd;
-+ cmd.AddValue ("usePing", "Using Ping6 or not", usePing);
-+ cmd.Parse (argc, argv);
-+
-+ NodeContainer mr, ha, ar;
-+ ha.Create (1);
-+ ar.Create (2);
-+ mr.Create (1);
-+ NodeContainer mnn, cn;
-+ cn.Create (1);
-+ mnn.Create (1);
-+
-+ NetDeviceContainer devices;
-+ MobilityHelper mobility;
-+ Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
-+ positionAlloc->Add (Vector (75.0, -50.0, 0.0)); // HA
-+ positionAlloc->Add (Vector (0.0, 10.0, 0.0)); // AR1
-+ positionAlloc->Add (Vector (150.0, 10.0, 0.0)); // AR2
-+ positionAlloc->Add (Vector (-50.0, 10.0, 0.0)); // CN
-+ mobility.SetPositionAllocator (positionAlloc);
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (ha);
-+ mobility.Install (ar);
-+ mobility.Install (cn);
-+
-+ Ptr<ns3::RandomDiscPositionAllocator> r_position =
-+ CreateObject<RandomDiscPositionAllocator> ();
-+ r_position->SetX (100);
-+ r_position->SetY (50);
-+ r_position->SetRho (UniformVariable (200, 0));
-+ mobility.SetPositionAllocator (r_position);
-+ mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
-+ "Bounds", RectangleValue (Rectangle (0, 200, 30, 60)),
-+ "Speed", RandomVariableValue (ConstantVariable (10)),
-+ "Pause", RandomVariableValue (ConstantVariable (0.2)));
-+ mobility.Install (mr);
-+
-+
-+ mobility.PushReferenceMobilityModel (mr.Get (0));
-+ Ptr<MobilityModel> parentMobility = mr.Get (0)->GetObject<MobilityModel> ();
-+ Vector pos = parentMobility->GetPosition ();
-+ Ptr<ListPositionAllocator> positionAllocMnn =
-+ CreateObject<ListPositionAllocator> ();
-+ pos.x = 5;
-+ pos.y = 20;
-+ positionAllocMnn->Add (pos);
-+ mobility.SetPositionAllocator (positionAllocMnn);
-+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
-+ mobility.Install (mnn);
-+
-+ WifiHelper wifi = WifiHelper::Default ();
-+ YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
-+ YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
-+ NqosWifiMacHelper mac;
-+ CsmaHelper csma;
-+ phy.SetChannel (phyChannel.Create ());
-+ mac.SetType ("ns3::AdhocWifiMac");
-+ wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
-+
-+ devices = csma.Install (NodeContainer (ar.Get (0), ha.Get (0), ar.Get (1)));
-+
-+ phy.SetChannel (phyChannel.Create ());
-+ devices = wifi.Install (phy, mac, NodeContainer (ar.Get (0), mr, ar.Get (1)));
-+
-+ phy.SetChannel (phyChannel.Create ());
-+ NetDeviceContainer mnp_devices = wifi.Install (phy, mac, NodeContainer (mr.Get (0), mnn.Get (0)));
-+
-+ NetDeviceContainer cn_devices = csma.Install (NodeContainer (ar.Get (0), cn.Get (0)));
-+
-+ DceManagerHelper processManager;
-+ // processManager.SetLoader ("ns3::DlmLoaderFactory");
-+ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
-+ "Library", StringValue ("libnet-next-2.6.so"));
-+ processManager.Install (mr);
-+ processManager.Install (ha);
-+ processManager.Install (ar);
-+
-+ // Prefix configuration
-+ std::string ha_sim0 ("2001:1:2:3::1/64");
-+ std::string mnp1 ("2001:1:2:5::1");
-+ std::string mnp2 ("2001:1:2:8::1");
-+
-+ std::vector <std::string> *mnps = new std::vector <std::string>;
-+ mnps->push_back (mnp1);
-+ mnps->push_back (mnp2);
-+
-+ // For HA
-+ AddAddress (ha.Get (0), Seconds (0.1), "sim0", ha_sim0.c_str ());
-+ RunIp (ha.Get (0), Seconds (0.11), "link set lo up");
-+ RunIp (ha.Get (0), Seconds (0.11), "link set sim0 up");
-+ RunIp (ha.Get (0), Seconds (3.0), "link set ip6tnl0 up");
-+ RunIp (ha.Get (0), Seconds (3.1), "addr list");
-+ // RunIp (ha.Get (0), Seconds (3.2), "-6 route add default via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:4::/64 via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:6::/64 via 2001:1:2:3::2 dev sim0");
-+ RunIp (ha.Get (0), Seconds (3.15), "-6 route add 2001:1:2:7::/64 via 2001:1:2:3::3 dev sim0");
-+
-+ // For AR1 (the intermediate node)
-+ AddAddress (ar.Get (0), Seconds (0.1), "sim0", "2001:1:2:3::2/64");
-+ RunIp (ar.Get (0), Seconds (0.11), "link set lo up");
-+ RunIp (ar.Get (0), Seconds (0.11), "link set sim0 up");
-+ AddAddress (ar.Get (0), Seconds (0.12), "sim1", "2001:1:2:4::2/64");
-+ RunIp (ar.Get (0), Seconds (0.13), "link set sim1 up");
-+ AddAddress (ar.Get (0), Seconds (0.13), "sim2", "2001:1:2:6::2/64");
-+ RunIp (ar.Get (0), Seconds (0.14), "link set sim2 up");
-+ RunIp (ar.Get (0), Seconds (0.15), "-6 route add 2001:1:2::/48 via 2001:1:2:3::1 dev sim0");
-+ RunIp (ar.Get (0), Seconds (0.15), "route show table all");
-+
-+ // For AR2 (the intermediate node)
-+ AddAddress (ar.Get (1), Seconds (0.1), "sim0", "2001:1:2:3::3/64");
-+ RunIp (ar.Get (1), Seconds (0.11), "link set lo up");
-+ RunIp (ar.Get (1), Seconds (0.11), "link set sim0 up");
-+ AddAddress (ar.Get (1), Seconds (0.12), "sim1", "2001:1:2:7::2/64");
-+ RunIp (ar.Get (1), Seconds (0.13), "link set sim1 up");
-+ std::ostringstream oss;
-+ oss << "-6 route add " << mnp1 << "/64 via 2001:1:2:3::1 dev sim0";
-+ RunIp (ar.Get (1), Seconds (0.15), oss.str ());
-+ RunIp (ar.Get (1), Seconds (0.15), "route show table all");
-+
-+ // For MR
-+ for (uint32_t i = 0; i< mr.GetN (); i++)
-+ {
-+ RunIp (mr.Get (i), Seconds (0.11), "link set lo up");
-+ RunIp (mr.Get (i), Seconds (0.11), "link set sim0 up");
-+ RunIp (mr.Get (i), Seconds (3.0), "link set ip6tnl0 up");
-+ // RunIp (mr.Get (i), Seconds (3.1), "addr list");
-+ oss.str ("");
-+ oss << mnps->at (i) << "/64";
-+ AddAddress (mr.Get (i), Seconds (0.12), "sim1", oss.str ().c_str ());
-+ RunIp (mr.Get (i), Seconds (0.13), "link set sim1 up");
-+ }
-+
-+ RunIp (ha.Get (0), Seconds (4.0), "addr list");
-+ RunIp (ar.Get (0), Seconds (4.1), "addr list");
-+ RunIp (mr.Get (0), Seconds (4.2), "addr list");
-+ RunIp (ha.Get (0), Seconds (20.0), "route show table all");
-+ RunIp (mr.Get (0), Seconds (20.0), "route show table all");
-+
-+ {
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+ QuaggaHelper quagga;
-+ Mip6dHelper mip6d;
-+
-+ // HA
-+ mip6d.AddHaServedPrefix (ha.Get (0), Ipv6Address ("2001:1:2::"), Ipv6Prefix (48));
-+ mip6d.EnableHA (ha);
-+ mip6d.Install (ha);
-+
-+ // MR
-+ for (uint32_t i = 0; i< mr.GetN (); i++)
-+ {
-+ mip6d.AddMobileNetworkPrefix (mr.Get (i), Ipv6Address (mnps->at (i).c_str()), Ipv6Prefix (64));
-+ std::string ha_addr = ha_sim0;
-+ ha_addr.replace (ha_addr.find ("/"), 3, "\0 ");
-+ mip6d.AddHomeAgentAddress (mr.Get (i), Ipv6Address (ha_addr.c_str ()));
-+ mip6d.AddHomeAddress (mr.Get (i), Ipv6Address ("2001:1:2:3::1000"), Ipv6Prefix (64));
-+ mip6d.AddEgressInterface (mr.Get (i), "sim0");
-+ }
-+ mip6d.EnableMR (mr);
-+ mip6d.Install (mr);
-+
-+ quagga.EnableRadvd (mr.Get (0), "sim1", "2001:1:2:5::/64");
-+ quagga.EnableZebraDebug (mr);
-+ quagga.Install (mr);
-+
-+ // AR
-+ quagga.EnableRadvd (ar.Get (0), "sim0", "2001:1:2:3::/64");
-+ quagga.EnableHomeAgentFlag (ar.Get (0), "sim0");
-+ quagga.EnableRadvd (ar.Get (0), "sim1", "2001:1:2:4::/64");
-+ quagga.EnableRadvd (ar.Get (0), "sim2", "2001:1:2:6::/64");
-+ quagga.EnableRadvd (ar.Get (1), "sim1", "2001:1:2:7::/64");
-+ quagga.EnableZebraDebug (ar);
-+ quagga.Install (ar);
-+ }
-+
-+ // MNN
-+ if (usePing)
-+ {
-+ LogComponentEnable ("Ping6Application", LOG_LEVEL_INFO);
-+ // Ping6
-+ /* Install IPv4/IPv6 stack */
-+ InternetStackHelper internetv6;
-+ internetv6.SetIpv4StackInstall (false);
-+ internetv6.Install (mnn);
-+ internetv6.Install (cn);
-+
-+ Ipv6AddressHelper ipv6;
-+ Ipv6InterfaceContainer i1 = ipv6.AssignWithoutAddress (mnp_devices.Get (1));
-+
-+ ipv6.NewNetwork (Ipv6Address ("2001:1:2:6::"), 64);
-+ Ipv6InterfaceContainer i2 = ipv6.Assign (cn_devices.Get (1));
-+
-+ Ptr<Ipv6StaticRouting> routing = 0;
-+ Ipv6StaticRoutingHelper routingHelper;
-+ routing = routingHelper.GetStaticRouting (cn.Get (0)->GetObject<Ipv6> ());
-+ routing->SetDefaultRoute (Ipv6Address ("2001:1:2:6::2"), 1, Ipv6Address ("::"), 0);
-+
-+ uint32_t packetSize = 1024;
-+ uint32_t maxPacketCount = 50000000;
-+ Time interPacketInterval = Seconds (1.);
-+ Ping6Helper ping6;
-+
-+ ping6.SetLocal (Ipv6Address::GetAny ());
-+ ping6.SetRemote (i2.GetAddress (0, 1));
-+
-+ ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
-+ ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));
-+ ping6.SetAttribute ("PacketSize", UintegerValue (packetSize));
-+ ApplicationContainer apps = ping6.Install (mnn.Get (0));
-+ apps.Start (Seconds (2.0));
-+ }
-+
-+ phy.EnablePcapAll ("dce-mip6d");
-+ csma.EnablePcapAll ("dce-mip6d");
-+
-+ Simulator::Stop (Seconds (30.0));
-+ Simulator::Run ();
-+ Simulator::Destroy ();
-+
-+ return 0;
-+}
-diff -r 66034e9513f1 helper/mip6d-helper.cc
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/helper/mip6d-helper.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -0,0 +1,392 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+/*
-+ * Copyright (c) 2010 Hajime Tazaki
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation;
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
-+ */
-+
-+#include "ns3/object-factory.h"
-+#include "mip6d-helper.h"
-+#include "dce-application-helper.h"
-+#include "ns3/names.h"
-+#include <fstream>
-+#include <map>
-+#include <sys/stat.h>
-+
-+namespace ns3 {
-+
-+class Mip6dConfig: public Object
-+{
-+private:
-+ static int index;
-+ std::string router_id;
-+public:
-+ Mip6dConfig ()
-+ : m_haenable (false),
-+ m_mrenable (false),
-+ m_debug (false),
-+ m_usemanualconf (false),
-+ m_ha_served_pfx ("")
-+ {
-+ m_mr_mobile_pfx = new std::vector<std::string> ();
-+ m_mr_egress_if = new std::vector<std::string> ();
-+ }
-+ ~Mip6dConfig ()
-+ {
-+ }
-+
-+ static TypeId
-+ GetTypeId (void)
-+ {
-+ static TypeId tid = TypeId ("ns3::Mip6dConfig")
-+ .SetParent<Object> ()
-+ .AddConstructor<Mip6dConfig> ()
-+ ;
-+ return tid;
-+ }
-+ TypeId
-+ GetInstanceTypeId (void) const
-+ {
-+ return GetTypeId ();
-+ }
-+
-+ bool m_haenable;
-+ bool m_mrenable;
-+ bool m_debug;
-+ bool m_usemanualconf;
-+ std::string m_ha_served_pfx;
-+ std::vector<std::string> *m_mr_mobile_pfx;
-+ std::vector<std::string> *m_mr_egress_if;
-+ std::string m_mr_ha_addr;
-+ std::string m_mr_home_addr;
-+
-+ virtual void
-+ Print (std::ostream& os) const
-+ {
-+ os << "# IPsec configuration - NO IPSEC AT THE MOMENT" << std::endl
-+ << "UseMnHaIPsec disabled;" << std::endl
-+ << "KeyMngMobCapability disabled;" << std::endl
-+ << "# EOF" << std::endl;
-+ }
-+};
-+std::ostream& operator << (std::ostream& os, Mip6dConfig const& config)
-+{
-+ config.Print (os);
-+ return os;
-+}
-+
-+
-+Mip6dHelper::Mip6dHelper ()
-+{
-+}
-+
-+void
-+Mip6dHelper::SetAttribute (std::string name, const AttributeValue &value)
-+{
-+}
-+
-+// HomeAgent
-+void
-+Mip6dHelper::EnableHA (NodeContainer nodes)
-+{
-+ for (uint32_t i = 0; i < nodes.GetN (); i ++)
-+ {
-+ Ptr<Mip6dConfig> mip6d_conf = nodes.Get (i)->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ nodes.Get (i)->AggregateObject (mip6d_conf);
-+ }
-+ mip6d_conf->m_haenable = true;
-+ }
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::AddHaServedPrefix (Ptr<Node> node,
-+ Ipv6Address prefix, Ipv6Prefix plen)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+
-+ std::ostringstream oss;
-+ prefix.Print (oss);
-+ oss << "/" << (uint32_t)plen.GetPrefixLength ();
-+
-+ mip6d_conf->m_ha_served_pfx = oss.str ();
-+
-+ return;
-+}
-+
-+// MobileRouter
-+void
-+Mip6dHelper::EnableMR (NodeContainer nodes)
-+{
-+ // for (uint32_t i = 0; i < nodes.GetN (); i++)
-+ for (uint32_t i = 0; i < nodes.GetN (); i ++)
-+ {
-+ Ptr<Mip6dConfig> mip6d_conf = nodes.Get (i)->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ nodes.Get (i)->AggregateObject (mip6d_conf);
-+ }
-+ mip6d_conf->m_mrenable = true;
-+ }
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::AddMobileNetworkPrefix (Ptr<Node> node,
-+ Ipv6Address prefix, Ipv6Prefix plen)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+
-+ std::ostringstream oss;
-+ prefix.Print (oss);
-+ oss << "/" << (uint32_t)plen.GetPrefixLength ();
-+
-+ mip6d_conf->m_mr_mobile_pfx->push_back (oss.str ());
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::AddEgressInterface (Ptr<Node> node, const char *ifname)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+
-+ mip6d_conf->m_mr_egress_if->push_back (std::string(ifname));
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::AddHomeAgentAddress (Ptr<Node> node, Ipv6Address addr)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+
-+ std::ostringstream oss;
-+ addr.Print (oss);
-+ mip6d_conf->m_mr_ha_addr = oss.str ();
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::AddHomeAddress (Ptr<Node> node,
-+ Ipv6Address addr, Ipv6Prefix plen)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+
-+ std::ostringstream oss;
-+ addr.Print (oss);
-+ oss << "/" << (uint32_t)plen.GetPrefixLength ();
-+ mip6d_conf->m_mr_home_addr = oss.str ();
-+
-+ return;
-+}
-+
-+void
-+Mip6dHelper::EnableDebug (NodeContainer nodes)
-+{
-+ for (uint32_t i = 0; i < nodes.GetN (); i ++)
-+ {
-+ Ptr<Mip6dConfig> mip6d_conf = nodes.Get (i)->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = CreateObject<Mip6dConfig> ();
-+ nodes.Get (i)->AggregateObject (mip6d_conf);
-+ }
-+ mip6d_conf->m_debug = true;
-+ }
-+ return;
-+}
-+
-+void
-+Mip6dHelper::UseManualConfig (NodeContainer nodes)
-+{
-+ for (uint32_t i = 0; i < nodes.GetN (); i ++)
-+ {
-+ Ptr<Mip6dConfig> mip6d_conf = nodes.Get (i)->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = new Mip6dConfig ();
-+ nodes.Get (i)->AggregateObject (mip6d_conf);
-+ }
-+ mip6d_conf->m_usemanualconf = true;
-+ }
-+ return;
-+}
-+
-+void
-+Mip6dHelper::GenerateConfig (Ptr<Node> node)
-+{
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+
-+ if (mip6d_conf->m_usemanualconf)
-+ {
-+ return;
-+ }
-+
-+ // config generation
-+ std::stringstream conf_dir, conf_file;
-+ // FIXME XXX
-+ conf_dir << "files-" << node->GetId () << "";
-+ ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
-+ conf_dir << "/etc/";
-+ ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
-+
-+ conf_file << conf_dir.str() << "/mip6d.conf";
-+ std::ofstream conf;
-+ conf.open (conf_file.str ().c_str ());
-+
-+ if (mip6d_conf->m_haenable)
-+ {
-+ conf << "NodeConfig HA;" << std::endl
-+ << "Interface \"sim0\";" << std::endl
-+ << "HaAcceptMobRtr enabled;" << std::endl
-+ << "#BindingAclPolicy 2001:1:2:3::1000 (2001:1:2:5::/64) allow;" << std::endl
-+ << "DefaultBindingAclPolicy allow;" << std::endl;
-+
-+ conf << "HaServedPrefix " << mip6d_conf->m_ha_served_pfx << ";" << std::endl;
-+ }
-+ else if (mip6d_conf->m_mrenable)
-+ {
-+ conf << "NodeConfig MN;" << std::endl
-+ << "DoRouteOptimizationCN enabled;" << std::endl
-+ << "DoRouteOptimizationMN disabled;" << std::endl
-+ << "UseCnBuAck disabled;" << std::endl
-+ << "MnDiscardHaParamProb enabled;" << std::endl
-+ << "MobRtrUseExplicitMode enabled;" << std::endl;
-+
-+ for (std::vector<std::string>::iterator i = mip6d_conf->m_mr_egress_if->begin ();
-+ i != mip6d_conf->m_mr_egress_if->end (); ++i)
-+ {
-+ conf << "Interface \"" << (*i) << "\";" << std::endl;
-+ }
-+
-+ conf << "MnRouterProbes 1;" << std::endl
-+ << "MnHomeLink \"sim0\" {" << std::endl
-+ << " IsMobRtr enabled;" << std::endl
-+ << " HomeAgentAddress " << mip6d_conf->m_mr_ha_addr << ";" << std::endl;
-+
-+ conf << " HomeAddress " << mip6d_conf->m_mr_home_addr << "(";
-+ for (std::vector<std::string>::iterator i = mip6d_conf->m_mr_mobile_pfx->begin ();
-+ i != mip6d_conf->m_mr_mobile_pfx->end (); ++i)
-+ {
-+ if (i != mip6d_conf->m_mr_mobile_pfx->begin ())
-+ {
-+ conf << "," ;
-+ }
-+ conf << (*i);
-+ }
-+ conf << ");" << std::endl;
-+ conf << "}" << std::endl;
-+ }
-+ else
-+ {
-+ NS_ASSERT ("Need to specify HA or MR");
-+ }
-+
-+ if (mip6d_conf->m_debug)
-+ {
-+ conf << "DebugLevel 10;" << std::endl;
-+ }
-+
-+ conf << *mip6d_conf;
-+ conf.close ();
-+
-+}
-+
-+
-+ApplicationContainer
-+Mip6dHelper::Install (Ptr<Node> node)
-+{
-+ return ApplicationContainer (InstallPriv (node));
-+}
-+
-+ApplicationContainer
-+Mip6dHelper::Install (std::string nodeName)
-+{
-+ Ptr<Node> node = Names::Find<Node> (nodeName);
-+ return ApplicationContainer (InstallPriv (node));
-+}
-+
-+ApplicationContainer
-+Mip6dHelper::Install (NodeContainer c)
-+{
-+ ApplicationContainer apps;
-+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
-+ {
-+ apps.Add (InstallPriv (*i));
-+ }
-+
-+ return apps;
-+}
-+
-+ApplicationContainer
-+Mip6dHelper::InstallPriv (Ptr<Node> node)
-+{
-+ DceApplicationHelper process;
-+ ApplicationContainer apps;
-+
-+ Ptr<Mip6dConfig> mip6d_conf = node->GetObject<Mip6dConfig>();
-+ if (!mip6d_conf)
-+ {
-+ mip6d_conf = new Mip6dConfig ();
-+ node->AggregateObject (mip6d_conf);
-+ }
-+ GenerateConfig (node);
-+
-+ process.ResetArguments ();
-+ process.SetBinary ("mip6d");
-+ process.ParseArguments ("-c /etc/mip6d.conf -d 10");
-+ process.SetStackSize (1<<16);
-+ apps.Add (process.Install (node));
-+ apps.Get(0)->SetStartTime (Seconds (1.0 + 0.01 * node->GetId ()));
-+ node->AddApplication (apps.Get (0));
-+
-+ return apps;
-+}
-+
-+} // namespace ns3
-diff -r 66034e9513f1 helper/mip6d-helper.h
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/helper/mip6d-helper.h Thu Mar 29 13:54:56 2012 +0900
-@@ -0,0 +1,111 @@
-+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-+/*
-+ * Copyright (c) 2010 Hajime Tazaki
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation;
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
-+ */
-+#ifndef MIP6D_HELPER_H
-+#define MIP6D_HELPER_H
-+
-+#include "ns3/node-container.h"
-+#include "ns3/application-container.h"
-+#include "ns3/object-factory.h"
-+#include "ns3/boolean.h"
-+#include "ns3/ipv4-interface-container.h"
-+
-+namespace ns3 {
-+
-+/**
-+ * \brief create a umip (mip6d) daemon as an application and associate it to a node
-+ *
-+ */
-+class Mip6dHelper
-+{
-+public:
-+ /**
-+ * Create a Mip6dHelper which is used to make life easier for people wanting
-+ * to use mip6d Applications.
-+ *
-+ */
-+ Mip6dHelper ();
-+
-+ /**
-+ * Install a mip6d application on each Node in the provided NodeContainer.
-+ *
-+ * \param nodes The NodeContainer containing all of the nodes to get a mip6d
-+ * application via ProcessManager.
-+ *
-+ * \returns A list of mip6d applications, one for each input node
-+ */
-+ ApplicationContainer Install (NodeContainer nodes);
-+
-+ /**
-+ * Install a mip6d application on the provided Node. The Node is specified
-+ * directly by a Ptr<Node>
-+ *
-+ * \param node The node to install the Application on.
-+ *
-+ * \returns An ApplicationContainer holding the mip6d application created.
-+ */
-+ ApplicationContainer Install (Ptr<Node> node);
-+
-+ /**
-+ * Install a mip6d application on the provided Node. The Node is specified
-+ * by a string that must have previosly been associated with a Node using the
-+ * Object Name Service.
-+ *
-+ * \param nodeName The node to install the ProcessApplication on.
-+ *
-+ * \returns An ApplicationContainer holding the mip6d application created.
-+ */
-+ ApplicationContainer Install (std::string nodeName);
-+
-+ /**
-+ * \brief Configure ping applications attribute
-+ * \param name attribute's name
-+ * \param value attribute's value
-+ */
-+ void SetAttribute (std::string name, const AttributeValue &value);
-+
-+ // For HA
-+ void EnableHA (NodeContainer nodes);
-+ void AddHaServedPrefix (Ptr<Node> node,
-+ Ipv6Address prefix, Ipv6Prefix plen);
-+
-+ // For MR
-+ void AddMobileNetworkPrefix (Ptr<Node> node,
-+ Ipv6Address prefix, Ipv6Prefix plen);
-+ void AddEgressInterface (Ptr<Node> node, const char *ifname);
-+ void AddHomeAgentAddress (Ptr<Node> node, Ipv6Address addr);
-+ void AddHomeAddress (Ptr<Node> node,
-+ Ipv6Address addr, Ipv6Prefix plen);
-+ void EnableMR (NodeContainer nodes);
-+
-+ // Common
-+ void EnableDebug (NodeContainer nodes);
-+ void UseManualConfig (NodeContainer nodes);
-+
-+private:
-+ /**
-+ * \internal
-+ */
-+ ApplicationContainer InstallPriv (Ptr<Node> node);
-+ void GenerateConfig (Ptr<Node> node);
-+};
-+
-+} // namespace ns3
-+
-+#endif /* MIP6D_HELPER_H */
-diff -r 66034e9513f1 helper/quagga-helper.cc
---- a/helper/quagga-helper.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/helper/quagga-helper.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -44,7 +44,7 @@
- m_zebradebug (false),
- m_usemanualconf (false)
- {
-- m_radvd_if = new std::vector<std::string> ();
-+ m_radvd_if = new std::map<std::string, std::string> ();
- m_egress_if = new std::vector<std::string> ();
- m_haflag_if = new std::vector<std::string> ();
- }
-@@ -82,7 +82,7 @@
- bool m_tdpenable;
- bool m_zebradebug;
- bool m_usemanualconf;
-- std::vector<std::string> *m_radvd_if;
-+ std::map<std::string, std::string> *m_radvd_if;
- std::vector<std::string> *m_egress_if;
- std::vector<std::string> *m_haflag_if;
-
-@@ -395,7 +395,7 @@
- }
-
- void
--QuaggaHelper::EnableRadvd (Ptr<Node> node, const char *ifname)
-+QuaggaHelper::EnableRadvd (Ptr<Node> node, const char *ifname, const char *prefix)
- {
- Ptr<QuaggaConfig> zebra_conf = node->GetObject<QuaggaConfig>();
- if (!zebra_conf)
-@@ -404,7 +404,8 @@
- node->AggregateObject (zebra_conf);
- }
-
-- zebra_conf->m_radvd_if->push_back (std::string(ifname));
-+ zebra_conf->m_radvd_if->insert (
-+ std::map<std::string, std::string>::value_type (std::string(ifname), std::string(prefix)));
-
- return;
- }
-@@ -554,12 +555,12 @@
- }
-
- // radvd
-- for (std::vector<std::string>::iterator i = zebra_conf->m_radvd_if->begin ();
-+ for (std::map<std::string, std::string>::iterator i = zebra_conf->m_radvd_if->begin ();
- i != zebra_conf->m_radvd_if->end (); ++i)
- {
-- conf << "interface " << (*i) << std::endl;
-+ conf << "interface " << (*i).first << std::endl;
- conf << " ipv6 nd ra-interval 5" << std::endl;
-- conf << " ipv6 nd prefix-advertisement" << std::endl;
-+ conf << " ipv6 nd prefix " << (*i).second << " 30 15" <<std::endl;
- conf << " no ipv6 nd suppress-ra" << std::endl;
- conf << "!" << std::endl;
- }
-diff -r 66034e9513f1 helper/quagga-helper.h
---- a/helper/quagga-helper.h Thu Mar 29 13:53:53 2012 +0900
-+++ b/helper/quagga-helper.h Thu Mar 29 13:54:56 2012 +0900
-@@ -83,7 +83,7 @@
- void EnableOspfDebug (NodeContainer nodes);
- void EnableTdpNina (NodeContainer nodes);
- void EnableZebraDebug (NodeContainer nodes);
-- void EnableRadvd (Ptr<Node> node, const char *ifname);
-+ void EnableRadvd (Ptr<Node> node, const char *ifname, const char *prefix);
- void EnableEgressIF (Ptr<Node> node, const char *ifname);
- void EnableHomeAgentFlag (Ptr<Node> node, const char *ifname);
- void UseManualConfig (NodeContainer nodes);
-diff -r 66034e9513f1 model/dce-fd.cc
---- a/model/dce-fd.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-fd.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -345,11 +345,14 @@
-
- Ptr<SocketFdFactory> factory = 0;
-
-+ // XXX
-+#if 0
- if ( domain == AF_INET6 )
- {
- current->err = EAFNOSUPPORT;
- return -1;
- }
-+#endif
-
- if (domain != AF_UNIX)
- {
-@@ -373,6 +376,8 @@
- }
-
- UnixFd *socket = factory->CreateSocket (domain, type, protocol);
-+ if (!socket)
-+ return -1;
- socket->IncFdCount ();
- current->process->openFiles[fd] = new FileUsage (fd, socket);
-
-diff -r 66034e9513f1 model/dce-manager.cc
---- a/model/dce-manager.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-manager.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -1055,6 +1055,22 @@
- libpthread_setup = (void (*)(const struct Libc *))(symbol);
- libpthread_setup (libc);
-
-+ h = ld->Load ("librt-ns3.so", RTLD_GLOBAL);
-+ if (h == 0)
-+ {
-+ err = ENOMEM;
-+ return 0;
-+ }
-+ symbol = ld->Lookup (h, "librt_setup");
-+ if (symbol == 0)
-+ {
-+ NS_FATAL_ERROR ("This is not our fake librt !");
-+ }
-+ // construct librt now
-+ void (*librt_setup)(const struct Libc *fn);
-+ librt_setup = (void (*)(const struct Libc *))(symbol);
-+ librt_setup (libc);
-+
- // finally, call into 'main'.
- h = ld->Load (filename, RTLD_GLOBAL);
-
-diff -r 66034e9513f1 model/dce-signal.cc
---- a/model/dce-signal.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-signal.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -3,6 +3,7 @@
- #include "process.h"
- #include "ns3/log.h"
- #include "ns3/assert.h"
-+#include "waiter.h"
- #include <vector>
- #include <errno.h>
-
-@@ -98,6 +99,18 @@
-
- return 0;
- }
-+
-+int dce_sigwait (const sigset_t *set, int *sig)
-+{
-+ int ret = 0;
-+ // current->process->signalHandlers.push_back (handler);
-+
-+ Waiter waiter;
-+ waiter.SetTimeout (Seconds (0.0));
-+ waiter.WaitDoSignal ();
-+
-+ return ret;
-+}
- int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
- {
- Thread *current = Current ();
-diff -r 66034e9513f1 model/dce-signal.h
---- a/model/dce-signal.h Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-signal.h Thu Mar 29 13:54:56 2012 +0900
-@@ -17,6 +17,7 @@
- int dce_pthread_kill (pthread_t thread, int sig);
- void dce_abort ();
- int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
-+int dce_sigwait (const sigset_t *set, int *sig);
-
- #ifdef __cplusplus
- }
-diff -r 66034e9513f1 model/dce-time.cc
---- a/model/dce-time.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-time.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -54,3 +54,12 @@
-
- return asctime_r (tm, Current ()->process->asctime_result);
- }
-+
-+int dce_clock_gettime(clockid_t which_clock, struct timespec *tp)
-+{
-+ NS_LOG_FUNCTION (Current () << UtilsGetNodeId ());
-+ NS_ASSERT (Current () != 0);
-+ NS_ASSERT (tp != 0);
-+ *tp = UtilsTimeToTimespec (UtilsSimulationTimeToTime (Now ()));
-+ return 0;
-+}
-diff -r 66034e9513f1 model/dce-time.h
---- a/model/dce-time.h Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce-time.h Thu Mar 29 13:54:56 2012 +0900
-@@ -13,6 +13,7 @@
- struct tm *dce_localtime(const time_t *timep);
- char *dce_ctime(const time_t *timep);
- char *dce_asctime(const struct tm *tm);
-+int dce_clock_gettime(clockid_t which_clock, struct timespec *tp);
-
- #ifdef __cplusplus
- }
-diff -r 66034e9513f1 model/dce.cc
---- a/model/dce.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/dce.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -20,6 +20,8 @@
- #include <getopt.h>
- #include <limits.h>
- #include <fcntl.h>
-+#include <net/if.h>
-+#include <sys/ioctl.h>
- #include "dce-random.h"
- #include "net/dce-if.h"
- #include "ns3/node.h"
-@@ -638,6 +640,43 @@
-
- unsigned dce_if_nametoindex (const char *ifname)
- {
-+ struct ifreq ifr;
-+ int fd = dce_socket (AF_INET, SOCK_DGRAM, 0);
-+ if (fd < 0)
-+ {
-+ return 0;
-+ }
-+
-+ strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
-+ if (dce_ioctl (fd, SIOCGIFINDEX, (char *)&ifr) < 0)
-+ {
-+ // int saved_errno = errno;
-+ // close_not_cancel_no_status (fd);
-+ // if (saved_errno == EINVAL)
-+ // __set_errno (ENOSYS);
-+ return 0;
-+ }
-+ return ifr.ifr_ifindex;
-+}
-+char *dce_if_indextoname (unsigned ifindex, char *ifname)
-+{
-+ struct ifreq ifr;
-+ int fd = dce_socket (AF_INET, SOCK_DGRAM, 0);
-+ if (fd < 0)
-+ {
-+ return 0;
-+ }
-+
-+ ifr.ifr_ifindex = ifindex;
-+ if (dce_ioctl (fd, SIOCGIFNAME, (char *)&ifr) < 0)
-+ {
-+ return 0;
-+ }
-+ return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
-+}
-+#if 0
-+unsigned dce_if_nametoindex (const char *ifname)
-+{
- int index = 0;
- Ptr<Node> node = Current ()->process->manager->GetObject<Node> ();
- Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
-@@ -653,6 +692,7 @@
- }
- return 0;
- }
-+#endif
- pid_t dce_fork (void)
- {
- Thread *thread = Current ();
-diff -r 66034e9513f1 model/elf-cache.cc
---- a/model/elf-cache.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/elf-cache.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -26,6 +26,9 @@
- overriden.from = "libpthread.so.0";
- overriden.to = "libpthread-ns3.so";
- m_overriden.push_back (overriden);
-+ overriden.from = "librt.so.1";
-+ overriden.to = "librt-ns3.so";
-+ m_overriden.push_back (overriden);
- }
-
- std::string
-diff -r 66034e9513f1 model/libc-ns3.h
---- a/model/libc-ns3.h Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/libc-ns3.h Thu Mar 29 13:54:56 2012 +0900
-@@ -223,6 +223,7 @@
- NATIVE (inet_lnaof)
- NATIVE (inet_netof)
- NATIVE (inet_addr)
-+NATIVE (inet6_opt_find)
- DCE (mmap)
- DCE (mmap64)
- DCE (munmap)
-@@ -279,6 +280,7 @@
- NATIVE (sigaddset)
- NATIVE (sigdelset)
- NATIVE (sigismember)
-+DCE (sigwait)
- DCE_WITH_ALIAS2(strtol, __strtol_internal)
- DCE (strtoll)
- DCE (strtoul)
-@@ -343,6 +345,13 @@
- DCE (pthread_cond_wait)
- DCE (pthread_condattr_destroy)
- DCE (pthread_condattr_init)
-+NATIVE (pthread_rwlock_init)
-+NATIVE (pthread_rwlock_unlock)
-+NATIVE (pthread_rwlock_wrlock)
-+NATIVE (pthread_rwlock_rdlock)
-+NATIVE (pthread_rwlock_destroy)
-+NATIVE (pthread_setcancelstate)
-+NATIVE (pthread_sigmask)
-
- // netdb.h
- DCE (gethostbyname)
-@@ -381,6 +390,7 @@
- DCE (timerfd_gettime)
-
- DCE (if_nametoindex)
-+DCE (if_indextoname)
- DCE (fork)
-
- NATIVE (qsort)
-@@ -442,8 +452,8 @@
- NATIVE (pathconf)
-
- // this is wrong. clock should be changed to DCE implementation
--//DCE (__vdso_clock_gettime)
--NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
-+DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
-+//NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
-
- // setjmp.h
- NATIVE (__sigsetjmp)
-diff -r 66034e9513f1 model/librt-ns3.version
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/model/librt-ns3.version Thu Mar 29 13:54:56 2012 +0900
-@@ -0,0 +1,4 @@
-+NS3 {
-+global:
-+ librt_setup;
-+};
-diff -r 66034e9513f1 model/linux-socket-fd-factory.cc
---- a/model/linux-socket-fd-factory.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/linux-socket-fd-factory.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -524,6 +524,8 @@
- this));
- Set (".net.ipv4.conf.all.forwarding", "1");
- Set (".net.ipv4.conf.all.log_martians", "1");
-+ Set (".net.ipv6.conf.all.forwarding", "1");
-+ Set (".net.ipv6.conf.all.proxy_ndp", "1");
-
- while (!m_earlySysfs.empty ())
- {
-diff -r 66034e9513f1 model/linux-socket-fd.cc
---- a/model/linux-socket-fd.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/linux-socket-fd.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -177,6 +177,7 @@
- return 0;
- break;
- default:
-+ return 0;
- //XXX commands missing
- NS_FATAL_ERROR ("fcntl not implemented on socket");
- return -1;
-diff -r 66034e9513f1 model/net/dce-if.h
---- a/model/net/dce-if.h Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/net/dce-if.h Thu Mar 29 13:54:56 2012 +0900
-@@ -7,6 +7,7 @@
- #endif
-
- unsigned dce_if_nametoindex (const char *ifname);
-+char *dce_if_indextoname (unsigned ifindex, char *ifname);
-
-
- #ifdef __cplusplus
-diff -r 66034e9513f1 model/ns3-socket-fd-factory.cc
---- a/model/ns3-socket-fd-factory.cc Thu Mar 29 13:53:53 2012 +0900
-+++ b/model/ns3-socket-fd-factory.cc Thu Mar 29 13:54:56 2012 +0900
-@@ -142,7 +142,8 @@
- }
- else
- {
-- NS_FATAL_ERROR ("unsupported domain");
-+ // NS_FATAL_ERROR ("unsupported domain");
-+ return 0;
- }
-
- return socket;
-diff -r 66034e9513f1 wscript
---- a/wscript Thu Mar 29 13:53:53 2012 +0900
-+++ b/wscript Thu Mar 29 13:54:56 2012 +0900
-@@ -26,7 +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)
- ns3waf.check_modules(conf, ['point-to-point-layout'], mandatory = False)
-- ns3waf.check_modules(conf, ['topology-read', 'applications'], mandatory = False)
-+ ns3waf.check_modules(conf, ['topology-read', 'applications', 'visualizer'], mandatory = False)
- conf.check_tool('compiler_cc')
- conf.check(header_name='stdint.h', define_name='HAVE_STDINT_H', mandatory=False)
- conf.check(header_name='inttypes.h', define_name='HAVE_INTTYPES_H', mandatory=False)
-@@ -65,6 +65,17 @@
- conf.end_msg(libpthread, True)
- conf.env['LIBPTHREAD_FILE'] = libpthread
-
-+ conf.start_msg('Searching rt library')
-+ librt = search_file ([
-+ '/lib64/librt.so.1',
-+ '/lib/librt.so.1',
-+ ])
-+ if librt is None:
-+ conf.fatal('not found')
-+ else:
-+ conf.end_msg(librt, True)
-+ conf.env['LIBRT_FILE'] = librt
-+
- conf.find_program('readversiondef', var='READVERSIONDEF', mandatory=True)
-
- if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack):
-@@ -256,6 +267,10 @@
- target='bin/dce-quagga-bgpd',
- source=['example/dce-quagga-bgpd.cc'])
-
-+ module.add_example(needed = ['core', 'internet', 'dce', 'csma', 'mobility', 'wifi', 'visualizer'],
-+ target='bin/dce-mip6d',
-+ source=['example/dce-mip6d.cc'])
-+
- def build(bld):
- build_netlink(bld)
-
-@@ -342,6 +357,7 @@
- 'helper/dce-manager-helper.cc',
- 'helper/dce-application-helper.cc',
- 'helper/quagga-helper.cc',
-+ 'helper/mip6d-helper.cc',
- ]
- module_headers = [
- 'model/dce-manager.h',
-@@ -354,6 +370,7 @@
- 'helper/dce-manager-helper.h',
- 'helper/dce-application-helper.h',
- 'helper/quagga-helper.h',
-+ 'helper/mip6d-helper.h',
- ]
- module_source = module_source + kernel_source
- module_headers = module_headers + kernel_headers
-@@ -383,6 +400,11 @@
- rule='%s %s | cat ${SRC[0].abspath()} - > ${TGT}' %
- (bld.env['READVERSIONDEF'], bld.env['LIBPTHREAD_FILE']))
-
-+ bld(source=['model/librt-ns3.version'],
-+ target='model/librt.version',
-+ rule='%s %s | cat ${SRC[0].abspath()} - > ${TGT}' %
-+ (bld.env['READVERSIONDEF'], bld.env['LIBRT_FILE']))
-+
- bld.add_group('dce_use_version_files')
-
- # The very small libc used to replace the glibc
-@@ -402,3 +424,13 @@
- linkflags=['-nostdlib', '-lc',
- '-Wl,--version-script=' + os.path.join('model', 'libpthread.version'),
- '-Wl,-soname=libpthread.so.0'])
-+
-+ # The very small librt used to replace the glibc
-+ # and forward to the dce_* code
-+ bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
-+ target='lib/rt-ns3', cflags=['-g'],
-+ defines=['LIBSETUP=librt_setup'],
-+ linkflags=['-nostdlib', '-lc',
-+ '-Wl,--version-script=' + os.path.join('model', 'librt.version'),
-+ '-Wl,-soname=librt.so.1'])
-+