Lines Matching refs:ns
177 ipcp->ns.dns[0].s_addr = ipcp->ns.dns[1].s_addr = INADDR_NONE; in ipcp_LoadDNS()
179 if (ipcp->ns.resolv != NULL) { in ipcp_LoadDNS()
180 free(ipcp->ns.resolv); in ipcp_LoadDNS()
181 ipcp->ns.resolv = NULL; in ipcp_LoadDNS()
183 if (ipcp->ns.resolv_nons != NULL) { in ipcp_LoadDNS()
184 free(ipcp->ns.resolv_nons); in ipcp_LoadDNS()
185 ipcp->ns.resolv_nons = NULL; in ipcp_LoadDNS()
187 ipcp->ns.resolver = 0; in ipcp_LoadDNS()
199 if ((ipcp->ns.resolv_nons = (char *)malloc(st.st_size + 1)) == NULL) in ipcp_LoadDNS()
202 else if ((ipcp->ns.resolv = (char *)malloc(st.st_size + 1)) == NULL) { in ipcp_LoadDNS()
205 free(ipcp->ns.resolv_nons); in ipcp_LoadDNS()
206 ipcp->ns.resolv_nons = NULL; in ipcp_LoadDNS()
207 } else if ((got = read(fd, ipcp->ns.resolv, st.st_size)) != st.st_size) { in ipcp_LoadDNS()
215 free(ipcp->ns.resolv_nons); in ipcp_LoadDNS()
216 ipcp->ns.resolv_nons = NULL; in ipcp_LoadDNS()
217 free(ipcp->ns.resolv); in ipcp_LoadDNS()
218 ipcp->ns.resolv = NULL; in ipcp_LoadDNS()
223 ipcp->ns.resolv[st.st_size] = '\0'; in ipcp_LoadDNS()
224 ipcp->ns.resolver = 1; in ipcp_LoadDNS()
226 cp_nons = ipcp->ns.resolv_nons; in ipcp_LoadDNS()
227 cp = ipcp->ns.resolv; in ipcp_LoadDNS()
250 if (n < 2 && inet_aton(cp, ipcp->ns.dns)) in ipcp_LoadDNS()
265 while (cp_nons >= ipcp->ns.resolv_nons && *cp_nons == '\n') in ipcp_LoadDNS()
267 if (n == 2 && ipcp->ns.dns[0].s_addr == INADDR_ANY) { in ipcp_LoadDNS()
268 ipcp->ns.dns[0].s_addr = ipcp->ns.dns[1].s_addr; in ipcp_LoadDNS()
269 ipcp->ns.dns[1].s_addr = INADDR_ANY; in ipcp_LoadDNS()
288 if (ipcp->ns.dns[0].s_addr == INADDR_ANY && in ipcp_WriteDNS()
289 ipcp->ns.dns[1].s_addr == INADDR_ANY) { in ipcp_WriteDNS()
295 if (ipcp->ns.dns[0].s_addr == INADDR_ANY) { in ipcp_WriteDNS()
296 ipcp->ns.dns[0].s_addr = ipcp->ns.dns[1].s_addr; in ipcp_WriteDNS()
297 ipcp->ns.dns[1].s_addr = INADDR_ANY; in ipcp_WriteDNS()
303 if (ipcp->ns.resolv_nons) in ipcp_WriteDNS()
304 fputs(ipcp->ns.resolv_nons, fp); in ipcp_WriteDNS()
305 paddr = inet_ntoa(ipcp->ns.dns[0]); in ipcp_WriteDNS()
308 if (ipcp->ns.dns[1].s_addr != INADDR_ANY && in ipcp_WriteDNS()
309 ipcp->ns.dns[1].s_addr != INADDR_NONE && in ipcp_WriteDNS()
310 ipcp->ns.dns[1].s_addr != ipcp->ns.dns[0].s_addr) { in ipcp_WriteDNS()
311 paddr = inet_ntoa(ipcp->ns.dns[1]); in ipcp_WriteDNS()
329 if (ipcp->ns.resolver) { in ipcp_RestoreDNS()
334 len = strlen(ipcp->ns.resolv); in ipcp_RestoreDNS()
335 if ((got = write(fd, ipcp->ns.resolv, len)) != len) { in ipcp_RestoreDNS()
392 ipcp->cfg.ns.dns[0].s_addr == INADDR_NONE ? in ipcp_Show()
393 "none" : inet_ntoa(ipcp->cfg.ns.dns[0])); in ipcp_Show()
394 if (ipcp->cfg.ns.dns[1].s_addr != INADDR_NONE) in ipcp_Show()
396 inet_ntoa(ipcp->cfg.ns.dns[1])); in ipcp_Show()
398 command_ShowNegval(ipcp->cfg.ns.dns_neg)); in ipcp_Show()
400 ipcp->ns.dns[0].s_addr == INADDR_NONE ? in ipcp_Show()
401 "none" : inet_ntoa(ipcp->ns.dns[0])); in ipcp_Show()
402 if (ipcp->ns.dns[1].s_addr != INADDR_NONE && in ipcp_Show()
403 ipcp->ns.dns[1].s_addr != ipcp->ns.dns[0].s_addr) in ipcp_Show()
405 inet_ntoa(ipcp->ns.dns[1])); in ipcp_Show()
407 inet_ntoa(ipcp->cfg.ns.nbns[0])); in ipcp_Show()
409 inet_ntoa(ipcp->cfg.ns.nbns[1])); in ipcp_Show()
471 ipcp->cfg.ns.dns[0].s_addr = INADDR_NONE; in ipcp_Init()
472 ipcp->cfg.ns.dns[1].s_addr = INADDR_NONE; in ipcp_Init()
473 ipcp->cfg.ns.dns_neg = 0; in ipcp_Init()
474 ipcp->cfg.ns.nbns[0].s_addr = INADDR_ANY; in ipcp_Init()
475 ipcp->cfg.ns.nbns[1].s_addr = INADDR_ANY; in ipcp_Init()
484 ipcp->ns.resolv = NULL; in ipcp_Init()
485 ipcp->ns.resolv_nons = NULL; in ipcp_Init()
486 ipcp->ns.writable = 1; in ipcp_Init()
499 if (ipcp->ns.resolv != NULL) { in ipcp_Destroy()
500 free(ipcp->ns.resolv); in ipcp_Destroy()
501 ipcp->ns.resolv = NULL; in ipcp_Destroy()
503 if (ipcp->ns.resolv_nons != NULL) { in ipcp_Destroy()
504 free(ipcp->ns.resolv_nons); in ipcp_Destroy()
505 ipcp->ns.resolv_nons = NULL; in ipcp_Destroy()
592 if (ipcp->cfg.ns.dns[0].s_addr != INADDR_NONE) in ipcp_Setup()
593 memcpy(ipcp->ns.dns, ipcp->cfg.ns.dns, sizeof ipcp->ns.dns); in ipcp_Setup()
784 if (IsEnabled(ipcp->cfg.ns.dns_neg)) { in IpcpSendConfigReq()
786 memcpy(o->data, &ipcp->ns.dns[0].s_addr, 4); in IpcpSendConfigReq()
791 memcpy(o->data, &ipcp->ns.dns[1].s_addr, 4); in IpcpSendConfigReq()
1210 if (!IsAccepted(ipcp->cfg.ns.dns_neg)) { in IpcpDecodeConfig()
1215 have_ip = ipcp->ns.dns[opt->hdr.id == TY_PRIMARY_DNS ? 0 : 1]; in IpcpDecodeConfig()
1218 ipaddr.s_addr == ipcp->ns.dns[1].s_addr) { in IpcpDecodeConfig()
1220 ipcp->ns.dns[0] = ipcp->ns.dns[1]; in IpcpDecodeConfig()
1221 ipcp->ns.dns[1] = have_ip; in IpcpDecodeConfig()
1222 have_ip = ipcp->ns.dns[0]; in IpcpDecodeConfig()
1244 if (IsEnabled(ipcp->cfg.ns.dns_neg)) { in IpcpDecodeConfig()
1246 memcpy(&ipcp->ns.dns[opt->hdr.id == TY_PRIMARY_DNS ? 0 : 1].s_addr, in IpcpDecodeConfig()
1265 ipcp->cfg.ns.nbns[opt->hdr.id == TY_PRIMARY_NBNS ? 0 : 1].s_addr; in IpcpDecodeConfig()
1303 if (ipcp->ns.writable) { in IpcpDecodeConfig()