- Change SA_LEN to SALEN, former one is already defined on some platforms.
[tinc] / src / net_socket.c
index 93314fb..6cf69f2 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net_socket.c,v 1.1.2.1 2002/02/18 16:25:16 guus Exp $
+    $Id: net_socket.c,v 1.1.2.3 2002/02/20 22:37:38 guus Exp $
 */
 
 #include "config.h"
@@ -116,7 +116,7 @@ cp
       }
 #endif
 
-  if(bind(nfd, &sa->sa, sizeof(*sa)))
+  if(bind(nfd, &sa->sa, SALEN(sa->sa)))
     {
       close(nfd);
       addrstr = sockaddr2hostname(sa);
@@ -170,7 +170,7 @@ cp
       }
 #endif
 
-  if(bind(nfd, &sa->sa, sizeof(*sa)))
+  if(bind(nfd, &sa->sa, SALEN(sa->sa)))
     {
       close(nfd);
       addrstr = sockaddr2hostname(sa);
@@ -228,10 +228,10 @@ cp
 
   /* Connect */
 
-  if(connect(c->socket, &c->address.sa, sizeof(c->address)) == -1)
+  if(connect(c->socket, &c->address.sa, SALEN(c->address.sa)) == -1)
     {
       close(c->socket);
-      syslog(LOG_ERR, _("%s: %s"), c->hostname, strerror(errno));
+      syslog(LOG_ERR, _("Error while connecting to %s (%s): %s"), c->name, c->hostname, strerror(errno));
       return -1;
     }
 
@@ -334,7 +334,7 @@ begin:
 
   /* Connect */
 
-  result = connect(c->socket, &c->address.sa, sizeof(c->address));
+  result = connect(c->socket, &c->address.sa, SALEN(c->address.sa));
 
   if(result == -1)
     {
@@ -375,6 +375,10 @@ cp
 
   c = new_connection();
   c->name = xstrdup(outgoing->name);
+  c->outcipher = myself->connection->outcipher;
+  c->outdigest = myself->connection->outdigest;
+  c->outmaclength = myself->connection->outmaclength;
+  c->outcompression = myself->connection->outcompression;
 
   init_configuration(&c->config_tree);
   read_connection_config(c);
@@ -415,6 +419,10 @@ cp
     }
 
   c = new_connection();
+  c->outcipher = myself->connection->outcipher;
+  c->outdigest = myself->connection->outdigest;
+  c->outmaclength = myself->connection->outmaclength;
+  c->outcompression = myself->connection->outcompression;
 
   c->address = sa;
   c->hostname = sockaddr2hostname(&sa);