mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-28 08:37:28 +00:00
re-enabled DNS support
This commit is contained in:
parent
d95f1e9913
commit
7d7513c71c
@ -95,7 +95,6 @@ struct notifier *ip_down_notifier = NULL;
|
||||
/* local vars */
|
||||
static int default_route_set[NUM_PPP]; /* Have set up a default route */
|
||||
static int proxy_arp_set[NUM_PPP]; /* Have created proxy arp entry */
|
||||
static bool usepeerdns; /* Ask peer for DNS addrs */
|
||||
static int ipcp_is_up; /* have called np_up() */
|
||||
static int ipcp_is_open; /* haven't called np_finished() */
|
||||
static bool ask_for_local; /* request our address from peer */
|
||||
@ -732,8 +731,8 @@ ipcp_resetci(f)
|
||||
wo->accept_local = 1;
|
||||
if (wo->hisaddr == 0)
|
||||
wo->accept_remote = 1;
|
||||
wo->req_dns1 = usepeerdns; /* Request DNS addresses from the peer */
|
||||
wo->req_dns2 = usepeerdns;
|
||||
wo->req_dns1 = ppp_settings.usepeerdns; /* Request DNS addresses from the peer */
|
||||
wo->req_dns2 = ppp_settings.usepeerdns;
|
||||
*go = *wo;
|
||||
if (!ask_for_local)
|
||||
go->ouraddr = 0;
|
||||
@ -1845,7 +1844,8 @@ ipcp_up(f)
|
||||
if (go->dnsaddr[1])
|
||||
script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
|
||||
#endif /* UNUSED */
|
||||
if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
|
||||
if (ppp_settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
|
||||
sdns(f->unit, go->dnsaddr[0], go->dnsaddr[1]);
|
||||
/* FIXME: set here the DNS servers ? */
|
||||
#if 0 /* UNUSED */
|
||||
script_setenv("USEPEERDNS", "1", 0);
|
||||
@ -2040,6 +2040,7 @@ ipcp_down(f)
|
||||
sifdown(f->unit);
|
||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||
ipcp_hisoptions[f->unit].hisaddr, 0);
|
||||
cdns(f->unit, ipcp_gotoptions[f->unit].dnsaddr[0], ipcp_gotoptions[f->unit].dnsaddr[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2052,20 +2052,17 @@ int sifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr,
|
||||
SMEMCPY(&pc->addrs.our_ipaddr, &our_adr, sizeof(our_adr));
|
||||
SMEMCPY(&pc->addrs.his_ipaddr, &his_adr, sizeof(his_adr));
|
||||
SMEMCPY(&pc->addrs.netmask, &net_mask, sizeof(net_mask));
|
||||
/* FIXME: re-enable DNS
|
||||
* SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1));
|
||||
* SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2));
|
||||
*/
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* cifaddr - Clear the interface IP addresses, and delete routes
|
||||
* through the interface if possible.
|
||||
*/
|
||||
int cifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr) {
|
||||
int cifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr) {
|
||||
ppp_control *pc = &ppp_control_list[unit];
|
||||
int st = 1;
|
||||
|
||||
@ -2077,13 +2074,51 @@ int cifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr) {
|
||||
} else {
|
||||
IP4_ADDR(&pc->addrs.our_ipaddr, 0,0,0,0);
|
||||
IP4_ADDR(&pc->addrs.his_ipaddr, 0,0,0,0);
|
||||
IP4_ADDR(&pc->addrs.netmask, 255,255,255,0);
|
||||
IP4_ADDR(&pc->addrs.netmask, 255,255,255,255);
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sdns - Config the DNS servers
|
||||
*/
|
||||
int sdns (int unit, u_int32_t ns1, u_int32_t ns2) {
|
||||
ppp_control *pc = &ppp_control_list[unit];
|
||||
int st = 1;
|
||||
|
||||
if (unit < 0 || unit >= NUM_PPP || !pc->open_flag) {
|
||||
st = 0;
|
||||
PPPDEBUG(LOG_WARNING, ("sdns[%d]: bad parms\n", unit));
|
||||
} else {
|
||||
SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1));
|
||||
SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2));
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* cdns - Clear the DNS servers
|
||||
*/
|
||||
int cdns (int unit, u_int32_t ns1, u_int32_t ns2) {
|
||||
ppp_control *pc = &ppp_control_list[unit];
|
||||
int st = 1;
|
||||
|
||||
LWIP_UNUSED_ARG(ns1);
|
||||
LWIP_UNUSED_ARG(ns2);
|
||||
if (unit < 0 || unit >= NUM_PPP || !pc->open_flag) {
|
||||
st = 0;
|
||||
PPPDEBUG(LOG_WARNING, ("cifaddr[%d]: bad parms\n", unit));
|
||||
} else {
|
||||
IP4_ADDR(&pc->addrs.dns1, 0,0,0,0);
|
||||
IP4_ADDR(&pc->addrs.dns2, 0,0,0,0);
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sifup - Config the interface up and enable IP packets to pass.
|
||||
*/
|
||||
|
@ -484,6 +484,9 @@ int ppp_recv_config(int unit, int mru, u_int32_t accm, int pcomp, int accomp);
|
||||
int sifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr, u_int32_t net_mask);
|
||||
int cifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr);
|
||||
|
||||
int sdns(int unit, u_int32_t ns1, u_int32_t ns2);
|
||||
int cdns(int unit, u_int32_t ns1, u_int32_t ns2);
|
||||
|
||||
int sifup(int u);
|
||||
int sifdown (int u);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user