|
@ -0,0 +1,67 @@ |
|
|
|
|
|
Description: remove yp host lookup and fix some types |
|
|
|
|
|
Author: Jan Delgado <jdelgado@gmx.net> |
|
|
|
|
|
|
|
|
|
|
|
Index: udptunnel-1.1/host2ip.c
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- udptunnel-1.1.orig/host2ip.c
|
|
|
|
|
|
+++ udptunnel-1.1/host2ip.c
|
|
|
|
|
|
@@ -4,7 +4,6 @@
|
|
|
|
|
|
#include <netdb.h> /* gethostbyname() */ |
|
|
|
|
|
#include <netinet/in.h> /* sockaddr_in */ |
|
|
|
|
|
#include <arpa/inet.h> /* inet_addr() */ |
|
|
|
|
|
-#include <rpcsvc/ypclnt.h> /* YP */
|
|
|
|
|
|
#include <ctype.h> /* isspace() */ |
|
|
|
|
|
|
|
|
|
|
|
#include "host2ip.h" |
|
|
|
|
|
@@ -37,19 +36,9 @@ struct in_addr host2ip(char *host)
|
|
|
|
|
|
else if ((hep = gethostbyname(host))) { |
|
|
|
|
|
in = *(struct in_addr *)(hep->h_addr_list[0]); |
|
|
|
|
|
} |
|
|
|
|
|
- /* As a last resort, try YP. */
|
|
|
|
|
|
else { |
|
|
|
|
|
- static char *domain = 0; /* YP domain */
|
|
|
|
|
|
- char *value; /* key value */
|
|
|
|
|
|
- int value_len; /* length of returned value */
|
|
|
|
|
|
-
|
|
|
|
|
|
- if (!domain) yp_get_default_domain(&domain);
|
|
|
|
|
|
- if (yp_match(domain, "hosts.byname", host, strlen(host), &value, &value_len) == 0) {
|
|
|
|
|
|
- in.s_addr = inet_addr(value);
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
/* Everything failed */ |
|
|
|
|
|
in.s_addr = INADDR_ANY; |
|
|
|
|
|
- }
|
|
|
|
|
|
} |
|
|
|
|
|
return in; |
|
|
|
|
|
} /* host2ip */ |
|
|
|
|
|
Index: udptunnel-1.1/udptunnel.c
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- udptunnel-1.1.orig/udptunnel.c
|
|
|
|
|
|
+++ udptunnel-1.1/udptunnel.c
|
|
|
|
|
|
@@ -423,7 +423,7 @@ static void await_incoming_connections(s
|
|
|
|
|
|
for (i = 0; i < relay_count; i++) { |
|
|
|
|
|
if (FD_ISSET(relays[i].tcp_listen_sock, &readfds)) { |
|
|
|
|
|
struct sockaddr_in client_addr; |
|
|
|
|
|
- int addrlen = sizeof(client_addr);
|
|
|
|
|
|
+ socklen_t addrlen = sizeof(client_addr);
|
|
|
|
|
|
|
|
|
|
|
|
if ((relays[i].tcp_sock = |
|
|
|
|
|
accept(relays[i].tcp_listen_sock, |
|
|
|
|
|
@@ -478,7 +478,7 @@ static int udp_to_tcp(struct relay *rela
|
|
|
|
|
|
struct out_packet p; |
|
|
|
|
|
int buflen; |
|
|
|
|
|
struct sockaddr_in remote_udpaddr; |
|
|
|
|
|
- int addrlen = sizeof(remote_udpaddr);
|
|
|
|
|
|
+ socklen_t addrlen = sizeof(remote_udpaddr);
|
|
|
|
|
|
|
|
|
|
|
|
if ((buflen = recvfrom(relay->udp_recv_sock, p.buf, UDPBUFFERSIZE, 0, |
|
|
|
|
|
(struct sockaddr *) &remote_udpaddr, |
|
|
|
|
|
@@ -555,7 +555,8 @@ static int tcp_to_udp(struct relay *rela
|
|
|
|
|
|
/* There isn't a UDP listener waiting on the other end, but |
|
|
|
|
|
* that's okay, it's probably just not up at the moment or something. |
|
|
|
|
|
* Use getsockopt(SO_ERROR) to clear the error state. */ |
|
|
|
|
|
- int err, len = sizeof(err);
|
|
|
|
|
|
+ int err;
|
|
|
|
|
|
+ socklen_t len = sizeof(err);
|
|
|
|
|
|
|
|
|
|
|
|
if (debug > 1) { |
|
|
|
|
|
fprintf(stderr, "ECONNREFUSED on udp_send_sock; clearing.\n"); |