1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-08 23:06:56 +00:00
freebsd-ports/www/httptunnel/files/patch-aa
Brian Somers 71ab0b0f58 An implementation of TCP/IP over HTTP with local modifications to allow
binding the server to a single IP number.
2000-03-21 01:18:06 +00:00

49 lines
1.2 KiB
Plaintext

--- common.c.orig Wed Dec 15 06:39:03 1999
+++ common.c Thu Mar 16 02:48:06 2000
@@ -115,7 +115,7 @@
#endif
int
-server_socket (int port, int backlog)
+server_socket (struct in_addr addr, int port, int backlog)
{
struct sockaddr_in address;
int i, s;
@@ -131,10 +131,12 @@
strerror (errno));
}
+ memset(&address, '\0', sizeof address);
+ address.sin_len = sizeof address;
address.sin_family = PF_INET;
address.sin_port = htons ((short)port);
- address.sin_addr.s_addr = INADDR_ANY;
-
+ address.sin_addr = addr;
+
if (bind (s, (struct sockaddr *)&address, sizeof (address)) == -1)
{
close (s);
@@ -153,8 +155,10 @@
int
set_address (struct sockaddr_in *address, const char *host, int port)
{
- address->sin_family = PF_INET;
- address->sin_port = htons ((short)port);
+ memset(address, '\0', sizeof *address);
+ address->sin_len = sizeof *address;
+ address->sin_family = AF_INET;
+ address->sin_port = htons((u_short)port);
address->sin_addr.s_addr = inet_addr (host);
if (address->sin_addr.s_addr == INADDR_NONE)
@@ -334,7 +338,7 @@
p = strchr (*name, ':');
if (p != NULL)
{
- *port = atoi (p + 1);
+ *port = atoi(p + 1);
*p = '\0';
}
}