Re: Debug messages from commBind with "(22) Invalid argument"

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 09 Nov 1999 22:56:55 +0100

And here is the patch ;-)

Henrik Nordstrom wrote:
>
> John Holman wrote:
> >
> > Upgraded to squid 2.2STABLE5 yesterday on a Sparc machine
> > running Solaris 2.5.1. Generally it seems to be working OK, but there
> > are frequent debug messages in cache.log from commBind() - e.g.
> >
> > 1999/11/09 10:46:55| commBind: Cannot bind socket FD 75 to 138.37.7.252:0: (22)
> > Invalid argument
>
> valko@linux.karinthy.hu reported problems with bind() in Solaris some
> time back (think it too was Solaris 2.5.1). You could try the attached
> patch (which technically shouldn't change anything), or avoid the use of
> tcp_*_address settings on affected Solaris releases.
>
> --
> Henrik Nordstrom
> Squid hacker

Index: squid/src/comm.c
diff -u squid/src/comm.c:1.1.1.35.2.1 squid/src/comm.c:1.1.1.35.2.2
--- squid/src/comm.c:1.1.1.35.2.1 Sun Oct 24 21:20:10 1999
+++ squid/src/comm.c Sun Oct 24 22:55:06 1999
@@ -305,6 +305,18 @@
         fdAdjustReserved();
         return 0;
     }
+ /*
+ * yuck, this has assumptions about comm_open() arguments for
+ * the original socket
+ */
+ if (Config.Addrs.tcp_outgoing.s_addr != no_addr.s_addr) {
+ if (commBind(fd2, Config.Addrs.tcp_outgoing, 0) != COMM_OK) {
+ return 0;
+ }
+ }
+ /*
+ * Move the new socket to the old filedescriptor
+ */
     if (dup2(fd2, cs->fd) < 0) {
         debug(5, 0) ("commResetFD: dup2: %s\n", xstrerror());
         fdAdjustReserved();
@@ -313,15 +325,10 @@
     close(fd2);
     fd_table[cs->fd].flags.called_connect = 0;
     /*
- * yuck, this has assumptions about comm_open() arguments for
+ * yuck, this has more assumptions about comm_open() arguments for
      * the original socket
      */
     commSetCloseOnExec(cs->fd);
- if (Config.Addrs.tcp_outgoing.s_addr != no_addr.s_addr) {
- if (commBind(cs->fd, Config.Addrs.tcp_outgoing, 0) != COMM_OK) {
- return 0;
- }
- }
     commSetNonBlocking(cs->fd);
 #ifdef TCP_NODELAY
     commSetTcpNoDelay(cs->fd);
Received on Tue Nov 09 1999 - 15:09:20 MST

This archive was generated by hypermail pre-2.1.9 : Wed Apr 09 2008 - 11:57:32 MDT