Failed to set socket option

Jens-Uwe Walther Jens-Uwe.Walther at force.de
Mon Jan 29 16:40:15 GMT 2001


Hi,

I run a Veritas cluster server with two different samba's 2.0.7 compiled with SUNWspro 4.0 (gcc 2.95 leads to the same results)
on Solaris 7 UltraSPARC 60 server.
One compiled with --prefix=/opt/samba-test the other with --prefix=/opt/samba-eng.
To avoid using 127.0.0.1 or 0.0.0.0 when both smbd's running on the same cluster host I set this in both smbd.conf

/opt/samba-test/lib/smb.conf:

[global]
   workgroup            = FORCE
   server string        = Engineering Samba %v, Host: %h, your machine: %m
   netbios name = pollux
   interfaces = 10.254.1.22/16
   bind interfaces only = true
   preserve case = yes
   short preserve case = yes
   encrypt passwords = yes
   update encrypted = no
   null passwords = yes
   username map = /opt/samba-test/private/users.map
   password server = md-deu-force01 sr-deu-gold01 sr-deu-gold02 sr-deu-data04
   wins support       = no
   wins server = 199.182.40.12
   wins proxy         = no
   name resolve order = wins host bcast
   domain master = no
   local master     = no
   os level = 35
   nt acl support = yes
   unix password sync = yes
   passwd program = /bin/passwd %u
   passwd chat = *New*password* %n\n *new*password* %n\n *changed*
   passwd chat debug = yes
   security             = domain
   status               = yes
   printing             = sysv
   printcap name        = lpstat
   load printers        = yes
   guest account        = samba
   map to guest = Bad User
   default service    = reference
   log file             = /opt/samba-test/var/log.%m
   max log size         = 10
   debug level          = 1
   syslog = 0
   share modes          = yes
   message command      = csh -c 'cat %s > /dev/console;rm %s' &
   socket options     = TCP_NODELAY
   dead time            = 5
   sync always          = 1
   config file          = /opt/samba-test/lib/smb.conf.%m
   oplocks = yes
   fake oplocks = no
   read raw = yes
   write raw = yes
   read prediction = yes
   getwd cache = yes
   time server = yes

/opt/samba-eng/lib/smb.conf with only difference to above smb.conf:

   netbios name = castor
   interfaces = 10.254.1.21/16
   bind interfaces only = true
   socket address = 10.254.1.21
   ...
   log file             = /opt/samba-eng/var/log.%m
   ...
   config file          = /opt/samba-eng/lib/smb.conf.%m
   ...
   
 I set some additional debugging in lib/util_sock.c to get the full socket_option details.
 
 106  void set_socket_options(int fd, char *options)
   107  {
   108          fstring tok;
   109
   110          /* DEBUG */
   111          DEBUG(0,("in set_socket_options(%d, %s)\n", fd, options));
   112          /* DEBUG */
   113          DEBUG(0,("lib/util_sock.c: set_socket_options before &options(%d, %s)\n", fd, options));
   114
   115          while (next_token(&options,tok," \t,", sizeof(tok))) {
   116                  int ret=0,i;
   117                  int value = 1;
   118                  char *p;
   119                  BOOL got_value = False;
   120
   121
   122                  if ((p = strchr(tok,'='))) {
   123                          *p = 0;
   124                          value = atoi(p+1);
   125                          got_value = True;
   126                  }
   127
   128                  for (i=0;socket_options[i].name;i++) {
   129                          /* DEBUG */
   130                          DEBUG(0,("lib/util_sock.c: set_socket_options for ...(%d, %s,%d,%d,%d,%d)\n", fd, socket_options[i].
name,socket_options[i].level,socket_options[i].option,socket_options[i].value,socket_options[i].opttype));
   131                          if (strequal(socket_options[i].name,tok))
   132                                  break;
   133                  }
   134
   135                  if (!socket_options[i].name) {
   136                          DEBUG(0,("Unknown socket option %s\n",tok));
   137                          continue;
   138                  }
   139
   140                  switch (socket_options[i].opttype) {
   141                  case OPT_BOOL:
   142                  case OPT_INT:
   143                          ret = setsockopt(fd,socket_options[i].level,
   144                                                  socket_options[i].option,(char *)&value,sizeof(int));
   145                          break;
   146
47                  case OPT_ON:
   148                          if (got_value)
   149                                  DEBUG(0,("syntax error - %s does not take a value\n",tok));
   150
   151                          {
   152                                  int on = socket_options[i].value;
   153                                  ret = setsockopt(fd,socket_options[i].level,
   154                                                          socket_options[i].option,(char *)&on,sizeof(int));
   155                          }
   156                          break;
   157                  }
   158
   159                  if (ret != 0) {
   160                          /* DEBUG */
   161                          DEBUG(0,("lib/util_sock.c: set_socket_options if ...(%d, %s,%d,%d,%d,%d)\n", fd, socket_options[i].n
ame,socket_options[i].level,socket_options[i].option,socket_options[i].value,socket_options[i].opttype));
   162                          DEBUG(0,("Failed to set socket option %s (Error %s)\n",tok, strerror(errno) ));
   163                  }
   164          }
   165  }

 If I start smbd nothing special happens even if a client connects. Only if I change the configuration and send a SIGHUP then I 'll get "Failed 
to set socket option..."
 when a new client connects:
 
 smbd start ...

ha-castor(root)# tail -f log.smb
[2001/01/29 16:11:39, 1] smbd/server.c:(644)
  smbd version 2.0.7 started.
  Copyright Andrew Tridgell 1992-1998
[2001/01/29 16:11:39, 1] smbd/files.c:(216)
  file_init: Information only: requested 10000 open files, 1014 are available.

and first client connect

[2001/01/29 16:16:01, 0] lib/util_sock.c:(111)
  in set_socket_options(7, SO_KEEPALIVE)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, SO_KEEPALIVE)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(111)
  in set_socket_options(7, TCP_NODELAY)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, TCP_NODELAY)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_REUSEADDR,65535,4,0,0)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_BROADCAST,65535,32,0,0)
[2001/01/29 16:16:01, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, TCP_NODELAY,6,1,0,0)

some HUP to smbd nothing happens

[2001/01/29 16:18:46, 0] smbd/server.c:(345)
  Got SIGHUP
[2001/01/29 16:20:36, 0] smbd/server.c:(345)
  Got SIGHUP
[2001/01/29 16:21:12, 0] smbd/server.c:(345)
  Got SIGHUP
  
 client logged out, logged in again then connects to smbd

2001/01/29 16:22:24, 0] lib/util_sock.c:(111)
  in set_socket_options(7, SO_KEEPALIVE)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, SO_KEEPALIVE)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(161)
  lib/util_sock.c: set_socket_options if ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(162)
  Failed to set socket option SO_KEEPALIVE (Error Bad file number)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(111)
  in set_socket_options(7, TCP_NODELAY)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, TCP_NODELAY)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_REUSEADDR,65535,4,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_BROADCAST,65535,32,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, TCP_NODELAY,6,1,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(161)
  lib/util_sock.c: set_socket_options if ...(7, TCP_NODELAY,6,1,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(162)
  Failed to set socket option TCP_NODELAY (Error Bad file number)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(111)
  in set_socket_options(7, SO_KEEPALIVE)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, SO_KEEPALIVE)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(111)
  in set_socket_options(7, TCP_NODELAY)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(113)
  lib/util_sock.c: set_socket_options before &options(7, TCP_NODELAY)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_KEEPALIVE,65535,8,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_REUSEADDR,65535,4,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, SO_BROADCAST,65535,32,0,0)
[2001/01/29 16:22:24, 0] lib/util_sock.c:(130)
  lib/util_sock.c: set_socket_options for ...(7, TCP_NODELAY,6,1,0,0)

and sometimes (but very rarely) this leads even to:

[2001/01/25 12:03:30, 0] lib/fault.c:(40)
  ===============================================================
[2001/01/25 12:03:30, 0] lib/fault.c:(41)
  INTERNAL ERROR: Signal 11 in pid 23252 (2.0.7)
  Please read the file BUGS.txt in the distribution
[2001/01/25 12:03:30, 0] lib/fault.c:(43)
  ===============================================================
[2001/01/25 12:03:30, 0] lib/util.c:(2381)
  PANIC: internal error
[2001/01/25 12:03:30, 0] lib/fault.c:(40)

and the NT clients get "Network path not found" or something like this.

So at the moment I can only stop/start samba after configuration changes!
Any ideas? 

Thanks
	Uwe




 





More information about the samba mailing list