Netsplit progress, ntk_mode properly set up.

This commit is contained in:
MissValeska 2014-11-06 15:59:07 -08:00
parent c5cfe42811
commit f8a151e7fb

View File

@ -95,8 +95,8 @@ void inet_mode(char *domain) {
ret = strstr(new_domain, ".ntk"); ret = strstr(new_domain, ".ntk");
if(ret != NULL) { if(ret != NULL) {
new_domain[strlen(new_domain)-5] = '\0';
inet_mode_ntk_rslv: inet_mode_ntk_rslv:
new_domain[strlen(new_domain)-5] = '\0';
rt_value = isValidIpv4Address(new_domain); rt_value = isValidIpv4Address(new_domain);
if(rt_value == 1) if(rt_value == 1)
ntkipForwarding(new_domain, AF_INET); ntkipForwarding(new_domain, AF_INET);
@ -111,33 +111,54 @@ void inet_mode(char *domain) {
void ntk_mode(char *domain) { void ntk_mode(char *domain) {
printf("ntk_mode: %s\n", domain);
char *ret;
char *ret1;
char new_domain[MAXNAMLEN]; char new_domain[MAXNAMLEN];
int rt_value; int rt_value;
strcpy(new_domain, domain); strcpy(new_domain, domain);
if(strstr(domain, ".inet") == NULL) ret = strstr(new_domain, ".inet");
goto ntk_mode_inet_rslv;
if(strstr(domain, ".ntk") == NULL || strstr(domain, ".ntk") != NULL) { if(ret != NULL) {
rt_value = isValidIpv4Address(domain); printf("ntk_mode .inet\n");
if(rt_value == 1) goto ntk_mode_inet_rslv;
ntkipForwarding(domain, AF_INET);
if(rt_value == 11)
ntkipForwarding(domain, AF_INET6);
if(rt_value == 0)
ntkDNSResolution(domain);
} }
if(strstr(domain, ".inet") != NULL) { ret = strstr(new_domain, ".ntk");
ntk_mode_inet_rslv: ret1 = strstr(new_domain, ".ntk");
rt_value = isValidIpv4Address(domain);
if(ret1 != NULL) {
new_domain[strlen(new_domain)-5] = '\0';
printf("ntk_mode abbrevate: %s\n", new_domain);
}
if(ret == NULL || ret1 != NULL) {
rt_value = isValidIpv4Address(new_domain);
if(rt_value == 1) if(rt_value == 1)
inetipForwarding(domain, AF_INET); ntkipForwarding(new_domain, AF_INET);
if(rt_value == 11) if(rt_value == 11)
inetipForwarding(domain, AF_INET6); ntkipForwarding(new_domain, AF_INET6);
if(rt_value == 0) if(rt_value == 0)
inetDNSResolution(domain); ntkDNSResolution(new_domain);
printf("ntk_mode normal\n");
}
ret = strstr(new_domain, ".inet");
if(ret != NULL) {
ntk_mode_inet_rslv:
new_domain[strlen(new_domain)-6] = '\0';
rt_value = isValidIpv4Address(new_domain);
if(rt_value == 1)
inetipForwarding(new_domain, AF_INET);
if(rt_value == 11)
inetipForwarding(new_domain, AF_INET6);
if(rt_value == 0)
inetDNSResolution(new_domain);
printf("ntk_mode abnormal\n");
} }
} }