linux kernel support for ns-3-dce-quagga
authorHajime Tazaki <tazaki@nict.go.jp>
Thu, 21 Jun 2012 16:29:32 +0900
changeset 58 e0a3fe869908
parent 57 e5505327aee5
child 59 13362c066a98
linux kernel support for ns-3-dce-quagga
Makefile.print
processor.mk
sim/defconfig
sim/security.c
sim/sim-socket.c
--- a/Makefile.print	Thu Feb 09 13:34:55 2012 +0100
+++ b/Makefile.print	Thu Jun 21 16:29:32 2012 +0900
@@ -3,6 +3,13 @@
 include $(config)
 include $(srcdir)Makefile
 
+# fix minor nits for make version dependencies
+ifeq (3.82,$(firstword $(sort $(MAKE_VERSION) 3.82)))
+  SEPARATOR=
+else
+  SEPARATOR=/
+endif
+
 to_keep_list=$(subst :, ,$(to_keep))
 obj-y += $(lib-y)
 obj-m += $(lib-m)
@@ -31,4 +38,4 @@
 	@echo -n $(addprefix $(objdir),$(@:.o=.ko)); echo -n "="
 	@echo $(addprefix $(objdir),$(if $($(@:.o=-objs)),$($(@:.o=-objs)),$@))
 $(subdirs):
-	@$(MAKE) -s -f $(firstword $(MAKEFILE_LIST)) objdir=$(objdir)$@ config=$(config) srcdir=$(srcdir)$@ to_keep=$(to_keep) print 2>/dev/null
+	@$(MAKE) -s -f $(firstword $(MAKEFILE_LIST)) objdir=$(objdir)$@$(SEPARATOR) config=$(config) srcdir=$(srcdir)$@$(SEPARATOR) to_keep=$(to_keep) print 2>/dev/null
--- a/processor.mk	Thu Feb 09 13:34:55 2012 +0100
+++ b/processor.mk	Thu Jun 21 16:29:32 2012 +0900
@@ -1,4 +1,4 @@
-PROCESSOR=$(shell uname -p)
+PROCESSOR=$(shell uname -m)
 PROCESSOR_x86_64=64
 PROCESSOR_i686=32
 PROCESSOR_i586=32
--- a/sim/defconfig	Thu Feb 09 13:34:55 2012 +0100
+++ b/sim/defconfig	Thu Jun 21 16:29:32 2012 +0900
@@ -87,7 +87,7 @@
 # CONFIG_DEFAULT_WESTWOOD is not set
 CONFIG_DEFAULT_RENO=y
 CONFIG_DEFAULT_TCP_CONG="reno"
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_PRIVACY=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
--- a/sim/security.c	Thu Feb 09 13:34:55 2012 +0100
+++ b/sim/security.c	Thu Jun 21 16:29:32 2012 +0900
@@ -7,7 +7,9 @@
 {
   switch (cap)
   {
-    case CAP_NET_RAW: return 1;
+    case CAP_NET_RAW:
+    case CAP_NET_BIND_SERVICE:
+	 return 1;
 
     default: break;
   }
--- a/sim/sim-socket.c	Thu Feb 09 13:34:55 2012 +0100
+++ b/sim/sim-socket.c	Thu Jun 21 16:29:32 2012 +0900
@@ -38,7 +38,7 @@
   size_t size = 0;
   for (i = 0; i < msg->msg_iovlen; i++)
     {
-      size += msg->msg_iov->iov_len;
+      size += msg->msg_iov[i].iov_len;
     }
   return size;
 }
@@ -47,9 +47,13 @@
   struct socket *kernel_socket = (struct socket *)socket;
   struct iovec *kernel_iov = copy_iovec (msg->msg_iov, msg->msg_iovlen);
   struct iovec *user_iov = msg->msg_iov;
+  struct cmsghdr *user_cmsgh = msg->msg_control;
+  size_t user_cmsghlen = msg->msg_controllen;
   msg->msg_iov = kernel_iov;
   int retval = sock_recvmsg (kernel_socket, msg, iov_size (msg), flags);
   msg->msg_iov = user_iov;
+  msg->msg_control = user_cmsgh;
+  msg->msg_controllen = user_cmsghlen - msg->msg_controllen;
   sim_free (kernel_iov);
   return retval;
 }