mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Fix: dnspr was broken since udppm rewrite. -F (fake resolve to redirect traffic) option added to dnspr
This commit is contained in:
1 parent
87fc8ae4ee
commit
c94766dff7
6 files changed
+173
-6
No files matched your search
+20
-3
@@ -25,6 +25,7 @@ void * dnsprchild(struct clientparam* param) {
|
||||
SASIZETYPE size;
|
||||
int res, i;
|
||||
int len;
|
||||
int semlocked = 1;
|
||||
unsigned type=0;
|
||||
uint32_t ttl;
|
||||
unsigned char addr[16];
|
||||
@@ -38,10 +39,13 @@ void * dnsprchild(struct clientparam* param) {
|
||||
RETURN (21);
|
||||
}
|
||||
buf = bbuf+2;
|
||||
size = sizeof(param->sincr);
|
||||
i = param->srv->so._recvfrom(param->sostate, param->srv->srvsock, (char *)buf, BUFSIZE, 0, (struct sockaddr *)¶m->sincr, &size);
|
||||
size = sizeof(param->sinsl);
|
||||
getsockname(param->srv->srvsock, (struct sockaddr *)¶m->sincl, &size);
|
||||
i = param->srv->udplen;
|
||||
if(i > BUFSIZE) i = BUFSIZE;
|
||||
memcpy(buf, param->srv->udpbuf, i);
|
||||
_3proxy_sem_unlock(udpinit);
|
||||
semlocked = 0;
|
||||
#ifdef _WIN32
|
||||
if((param->clisock=param->srv->so._socket(param->sostate, AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) {
|
||||
RETURN(818);
|
||||
@@ -82,7 +86,19 @@ void * dnsprchild(struct clientparam* param) {
|
||||
*s2 = (len - (int)(s2 - buf)) - 1;
|
||||
|
||||
type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2];
|
||||
if((type==0x01 || type==0x1c) && !param->srv->s_option){
|
||||
if(type==0x01 && param->srv->fakeip){
|
||||
ip = 1;
|
||||
ttl = 3600;
|
||||
*(uint32_t *)addr = param->srv->fakeip;
|
||||
}
|
||||
#ifndef NOIPV6
|
||||
else if(type==0x1c && *(uint32_t *)param->srv->fakeip6){
|
||||
ip = 1;
|
||||
ttl = 3600;
|
||||
memcpy(addr, param->srv->fakeip6, 16);
|
||||
}
|
||||
#endif
|
||||
else if((type==0x01 || type==0x1c) && !param->srv->s_option){
|
||||
ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0);
|
||||
}
|
||||
|
||||
@@ -191,6 +207,7 @@ void * dnsprchild(struct clientparam* param) {
|
||||
|
||||
CLEANRET:
|
||||
|
||||
if(semlocked) _3proxy_sem_unlock(udpinit);
|
||||
if(param->res!=813){
|
||||
sprintf((char *)buf, "%04x/%s/",
|
||||
(unsigned)type,
|
||||
|
||||
Reference in new issue
Block a user