/*
net_socket.c -- Handle various kinds of sockets.
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-2013 Guus Sliepen <guus@tinc-vpn.org>
+ 2000-2014 Guus Sliepen <guus@meshlink.io>
2006 Scott Lamb <slamb@slamb.org>
2009 Florian Forster <octo@verplant.org>
#include "conf.h"
#include "connection.h"
-#include "control_common.h"
#include "list.h"
#include "logger.h"
#include "meta.h"
-#include "names.h"
#include "net.h"
#include "netutl.h"
#include "protocol.h"
listen_socket_t listen_socket[MAXSOCKETS];
int listen_sockets;
-#ifndef HAVE_MINGW
-io_t unix_socket;
-#endif
list_t *outgoing_list = NULL;
/* Setup sockets */
setenv("REMOTEPORT", port, true);
setenv("NODE", c->name, true);
setenv("NAME", myself->name, true);
- if(netname)
- setenv("NETNAME", netname, true);
int result = system(command);
if(result < 0)
send_id(c);
}
-#ifndef HAVE_MINGW
-/*
- accept a new UNIX socket connection
-*/
-void handle_new_unix_connection(void *data, int flags) {
- io_t *io = data;
- connection_t *c;
- sockaddr_t sa;
- int fd;
- socklen_t len = sizeof sa;
-
- fd = accept(io->fd, &sa.sa, &len);
-
- if(fd < 0) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Accepting a new connection failed: %s", sockstrerror(sockerrno));
- return;
- }
-
- sockaddrunmap(&sa);
-
- c = new_connection();
- c->name = xstrdup("<control>");
- c->address = sa;
- c->hostname = xstrdup("localhost port unix");
- c->socket = fd;
- c->last_ping_time = now.tv_sec;
-
- logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Connection from %s", c->hostname);
-
- io_add(&c->io, handle_meta_io, c, c->socket, IO_READ);
-
- connection_add(c);
-
- c->allow_request = ID;
-
- send_id(c);
-}
-#endif
-
static void free_outgoing(outgoing_t *outgoing) {
timeout_del(&outgoing->ev);