@ -1,6 +1,6 @@
/*
/*
* redir . c - Provide a transparent TCP proxy through remote shadowsocks
* redir . c - Provide a transparent TCP proxy through remote shadowsocks
* server
* server
*
*
* Copyright ( C ) 2013 - 2015 , Max Lv < max . c . lv @ gmail . com >
* Copyright ( C ) 2013 - 2015 , Max Lv < max . c . lv @ gmail . com >
*
*
@ -40,6 +40,7 @@
# include <linux/if.h>
# include <linux/if.h>
# include <linux/netfilter_ipv4.h>
# include <linux/netfilter_ipv4.h>
# include <linux/netfilter_ipv6/ip6_tables.h>
# include <linux/netfilter_ipv6/ip6_tables.h>
# include <udns.h>
# ifdef HAVE_CONFIG_H
# ifdef HAVE_CONFIG_H
# include "config.h"
# include "config.h"
@ -191,6 +192,26 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
}
}
}
}
if ( verbose ) {
uint16_t port = 0 ;
char ipstr [ INET6_ADDRSTRLEN ] ;
memset ( & ipstr , 0 , INET6_ADDRSTRLEN ) ;
if ( AF_INET = = server - > destaddr . ss_family ) {
struct sockaddr_in * sa = ( struct sockaddr_in * ) & ( server - > destaddr ) ;
dns_ntop ( AF_INET , & ( sa - > sin_addr ) , ipstr , INET_ADDRSTRLEN ) ;
port = ntohs ( sa - > sin_port ) ;
} else {
/ / TODO : The code below need to be test in IPv6 envirment , which I
/ / don ' t have .
struct sockaddr_in6 * sa = ( struct sockaddr_in6 * ) & ( server - > destaddr ) ;
dns_ntop ( AF_INET6 , & ( sa - > sin6_addr ) , ipstr , INET6_ADDRSTRLEN ) ;
port = ntohs ( sa - > sin6_port ) ;
}
LOGI ( " redir to %s:%d, len=%ld " , ipstr , port , r ) ;
}
remote - > buf - > len = r ;
remote - > buf - > len = r ;
if ( auth ) {
if ( auth ) {