Comments (5)
Thanks.
As far as I understand, the fix would be to trim the IP on the first comma, is that correct?
from fossa.
But the first ip is not necessarily the best nameserver, 蛋疼
from fossa.
Thanks.
If first IP might not be the best server, what would be the best algorithm to pick one?
from fossa.
On linux the default behaviour is to to try the second (and the third, see MAXNS
) name after attempts
number of attempts (default 2), unless the rotate
option is present in resolv.conf. On windows I guess there is a similar behaviour but I didn't check.
from fossa.
Sorry for my poor English.
Following is code of function ns_get_ip_address_of_nameserver()
started at fossa.c
line 4384.
static int ns_get_ip_address_of_nameserver(char *name, size_t name_len) {
int ret = 0;
#ifdef _WIN32
int i;
LONG err;
HKEY hKey, hSub;
char subkey[512], dhcpns[512], ns[512], value[128], *key =
"SYSTEM\\ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces";
if ((err = RegOpenKey(HKEY_LOCAL_MACHINE,
key, &hKey)) != ERROR_SUCCESS) {
fprintf(stderr, "cannot open reg key %s: %d\n", key, err);
ret--;
} else {
for (ret--, i = 0; RegEnumKey(hKey, i, subkey,
sizeof(subkey)) == ERROR_SUCCESS; i++) {
DWORD type, len = sizeof(value);
if (RegOpenKey(hKey, subkey, &hSub) == ERROR_SUCCESS &&
(RegQueryValueEx(hSub, "NameServer", 0,
&type, value, &len) == ERROR_SUCCESS ||
RegQueryValueEx(hSub, "DhcpNameServer", 0,
&type, value, &len) == ERROR_SUCCESS)) {
strncpy(name, value, name_len);
ret++;
RegCloseKey(hSub);
break;
}
}
RegCloseKey(hKey);
}
#else
/* linux version */
#endif /* _WIN32 */
return ret;
}
looking at line strncpy(name, value, name_len)
,
the value
can be an empty string, or IP addresses seperated by comma (e.g 8.8.8.8, 8.8.8.4).
that's the point.
from fossa.
Related Issues (20)
- JSON RPC responses are limited in size by size of pre-defined buffer HOT 6
- Actually, C allows implicit conversion HOT 2
- Current Cipher-suite is not supported on latest Firefox (ssl_error_no_cypher_overlap) HOT 5
- SSL REST client: calling SSL_accept() during handshake HOT 4
- with DISABLE_FILESYSTEM, no default ns server is provided. HOT 15
- Make fossa friendlier for embedded systems HOT 4
- Add support work with other ssl libs in fossa HOT 1
- handle_chunked buffer overflow. HOT 1
- http_client hangup on receive data HOT 2
- error build (ubuntu 10.04)
- missing .gitgnore
- Fossa fails to link without NS_DISABLE_PFS switch on Windows HOT 6
- latest code complain over random() on windows HOT 2
- wrong example, restful_server HOT 1
- Aborted (core dumped) HOT 9
- VC++ 2015 int strnlen HOT 1
- VC++2015 error C4996: 'fileno' HOT 1
- VC++ 2015 struct ns_mgr dummy = {}; HOT 1
- Undefined behaviour under Release build
- rook - Projects | FOSSA
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fossa.