summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/socket.h2
-rw-r--r--include/socketengine.h3
-rw-r--r--src/inspsocket.cpp2
-rw-r--r--src/listensocket.cpp2
-rw-r--r--src/modules/m_ident.cpp5
-rw-r--r--src/socket.cpp2
-rw-r--r--src/socketengine.cpp4
7 files changed, 10 insertions, 10 deletions
diff --git a/include/socket.h b/include/socket.h
index 6a0cc88ad..f79d9166e 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -34,7 +34,6 @@
#endif
#include <cerrno>
-#include "socketengine.h"
/* Contains irc-specific definitions */
namespace irc
@@ -124,6 +123,7 @@ namespace irc
}
}
+#include "socketengine.h"
/** This class handles incoming connections on client ports.
* It will create a new User for every valid connection
* and assign it a file descriptor.
diff --git a/include/socketengine.h b/include/socketengine.h
index b411b394a..9240c3a43 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -18,6 +18,7 @@
#include <string>
#include <map>
#include "inspircd_config.h"
+#include "socket.h"
#include "base.h"
/** Types of event an EventHandler may receive.
@@ -439,7 +440,7 @@ public:
* This function should emulate its namesake system call exactly.
* @return This method should return exactly the same values as the system call it emulates.
*/
- int Bind(int fd, const sockaddr *my_addr, socklen_t addrlen);
+ int Bind(int fd, const irc::sockets::sockaddrs& addr);
/** Abstraction for BSD sockets listen(2).
* This function should emulate its namesake system call exactly.
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 59f814cc9..6b3583a6a 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -90,7 +90,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const irc::sockets::sockaddrs&
if (bind.sa.sa_family != 0)
{
- if (ServerInstance->SE->Bind(fd, &bind.sa, sa_size(bind)) < 0)
+ if (ServerInstance->SE->Bind(fd, bind) < 0)
return I_ERR_BIND;
}
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 676898647..f0daf8ef0 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -36,7 +36,7 @@ ListenSocket::ListenSocket(ConfigTag* tag, const std::string& addr, int port)
if (this->fd > -1)
{
ServerInstance->SE->SetReuse(fd);
- int rv = ServerInstance->SE->Bind(this->fd, &bind_to.sa, sizeof(bind_to));
+ int rv = ServerInstance->SE->Bind(this->fd, bind_to);
if (rv >= 0)
rv = ServerInstance->SE->Listen(this->fd, ServerInstance->Config->MaxConn);
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index fbd7706fe..ad62c77f9 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -83,7 +83,6 @@ class IdentRequestSocket : public EventHandler
IdentRequestSocket(LocalUser* u) : user(u), result(u->ident)
{
age = ServerInstance->Time();
- socklen_t size = 0;
SetFd(socket(user->server_sa.sa.sa_family, SOCK_STREAM, 0));
@@ -110,7 +109,7 @@ class IdentRequestSocket : public EventHandler
}
/* Attempt to bind (ident requests must come from the ip the query is referring to */
- if (ServerInstance->SE->Bind(GetFd(), &bindaddr.sa, size) < 0)
+ if (ServerInstance->SE->Bind(GetFd(), bindaddr) < 0)
{
this->Close();
throw ModuleException("failed to bind()");
@@ -119,7 +118,7 @@ class IdentRequestSocket : public EventHandler
ServerInstance->SE->NonBlocking(GetFd());
/* Attempt connection (nonblocking) */
- if (ServerInstance->SE->Connect(this, &connaddr.sa, size) == -1 && errno != EINPROGRESS)
+ if (ServerInstance->SE->Connect(this, &connaddr.sa, connaddr.sa_size()) == -1 && errno != EINPROGRESS)
{
this->Close();
throw ModuleException("connect() failed");
diff --git a/src/socket.cpp b/src/socket.cpp
index eb47c9cc8..049d3a237 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -36,7 +36,7 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten)
else if (!irc::sockets::aptosa(addr, port, servaddr))
return false;
- ret = SE->Bind(sockfd, &servaddr.sa, sa_size(servaddr));
+ ret = SE->Bind(sockfd, servaddr);
if (ret < 0)
{
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 478400d1b..b442732f5 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -197,9 +197,9 @@ int SocketEngine::Shutdown(EventHandler* fd, int how)
return shutdown(fd->GetFd(), how);
}
-int SocketEngine::Bind(int fd, const sockaddr *my_addr, socklen_t addrlen)
+int SocketEngine::Bind(int fd, const irc::sockets::sockaddrs& addr)
{
- return bind(fd, my_addr, addrlen);
+ return bind(fd, &addr.sa, addr.sa_size());
}
int SocketEngine::Listen(int sockfd, int backlog)