]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_tcp.c
Merge remote branch 'sf/product-2-2' into develop
[netatalk.git] / libatalk / dsi / dsi_tcp.c
index 01aca6f7f39826a8a1c81e2dfbd96c1418ac5300..2c16323e2d607884e60ceff2dc6371b3f0a92a7b 100644 (file)
@@ -10,8 +10,6 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#define USE_TCP_NODELAY
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -98,7 +96,7 @@ static int dsi_tcp_open(DSI *dsi)
 #ifdef TCPWRAP
     {
         struct request_info req;
-        request_init(&req, RQ_DAEMON, dsi->program, RQ_FILE, dsi->socket, NULL);
+        request_init(&req, RQ_DAEMON, "afpd", RQ_FILE, dsi->socket, NULL);
         fromhost(&req);
         if (!hosts_access(&req)) {
             LOG(deny_severity, logtype_dsi, "refused connect from %s", eval_client(&req));
@@ -119,9 +117,6 @@ static int dsi_tcp_open(DSI *dsi)
         uint8_t block[DSI_BLOCKSIZ];
         size_t stored;
 
-        /* Immediateyl mark globally that we're a child now */
-        parent_or_child = 1;
-
         /* reset signals */
         server_reset_signal();
 
@@ -252,9 +247,10 @@ static void guess_interface(DSI *dsi, const char *hostname, const char *port)
             getip_string((struct sockaddr *)&dsi->server), port, ifr.ifr_name);
         goto iflist_done;
     }
-    LOG(log_info, logtype_dsi, "dsi_tcp (Chooser will not select afp/tcp) "
-        "Check to make sure %s is in /etc/hosts and the correct domain is in "
-        "/etc/resolv.conf: %s", hostname, strerror(errno));
+
+    LOG(log_note, logtype_dsi, "dsi_tcp: couldn't find network interface with IP address to advertice, "
+        "check to make sure \"%s\" is in /etc/hosts or can be resolved with DNS, or "
+        "add a netinterface that is not a loopback or point-2-point type", hostname);
 
 iflist_done:
     close(fd);
@@ -270,7 +266,7 @@ iflist_done:
 int dsi_tcp_init(DSI *dsi, const char *hostname, const char *inaddress, const char *inport)
 {
     EC_INIT;
-    int                flag;
+    int                flag, err;
     char               *a = NULL, *b;
     const char         *address;
     const char         *port;
@@ -331,13 +327,11 @@ int dsi_tcp_init(DSI *dsi, const char *hostname, const char *inaddress, const ch
         setsockopt(dsi->serversock, IPPROTO_IPV6, IPV6_BINDV6ONLY, (char *)&on, sizeof (on));
 #endif
 
-#ifdef USE_TCP_NODELAY
 #ifndef SOL_TCP
 #define SOL_TCP IPPROTO_TCP
 #endif
         flag = 1;
         setsockopt(dsi->serversock, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
-#endif /* USE_TCP_NODELAY */
             
         if (bind(dsi->serversock, p->ai_addr, p->ai_addrlen) == -1) {
             close(dsi->serversock);
@@ -380,8 +374,8 @@ int dsi_tcp_init(DSI *dsi, const char *hostname, const char *inaddress, const ch
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
 
-    if ((ret = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) {
-        LOG(log_info, logtype_dsi, "dsi_tcp_init: getaddrinfo '%s': %s\n", hostname, gai_strerror(ret));
+    if ((err = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) {
+        LOG(log_info, logtype_dsi, "dsi_tcp_init: getaddrinfo '%s': %s\n", hostname, gai_strerror(err));
         goto interfaces;
     }