[ds6-devel] Re: [nc6-commit] nc6/src connection.h, 1.18, 1.19 misc.c, 1.21, 1.22 misc.h, 1.20, 1.21 network.c, 1.48, 1.49 parser.c, 1.56, 1.57

Chris Leishman chris at leishman.org
Thu Jan 8 23:30:41 CET 2004


On Thu, Jan 08, 2004 at 06:18:56PM +0100, mauro at deepspace6.net wrote:
> Update of /cvs/nc6/src
> 
> Modified Files:
> 	connection.h misc.c misc.h network.c parser.c 
> Log Message:
> added bluez support. used SOMAXCONN as the backlog parameter in listen(2). cleaned up definition of the long_options array.

Hi Mauro!

Couple of comments:

1. You should define SOMAXCONN using autoconf (patch attached - don't have my
ssh key handy).

2. Can you give a bit of detail on the bluetooth stuff?  I noticed that you
have defined totaly separate listen/connect function for IP and bluetooth -
why is this needed?  I would have thought the code was AF independant enough
(thats the points of AF independance).  Also, the name do_connect_ip isn't
really correct since it's generic code (not required to be just ip).

3. I don't see where HAVE_BLUEZ is defined?

Otherwise, hows things?

Regards,
Chris


-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /ds6/cvs/nc6/configure.ac,v
retrieving revision 1.30
diff -u -u -r1.30 configure.ac
--- configure.ac	18 Aug 2003 09:49:37 -0000	1.30
+++ configure.ac	8 Jan 2004 23:25:56 -0000
@@ -50,6 +50,7 @@
 TYPE_SOCKLEN_T
 TYPE_STRUCT_SOCKADDR_STORAGE(,
   [AC_MSG_ERROR([Your system does not support 'struct sockaddr_storage', which is needed to compile nc6])])
+DEFINED_SOMAXCONN(,AC_DEFINE([SOMAXCONN], 5, [Backlog for listen.]))
 
 
 dnl Configure IPv6 support
Index: src/misc.c
===================================================================
RCS file: /ds6/cvs/nc6/src/misc.c,v
retrieving revision 1.22
diff -u -u -r1.22 misc.c
--- src/misc.c	8 Jan 2004 17:18:54 -0000	1.22
+++ src/misc.c	8 Jan 2004 23:25:57 -0000
@@ -37,7 +37,9 @@
 #endif
 
 #ifdef HAVE_BLUEZ
+#ifdef HAVE_STDINT_H
 #include <stdint.h> /* needed for uint8_t */
+#endif
 #include <bluetooth/bluetooth.h>
 #endif
 
@@ -228,6 +230,8 @@
 	return ((int)res);
 }
 #endif
+
+
 
 #ifdef HAVE_BLUEZ
 int safe_ba2str(const bdaddr_t *ba, char *str, size_t strlen)
Index: src/network.c
===================================================================
RCS file: /ds6/cvs/nc6/src/network.c,v
retrieving revision 1.49
diff -u -u -r1.49 network.c
--- src/network.c	8 Jan 2004 17:18:54 -0000	1.49
+++ src/network.c	8 Jan 2004 23:25:58 -0000
@@ -52,13 +52,6 @@
 #define CONNECTION_TIMEOUT	-1
 #define CONNECTION_FAILED	-2
 
-/* for SOCK_STREAM and SOCK_SEQPACKET sockets, we need to listen for 
- * incoming connections. the backlog parameter is set to 5 for backward
- * compatibility (as it seems that at least some BSD-derived system limit 
- * the backlog parameter to this value). */
-#ifndef SOMAXCONN
-#define SOMAXCONN 5
-#endif
 
 static int connect_with_timeout(int fd, const struct sockaddr *sa, 
 		                socklen_t salen, int timeout);
--- /dev/null
+++ config/somaxconn_constant.m4	2004-01-09 09:35:14.000000000 +1100
@@ -0,0 +1,22 @@
+AC_DEFUN([DEFINED_SOMAXCONN],[
+  AC_CACHE_CHECK([if system defines SOMAXCONN],
+    [ds6_cv_defined_somaxconn],[
+    AC_TRY_CPP([
+#include <sys/socket.h>
+
+#ifndef SOMAXCONN
+#error Missing SOMAXCONN
+#endif
+    ],[
+      ds6_cv_defined_somaxconn=yes
+    ],[
+      ds6_cv_defined_somaxconn=no
+    ])
+  ])
+
+  if test "X$ds6_cv_defined_somaxconn" = "Xyes"; then :
+    $1
+  else :
+    $2
+  fi
+])


More information about the ds6-devel mailing list