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)
|
#define close(fd) closesocket(fd)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION "14"
|
#define VERSION "14.1"
|
||||||
|
|
||||||
char ip_option[1] = "\0";
|
char ip_option[1] = "\0";
|
||||||
|
|
||||||
|
16
proxy.c
16
proxy.c
@ -35,6 +35,9 @@
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
/* For SO_ORIGINAL_DST only (which is 0x50) */
|
/* For SO_ORIGINAL_DST only (which is 0x50) */
|
||||||
#include "linux/netfilter_ipv4.h"
|
#include "linux/netfilter_ipv4.h"
|
||||||
|
#ifndef IP6T_SO_ORIGINAL_DST
|
||||||
|
#define IP6T_SO_ORIGINAL_DST SO_ORIGINAL_DST
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -129,6 +132,7 @@ int resolve(char *host, int len,
|
|||||||
|
|
||||||
char rchar = host[len];
|
char rchar = host[len];
|
||||||
host[len] = '\0';
|
host[len] = '\0';
|
||||||
|
LOG(LOG_S, "resolve: %s\n", host);
|
||||||
|
|
||||||
if (getaddrinfo(host, 0, &hints, &res) || !res) {
|
if (getaddrinfo(host, 0, &hints, &res) || !res) {
|
||||||
host[len] = rchar;
|
host[len] = rchar;
|
||||||
@ -543,10 +547,14 @@ static inline int transp_conn(struct poolhd *pool, struct eval *val)
|
|||||||
{
|
{
|
||||||
struct sockaddr_ina remote, self;
|
struct sockaddr_ina remote, self;
|
||||||
socklen_t rlen = sizeof(remote), slen = sizeof(self);
|
socklen_t rlen = sizeof(remote), slen = sizeof(self);
|
||||||
if (getsockopt(val->fd,
|
if (getsockopt(val->fd, IPPROTO_IP,
|
||||||
IPPROTO_IP, SO_ORIGINAL_DST, &remote, &rlen) != 0) {
|
SO_ORIGINAL_DST, &remote, &rlen) != 0)
|
||||||
uniperror("getsockopt SO_ORIGINAL_DST");
|
{
|
||||||
return -1;
|
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) {
|
if (getsockname(val->fd, &self.sa, &slen) < 0) {
|
||||||
uniperror("getsockname");
|
uniperror("getsockname");
|
||||||
|
Loading…
Reference in New Issue
Block a user