[IRCServices] Support request: Services cannot connect to IRCD, strerror error 22.

Dave Moore dave.j.moore at gmail.com
Tue Feb 14 12:23:32 PST 2006


Hello all. I am using IRCServices 5.0.57 on UltimateIRCd(Tsunami)-3.0(01),
though this problem occurs regardless of what IRCd is used. (Services never
makes it to the IRCd)

Following are a C&P of services' log, followed by the contents of socktest.c,
which is a socket testing program my buddy wrote (so he says) for me,
followed by the output of ./socktest.

I hope I've provided enough information, if anyone needs more information or
needs me to take any additional steps for further troubleshooting, that's no
problem at all.

Any help would be appreciated, thanks in advance.

Dave

Logs:
[Feb 14 20:12:25.677031 2006] IRC Services 5.0.57 starting up (options:
debug)
[Feb 14 20:12:25.722001 2006] debug: Loading language 0 from file
`languages/en_us'
[Feb 14 20:12:25.728089 2006] debug: Loading language 10 from file
`languages/nl'
[Feb 14 20:12:25.734271 2006] debug: Loading language 6 from file
`languages/fr'
[Feb 14 20:12:25.740649 2006] debug: Loading language 9 from file
`languages/de'
[Feb 14 20:12:25.747259 2006] debug: Loading language 11 from file
`languages/hu'
[Feb 14 20:12:25.753610 2006] debug: Loading language 8 from file
`languages/it'
[Feb 14 20:12:25.758795 2006] debug: Loading language 2 from file
`languages/ja_euc'
[Feb 14 20:12:25.764741 2006] debug: Loading language 3 from file
`languages/ja_sjis'
[Feb 14 20:12:25.770444 2006] debug: Loading language 5 from file
`languages/pt'
[Feb 14 20:12:25.779258 2006] debug: Loading language 12 from file
`languages/ru'
[Feb 14 20:12:25.785985 2006] debug: Loading language 4 from file
`languages/es'
[Feb 14 20:12:25.792501 2006] debug: Loading language 7 from file
`languages/tr'
[Feb 14 20:12:25.798826 2006] debug: Loaded languages
[Feb 14 20:12:25.802596 2006] debug: Loading module `protocol/bahamut'
[Feb 14 20:12:25.809033 2006] debug: Successfully loaded module
`protocol/bahamut'
[Feb 14 20:12:25.812829 2006] debug: Loading module `database/version4'
[Feb 14 20:12:25.821537 2006] debug: Successfully loaded module
`database/version4'
[Feb 14 20:12:25.825316 2006] debug: Loading module `mail/main'
[Feb 14 20:12:25.830547 2006] debug: Successfully loaded module `mail/main'
[Feb 14 20:12:25.834844 2006] debug: Loading module `mail/smtp'
[Feb 14 20:12:25.841417 2006] debug: Successfully loaded module `mail/smtp'
[Feb 14 20:12:25.844974 2006] debug: Loading module `operserv/main'
[Feb 14 20:12:25.852625 2006] debug: Successfully loaded module
`operserv/main'
[Feb 14 20:12:25.856821 2006] debug: Loading module `operserv/akill'
[Feb 14 20:12:25.862871 2006] debug: Successfully loaded module
`operserv/akill'
[Feb 14 20:12:25.866979 2006] debug: Loading module `operserv/news'
[Feb 14 20:12:25.872761 2006] debug: Successfully loaded module
`operserv/news'
[Feb 14 20:12:25.876803 2006] debug: Loading module `operserv/sessions'
[Feb 14 20:12:25.883016 2006] debug: Successfully loaded module
`operserv/sessions'
[Feb 14 20:12:25.888510 2006] debug: Loading module `operserv/sline'
[Feb 14 20:12:25.894708 2006] debug: Successfully loaded module
`operserv/sline'
[Feb 14 20:12:25.898628 2006] debug: Loading module `nickserv/main'
[Feb 14 20:12:25.910032 2006] debug: Successfully loaded module
`nickserv/main'
[Feb 14 20:12:25.913969 2006] debug: Loading module `nickserv/access'
[Feb 14 20:12:25.920316 2006] debug: Successfully loaded module
`nickserv/access'
[Feb 14 20:12:25.924218 2006] debug: Loading module `nickserv/link'
[Feb 14 20:12:25.930096 2006] debug: Successfully loaded module
`nickserv/link'
[Feb 14 20:12:25.933580 2006] debug: Loading module `nickserv/mail-auth'
[Feb 14 20:12:25.940245 2006] debug: Successfully loaded module
`nickserv/mail-auth'
[Feb 14 20:12:25.944046 2006] debug: Loading module `nickserv/sendpass'
[Feb 14 20:12:25.951050 2006] debug: Successfully loaded module
`nickserv/sendpass'
[Feb 14 20:12:25.954684 2006] debug: Loading module `chanserv/main'
[Feb 14 20:12:25.963185 2006] debug: Successfully loaded module
`chanserv/main'
[Feb 14 20:12:25.967062 2006] debug: Loading module `chanserv/access-levels'
[Feb 14 20:12:25.974581 2006] debug: Successfully loaded module
`chanserv/access-levels'
[Feb 14 20:12:25.978429 2006] debug: Loading module `chanserv/sendpass'
[Feb 14 20:12:25.984940 2006] debug: Successfully loaded module
`chanserv/sendpass'
[Feb 14 20:12:25.989298 2006] debug: Loading module `memoserv/main'
[Feb 14 20:12:25.996230 2006] debug: Successfully loaded module
`memoserv/main'
[Feb 14 20:12:25.999969 2006] debug: Loading module `memoserv/forward'
[Feb 14 20:12:26.006549 2006] debug: Successfully loaded module
`memoserv/forward'
[Feb 14 20:12:26.010419 2006] debug: Loading module `memoserv/ignore'
[Feb 14 20:12:26.014360 2006] debug: Successfully loaded module
`memoserv/ignore'
[Feb 14 20:12:26.015657 2006] debug: Loading module `statserv/main'
[Feb 14 20:12:26.020414 2006] debug: Successfully loaded module
`statserv/main'
[Feb 14 20:12:26.021535 2006] debug: Loading module `misc/helpserv'
[Feb 14 20:12:26.025979 2006] debug: Successfully loaded module
`misc/helpserv'
[Feb 14 20:12:26.026995 2006] debug: Loading module `httpd/main'
[Feb 14 20:12:26.031818 2006] httpd/main: Listening on 72.20.8.98:5347
[Feb 14 20:12:26.033102 2006] debug: Successfully loaded module `httpd/main'
[Feb 14 20:12:26.034463 2006] debug: Loading module `httpd/auth-ip'
[Feb 14 20:12:26.039295 2006] debug: Successfully loaded module
`httpd/auth-ip'
[Feb 14 20:12:26.040407 2006] debug: Loading module `httpd/auth-password'
[Feb 14 20:12:26.044648 2006] debug: Successfully loaded module
`httpd/auth-password'
[Feb 14 20:12:26.045835 2006] debug: Loading module `misc/xml-export'
[Feb 14 20:12:26.050744 2006] debug: Successfully loaded module
`misc/xml-export'
[Feb 14 20:12:26.051928 2006] debug: Loading module `misc/xml-import'
[Feb 14 20:12:26.057501 2006] debug: Successfully loaded module
`misc/xml-import'
[Feb 14 20:12:26.058620 2006] debug: Loaded modules
[Feb 14 20:12:26.068373 2006] FATAL: Can't connect to server (
72.20.8.98:8899): Invalid argument

--END LOG--

Code from socktest.c:
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <grp.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
#include <sys/time.h>

int conn(const char *host, int port, const char *lhost, int lport);
void disconn(int s);

int conn(const char *host, int port, const char *lhost, int lport)
{
struct hostent *hp;
struct sockaddr_in sa, lsa;
int sock;

printf("Conn() called\n");

memset(&lsa, 0, sizeof(lsa));
if (lhost) {
if ((hp = gethostbyname(lhost)) != NULL) {
memcpy((char *) &lsa.sin_addr, hp->h_addr, hp->h_length);
lsa.sin_family = hp->h_addrtype;
} else {
lhost = NULL;
}
}
if (lport)
lsa.sin_port = htons((unsigned short) lport);

printf("Conn() LocalHost stuff setup\n");

memset(&sa, 0, sizeof(sa));
if (!(hp = gethostbyname(host))) {
printf("Error during gethostbyname\n");
return -1;
}
printf("Conn() gethostbyname successful\n");

memcpy((char *) &sa.sin_addr, hp->h_addr, hp->h_length);
sa.sin_family = hp->h_addrtype;
sa.sin_port = htons((unsigned short) port);

printf("Conn() before socket call\n");

printf("Check sa family %d AF_INET %d\n", sa.sin_family, AF_INET);
printf("Check sa port %d %d htons check %d\n", port, sa.sin_port,
htons((unsigned short) port));
printf("Check sa address %s\n", inet_ntoa(sa.sin_addr));

if ((sock = socket(sa.sin_family, SOCK_STREAM, 0)) < 0) {
printf("Error during socket\n");
return -1;
}
printf("Conn() sock %d\n", sock);

if ((lhost || lport)
&& bind(sock, (struct sockaddr *) &lsa, sizeof(lsa)) < 0) {
close(sock);
printf("Error during bind\n");
return -1;
}

if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
printf("Error during connect\n");
printf("Errno is %d\n", errno);
printf("strerror says %s\n", strerror(errno));
printf("Check sizeof(sa) %ld\n", sizeof(sa));
printf("Check socket %d\n", sock);
printf("Check sa family %d AF_INET %d\n", sa.sin_family, AF_INET);
printf("Check sa port %d\n", sa.sin_port);
printf("Check sa address %s\n", inet_ntoa(sa.sin_addr));

close(sock);
return -1;
}
printf("Successful sock value %d", sock);
return sock;
}

/*************************************************************************/

void disconn(int s)
{
shutdown(s, 2);
close(s);
}

int main(int ac, char **av, char **envp)
{
int s;
printf("Calling conn()\n");
s = conn("72.20.8.98", 8899, "72.20.8.98", 8891);
printf("after conn()\n");
disconn(s);
printf("exit\n");
return 0;
}


--END OF socktest.c--


And, finally, the output from socktest.c:

Calling conn()
Conn() called
Conn() LocalHost stuff setup
Conn() gethostbyname successful
Conn() before socket call
Check sa family 2 AF_INET 2
Check sa port 8899 49954 htons check 49954
Check sa address 72.20.8.98
Conn() sock 3
Error during connect
Errno is 22
strerror says Invalid argument
Check sizeof(sa) 16
Check socket 3
Check sa family 2 AF_INET 2
Check sa port 49954
Check sa address 72.20.8.98
after conn()
exit

--END OF socktest output--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: ../attachments/20060214/a368be7a/attachment-0001.html