projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweaking IPv6 support.
[tinc]
/
src
/
net_setup.c
diff --git
a/src/net_setup.c
b/src/net_setup.c
index
757121a
..
9393954
100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net_setup.c,v 1.1.2.
2 2002/02/20 16:04:39
guus Exp $
+ $Id: net_setup.c,v 1.1.2.
4 2002/02/20 22:15:32
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-221,7
+221,7
@@
int setup_myself(void)
subnet_t *subnet;
char *name, *mode, *afname, *cipher, *digest;
struct addrinfo hint, *ai;
subnet_t *subnet;
char *name, *mode, *afname, *cipher, *digest;
struct addrinfo hint, *ai;
- int choice;
+ int choice
, err
;
cp
myself = new_node();
myself->connection = new_connection();
cp
myself = new_node();
myself->connection = new_connection();
@@
-382,6
+382,8
@@
cp
else
myself->keylength = 1;
else
myself->keylength = 1;
+ myself->connection->outcipher = EVP_bf_ofb();
+
myself->key = (char *)xmalloc(myself->keylength);
RAND_pseudo_bytes(myself->key, myself->keylength);
myself->key = (char *)xmalloc(myself->keylength);
RAND_pseudo_bytes(myself->key, myself->keylength);
@@
-410,6
+412,8
@@
cp
else
myself->digest = EVP_sha1();
else
myself->digest = EVP_sha1();
+ myself->connection->outdigest = EVP_sha1();
+
if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->maclength))
{
if(myself->digest)
if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->maclength))
{
if(myself->digest)
@@
-429,6
+433,8
@@
cp
else
myself->maclength = 4;
else
myself->maclength = 4;
+ myself->connection->outmaclength = 0;
+
/* Compression */
if(get_config_int(lookup_config(myself->connection->config_tree, "Compression"), &myself->compression))
/* Compression */
if(get_config_int(lookup_config(myself->connection->config_tree, "Compression"), &myself->compression))
@@
-441,6
+447,8
@@
cp
}
else
myself->compression = 0;
}
else
myself->compression = 0;
+
+ myself->connection->outcompression = 0;
cp
/* Done */
cp
/* Done */
@@
-454,14
+462,16
@@
cp
cp
/* Open sockets */
cp
/* Open sockets */
+ memset(&hint, 0, sizeof(hint));
+
hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
- if(
getaddrinfo(NULL, myport, &hint, &ai
) || !ai)
+ if(
(err = getaddrinfo(NULL, myport, &hint, &ai)
) || !ai)
{
{
- syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo",
strerror(errno
));
+ syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo",
gai_strerror(err
));
return -1;
}
return -1;
}
@@
-473,14
+483,12
@@
cp
freeaddrinfo(ai);
freeaddrinfo(ai);
- hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_DGRAM;
hint.ai_protocol = IPPROTO_UDP;
hint.ai_socktype = SOCK_DGRAM;
hint.ai_protocol = IPPROTO_UDP;
- hint.ai_flags = AI_PASSIVE;
- if(
getaddrinfo(NULL, myport, &hint, &ai
) || !ai)
+ if(
(err = getaddrinfo(NULL, myport, &hint, &ai)
) || !ai)
{
{
- syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo",
strerror(errno
));
+ syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo",
gai_strerror(err
));
return -1;
}
return -1;
}