mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 06:15:14 +00:00
Transparent IPV6
This commit is contained in:
parent
5e5dec60f2
commit
a9ecc83932
2
main.c
2
main.c
@ -23,7 +23,7 @@
|
||||
#define close(fd) closesocket(fd)
|
||||
#endif
|
||||
|
||||
#define VERSION "14"
|
||||
#define VERSION "14.1"
|
||||
|
||||
char ip_option[1] = "\0";
|
||||
|
||||
|
12
proxy.c
12
proxy.c
@ -35,6 +35,9 @@
|
||||
#ifdef __linux__
|
||||
/* For SO_ORIGINAL_DST only (which is 0x50) */
|
||||
#include "linux/netfilter_ipv4.h"
|
||||
#ifndef IP6T_SO_ORIGINAL_DST
|
||||
#define IP6T_SO_ORIGINAL_DST SO_ORIGINAL_DST
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -129,6 +132,7 @@ int resolve(char *host, int len,
|
||||
|
||||
char rchar = host[len];
|
||||
host[len] = '\0';
|
||||
LOG(LOG_S, "resolve: %s\n", host);
|
||||
|
||||
if (getaddrinfo(host, 0, &hints, &res) || !res) {
|
||||
host[len] = rchar;
|
||||
@ -543,11 +547,15 @@ static inline int transp_conn(struct poolhd *pool, struct eval *val)
|
||||
{
|
||||
struct sockaddr_ina remote, self;
|
||||
socklen_t rlen = sizeof(remote), slen = sizeof(self);
|
||||
if (getsockopt(val->fd,
|
||||
IPPROTO_IP, SO_ORIGINAL_DST, &remote, &rlen) != 0) {
|
||||
if (getsockopt(val->fd, IPPROTO_IP,
|
||||
SO_ORIGINAL_DST, &remote, &rlen) != 0)
|
||||
{
|
||||
if (getsockopt(val->fd, IPPROTO_IPV6,
|
||||
IP6T_SO_ORIGINAL_DST, &remote, &rlen) != 0) {
|
||||
uniperror("getsockopt SO_ORIGINAL_DST");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (getsockname(val->fd, &self.sa, &slen) < 0) {
|
||||
uniperror("getsockname");
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user