lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] PPP and ethernet, getting the IP and DNS addresses


From: Yoav Nissim
Subject: Re: [lwip-users] PPP and ethernet, getting the IP and DNS addresses
Date: Mon, 29 Nov 2010 11:40:12 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4


Hi Paul,

I've used a similar configuration.


lwIP provides you with 2 DNS server addresses by default.

You can change them using dns_setserver() defined in dns.h [If I am not
mistaken the default DNS server is resolver1.opendns.com.]


As for getting interface information:

I do not use DHCP with ethernet interfaces, but I believe you can get
that information by setting the status callback
(*netif_set_status_callback). It is called whenever your interface is
brought up or down.

You should set the callback in your netif_init function (the one you
provide to netif_add / netifapi_netif_add)


As for PPP, I know of two methods:

1. PPP allows you to set a status callback for its internal netif -
ppp_set_netif_statuscallback(). It should be called when your PPP
connection is up, though I have not used it.

2. If you call pppOverSerialOpen you can provide a link_status callback,
which provides an error code and a void * arg. When PPP is connected,
you can cast the arg into a struct ppp_addrs* which contains the PPP
link IP addresses, netmask, and one or two PPP-provided DNS server
addresses. (note that these PPP IP addresses are probably NOT your
actual IP address as seen by internet servers)


Another problem is that the ppp code that sets the dns servers is
remarked out (in ipcp.c - search for "pppGotDNSAddrs"). You can replace
it with the following:


if (ppp_settings.usepeerdns) {
         if (go->dnsaddr[0])
            dns_setserver(0, (struct ip_addr*)&go->dnsaddr[0]);
          if (go->dnsaddr[1])
            dns_setserver(1, (struct ip_addr*)&go->dnsaddr[1]);
}


HTH.



On 29/11/2010 6:37, Paul Archer wrote:

> Hi all,
>
> I am running lwIP with two interfaces, 1 over PPP and the other over Ethernet.
>
> Most probably both interfaces will run with automatic address
> assignment (IPCP over PPP and DHCP over Ethernet).
>
> Is there an API in lwIP to find out what IP address and DNS addresses
> I am given for these two interfaces? I had a look on the wiki and
> google and I didn't come up with anything.
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]