struct socket *netcslistenlocal(int type, struct sockaddr *name, socklen_t namelen, void (*func)(struct socket *, struct socket *, void *), void *data)
{
struct socket *sk;
+ int intbuf;
/* I don't know if this is actually correct (it probably isn't),
* but since, at on least Linux systems, PF_* are specifically
if((sk = mksock(name->sa_family, type)) == NULL)
return(NULL);
sk->state = SOCK_LST;
+ if(confgetint("net", "reuseaddr"))
+ {
+ intbuf = 1;
+ setsockopt(sk->fd, SOL_SOCKET, SO_REUSEADDR, &intbuf, sizeof(intbuf));
+ }
if(bind(sk->fd, name, namelen) < 0)
{
putsock(sk);