X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspsocket.cpp;h=08b8f4cd698c2fa907b9d0f41494fd059c9210ff;hb=49369545e34e9d16d53c6c62eb8659a590af62ed;hp=f408de6ddaf6fe9fb94ab4418e48ecd3e0763524;hpb=706303e177d05afa6269d3a40cfde726854c52c3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index f408de6dd..08b8f4cd6 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -56,7 +56,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool this->IsIOHooked = false; if (listening) { - if ((this->fd = OpenTCPSocket()) == ERROR) + if ((this->fd = OpenTCPSocket(host)) == ERROR) { this->fd = -1; this->state = I_ERROR; @@ -65,7 +65,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool } else { - if (!SI->BindSocket(this->fd,this->client,this->server,aport,(char*)ipaddr.c_str())) + if (!SI->BindSocket(this->fd,aport,(char*)ipaddr.c_str())) { this->Close(); this->fd = -1; @@ -88,7 +88,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool } return; } - } + } } else { @@ -146,14 +146,14 @@ bool InspSocket::BindAddr() std::string IP = Conf.ReadValue("bind","address",j); if (Type == "servers") { - if ((IP != "*") && (IP != "127.0.0.1") && (IP != "")) + if ((IP != "*") && (IP != "127.0.0.1") && (IP != "") && (IP != "::1")) { insp_sockaddr s; if (insp_aton(IP.c_str(),&n) > 0) { #ifdef IPV6 - s.sin6_addr = n; + memcpy(&s.sin6_addr, &n, sizeof(n)); s.sin6_family = AF_FAMILY; #else s.sin_addr = n; @@ -192,7 +192,7 @@ bool InspSocket::DoConnect() insp_aton(this->IP,&addy); #ifdef IPV6 addr.sin6_family = AF_FAMILY; - memcpy(&addr.sin6_addr, &addy, sizeof(insp_inaddr)); + memcpy(&addr.sin6_addr, &addy, sizeof(addy)); addr.sin6_port = htons(this->port); #else addr.sin_family = AF_FAMILY; @@ -200,8 +200,7 @@ bool InspSocket::DoConnect() addr.sin_port = htons(this->port); #endif - int flags; - flags = fcntl(this->fd, F_GETFL, 0); + int flags = fcntl(this->fd, F_GETFL, 0); fcntl(this->fd, F_SETFL, flags | O_NONBLOCK); if (connect(this->fd, (sockaddr*)&this->addr,sizeof(this->addr)) == -1)