/*
- * $Id: dsi_tcp.c,v 1.25 2009-12-08 22:34:37 didg Exp $
- *
* Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
*
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
#include <errno.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
-
-#ifdef HAVE_STDINT_H
#include <stdint.h>
-#endif /* HAVE_STDINT_H */
#include <sys/ioctl.h>
#ifdef TRU64
#include <atalk/dsi.h>
#include <atalk/compat.h>
#include <atalk/util.h>
-#include <netatalk/endian.h>
+
#include "dsi_private.h"
#define min(a,b) ((a) < (b) ? (a) : (b))
if (0 == (pid = fork()) ) { /* child */
static struct itimerval timer = {{0, 0}, {DSI_TCPTIMEOUT, 0}};
struct sigaction newact, oldact;
- u_int8_t block[DSI_BLOCKSIZ];
+ 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();
#define IFF_SLAVE 0
#endif
-static void guess_interface(DSI *dsi, const char *hostname)
+static void guess_interface(DSI *dsi, const char *hostname, const char *port)
{
int fd;
char **start, **list;
memset(&dsi->server, 0, sizeof(struct sockaddr_storage));
sa->sin_family = AF_INET;
- sa->sin_port = htons(548);
+ sa->sin_port = htons(atoi(port));
sa->sin_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
- LOG(log_info, logtype_dsi, "dsi_tcp: '%s' on interface '%s' will be used instead.",
- getip_string((struct sockaddr *)&dsi->server), ifr.ifr_name);
+ LOG(log_info, logtype_dsi, "dsi_tcp: '%s:%s' on interface '%s' will be used instead.",
+ 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) "
freeaddrinfo(servinfo);
interfaces:
- guess_interface(dsi, hostname);
+ guess_interface(dsi, hostname, port ? port : "548");
return 1;
}