]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
UNIX domain IPC sockets support
authorhno <>
Fri, 5 Apr 2002 06:59:25 +0000 (06:59 +0000)
committerhno <>
Fri, 5 Apr 2002 06:59:25 +0000 (06:59 +0000)
Centralised the IPC type selection to defines.h by the defines IPC_STREAM
and IPC_DGRAM.

configure.in
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/ntlm/auth_ntlm.cc
src/defines.h
src/dns.cc
src/fs/diskd/store_dir_diskd.cc
src/icmp.cc
src/ipc.cc
src/redirect.cc
src/unlinkd.cc

index 1c794bd22d1a785d017958868eb0c2a13a0f9a5e..ad2d38c2d9aa8ecc93e3ad5b87ae4eb0e4bc326a 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.259 2002/04/01 13:06:28 hno Exp $
+dnl  $Id: configure.in,v 1.260 2002/04/04 23:59:25 hno Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AC_INIT(src/main.c)
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 2.6-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.259 $)dnl
+AC_REVISION($Revision: 1.260 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -1612,6 +1612,7 @@ AC_CHECK_FUNCS(\
        setsid \
        sigaction \
        snprintf \
+       socketpair \
        srand48 \
        srandom \
        statfs \
index b45faa261f46d50a5425ce23b5cf474d768febec..ff57cad4320bec680089c03df60065829b6a88ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth_basic.cc,v 1.14 2001/10/24 05:26:12 hno Exp $
+ * $Id: auth_basic.cc,v 1.15 2002/04/04 23:59:26 hno Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -543,7 +543,7 @@ authBasicInit(authScheme * scheme)
            basicauthenticators = helperCreate("basicauthenticator");
        basicauthenticators->cmdline = basicConfig->authenticate;
        basicauthenticators->n_to_start = basicConfig->authenticateChildren;
-       basicauthenticators->ipc_type = IPC_TCP_SOCKET;
+       basicauthenticators->ipc_type = IPC_STREAM;
        helperOpenServers(basicauthenticators);
        if (!init) {
            cachemgrRegister("basicauthenticator",
index dc2d12ca3380c828b83323f892cf506e48f4c43f..d9a73af734eb8d8c2449de09f12fa180e6b41b01 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_digest.cc,v 1.11 2002/01/13 01:08:44 robertc Exp $
+ * $Id: auth_digest.cc,v 1.12 2002/04/04 23:59:27 hno Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Robert Collins
@@ -881,7 +881,7 @@ authDigestInit(authScheme * scheme)
            digestauthenticators = helperCreate("digestauthenticator");
        digestauthenticators->cmdline = digestConfig->authenticate;
        digestauthenticators->n_to_start = digestConfig->authenticateChildren;
-       digestauthenticators->ipc_type = IPC_TCP_SOCKET;
+       digestauthenticators->ipc_type = IPC_STREAM;
        helperOpenServers(digestauthenticators);
        if (!init) {
            cachemgrRegister("digestauthenticator", "User Authenticator Stats",
index 1b9246413812955863773097344c8c59dc4e6e1b..3b64922a7b24cc5c8d66ce9a5a7946b9bb7f296f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_ntlm.cc,v 1.18 2002/02/18 23:32:53 hno Exp $
+ * $Id: auth_ntlm.cc,v 1.19 2002/04/04 23:59:27 hno Exp $
  *
  * DEBUG: section 29    NTLM Authenticator
  * AUTHOR: Robert Collins
@@ -242,7 +242,7 @@ authNTLMInit(authScheme * scheme)
        assert(proxy_auth_cache);
        ntlmauthenticators->cmdline = ntlmConfig->authenticate;
        ntlmauthenticators->n_to_start = ntlmConfig->authenticateChildren;
-       ntlmauthenticators->ipc_type = IPC_TCP_SOCKET;
+       ntlmauthenticators->ipc_type = IPC_STREAM;
        ntlmauthenticators->datapool = ntlm_helper_state_pool;
        ntlmauthenticators->IsAvailable = authenticateNTLMHelperServerAvailable;
        ntlmauthenticators->OnEmptyQueue = authenticateNTLMHelperServerOnEmpty;
index 8eadc43a3662508322ad6aab4580481e9b8f8b01..76699c2f177c5a8f9a1c1ba656a70ffed8e53ab3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.99 2002/02/26 15:48:14 adrian Exp $
+ * $Id: defines.h,v 1.100 2002/04/04 23:59:25 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 #define IPC_TCP_SOCKET 1
 #define IPC_UDP_SOCKET 2
 #define IPC_FIFO 3
+#define IPC_UNIX_STREAM 4
+#define IPC_UNIX_DGRAM 5
+
+#if HAVE_SOCKETPAIR && defined (AF_UNIX)
+#define IPC_STREAM IPC_UNIX_STREAM
+#define IPC_DGRAM IPC_UNIX_DGRAM
+#else
+#define IPC_STREAM IPC_TCP_SOCKET
+#define IPC_DGRAM IPC_UDP_SOCKET
+#endif
 
 #define STORE_META_KEY STORE_META_KEY_MD5
 
index 03524999f37dfb329329581441b2a293f494a1bf..600bfdcda5bc152bd2b4e17896612e1b890ffd67 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns.cc,v 1.86 2001/03/13 23:22:42 wessels Exp $
+ * $Id: dns.cc,v 1.87 2002/04/04 23:59:25 hno Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -54,7 +54,7 @@ dnsInit(void)
     if (dnsservers == NULL)
        dnsservers = helperCreate("dnsserver");
     dnsservers->n_to_start = Config.dnsChildren;
-    dnsservers->ipc_type = IPC_TCP_SOCKET;
+    dnsservers->ipc_type = IPC_STREAM;
     assert(dnsservers->cmdline == NULL);
     wordlistAdd(&dnsservers->cmdline, Config.Program.dnsserver);
     if (Config.onoff.res_defnames)
index a5ff2178e9b1d27625943d3643c94a6cbc5e70e2..ca69be98db47cbb5c002698b9cdbc9a507edb291 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.60 2002/04/01 21:53:21 hno Exp $
+ * $Id: store_dir_diskd.cc,v 1.61 2002/04/04 23:59:28 hno Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -410,12 +410,7 @@ storeDiskdDirInit(SwapDir * sd)
     args[2] = skey2;
     args[3] = skey3;
     args[4] = NULL;
-#if HAVE_POLL && defined(_SQUID_OSF_)
-    /* pipes and poll() don't get along on DUNIX -DW */
-    x = ipcCreate(IPC_TCP_SOCKET,
-#else
-    x = ipcCreate(IPC_FIFO,
-#endif
+    x = ipcCreate(IPC_STREAM,
        Config.Program.diskd,
        args,
        "diskd",
index 040d3ed95a0b86b8461a4c03e5261c5bce323f2e..3e7a69cd3e86f0332e22e27c958c570153679a9e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icmp.cc,v 1.74 2002/03/31 14:50:21 hno Exp $
+ * $Id: icmp.cc,v 1.75 2002/04/04 23:59:25 hno Exp $
  *
  * DEBUG: section 37    ICMP Routines
  * AUTHOR: Duane Wessels
@@ -196,7 +196,7 @@ icmpOpen(void)
     int wfd;
     args[0] = "(pinger)";
     args[1] = NULL;
-    x = ipcCreate(IPC_UDP_SOCKET,
+    x = ipcCreate(IPC_DGRAM,
        Config.Program.pinger,
        args,
        "Pinger Socket",
@@ -206,6 +206,7 @@ icmpOpen(void)
        return;
     assert(rfd == wfd);
     icmp_sock = rfd;
+    fd_note(icmp_sock, "pinger");
     commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0);
     commSetTimeout(icmp_sock, -1, NULL, NULL);
     debug(29, 1) ("Pinger socket opened on FD %d\n", icmp_sock);
index 756685260fc830143bf5777a0b518b04f35e5687..947b2822a3dc9f23346ca0741c93c6eff6c13feb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipc.cc,v 1.27 2001/12/24 15:33:43 adrian Exp $
+ * $Id: ipc.cc,v 1.28 2002/04/04 23:59:25 hno Exp $
  *
  * DEBUG: section 54    Interprocess Communication
  * AUTHOR: Duane Wessels
@@ -123,6 +123,29 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
        fd_open(cwfd = p2c[1], FD_PIPE, "IPC FIFO Child Write");
        fd_open(crfd = c2p[0], FD_PIPE, "IPC FIFO Child Read");
        fd_open(pwfd = c2p[1], FD_PIPE, "IPC FIFO Parent Write");
+#if HAVE_SOCKETPAIR && defined(AF_UNIX)
+    } else if (type == IPC_UNIX_STREAM) {
+       int fds[2];
+       int buflen = 32768;
+       if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
+           debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror());
+           return -1;
+       }
+       setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, (void *) &buflen, sizeof(buflen));
+       setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, (void *) &buflen, sizeof(buflen));
+       setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, (void *) &buflen, sizeof(buflen));
+       setsockopt(fds[1], SOL_SOCKET, SO_RCVBUF, (void *) &buflen, sizeof(buflen));
+       fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX STREAM Parent");
+       fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX STREAM Parent");
+    } else if (type == IPC_UNIX_DGRAM) {
+       int fds[2];
+       if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) < 0) {
+           debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror());
+           return -1;
+       }
+       fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX DGRAM Parent");
+       fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX DGRAM Parent");
+#endif
     } else {
        assert(IPC_NONE);
     }
index 60f11c50edd191a0e2fa21265f127fd6028436a6..c1364a5fdb1aa9963d31833c590982e794bc4b2c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.88 2001/03/03 10:39:33 hno Exp $
+ * $Id: redirect.cc,v 1.89 2002/04/04 23:59:25 hno Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -158,7 +158,7 @@ redirectInit(void)
        redirectors = helperCreate("redirector");
     redirectors->cmdline = Config.Program.redirect;
     redirectors->n_to_start = Config.redirectChildren;
-    redirectors->ipc_type = IPC_TCP_SOCKET;
+    redirectors->ipc_type = IPC_STREAM;
     helperOpenServers(redirectors);
     if (!init) {
        cachemgrRegister("redirector",
index 7d897759eaba38a729efba93f535f65fccc5985a..880d72a67c036cd7491d19475bb204c8b67d407d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: unlinkd.cc,v 1.45 2001/12/24 15:33:44 adrian Exp $
+ * $Id: unlinkd.cc,v 1.46 2002/04/04 23:59:26 hno Exp $
  *
  * DEBUG: section 12    Unlink Daemon
  * AUTHOR: Duane Wessels
@@ -165,8 +165,9 @@ unlinkdInit(void)
     args[1] = NULL;
 #if USE_POLL && defined(_SQUID_OSF_)
     /* pipes and poll() don't get along on DUNIX -DW */
-    x = ipcCreate(IPC_TCP_SOCKET,
+    x = ipcCreate(IPC_STREAM,
 #else
+    /* We currently need to use FIFO.. see below */
     x = ipcCreate(IPC_FIFO,
 #endif
        Config.Program.unlinkd,