lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] How to get network address (MAC) of gateway


From: address@hidden
Subject: Re: [lwip-users] How to get network address (MAC) of gateway
Date: Thu, 09 Oct 2008 18:16:34 +0200
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

If you are looking for a thread-safe way to implement the code below, you can use tcpip_callback() to call a void function taking one void-pointer as argument, in which you can safely call the etharp functions. tcpip_callback() lets the working task block until the function has finished.

Simon



B B wrote:


Hi Kieran,
Yes it does. I am currently working on a solution, which looks like this:
// DHCP negotiation succeeded

// Get MAC Address for default gateway

mscnt = 0;

*while* (mscnt < 3000)

{

*if* (etharp_query(&EMAC_if, &(EMAC_if.gw), NULL) != ERR_OK)

{

// Error could not perform ARP query!

}

*else*

{

*if* (etharp_find_addr(&EMAC_if, &(EMAC_if.gw), &ethaddr_ret, &ipaddr_ret) > -1)

{

// Store MAC Address

*break*;

}

}

vTaskDelay(DHCP_FINE_TIMER_MSECS);

mscnt += DHCP_FINE_TIMER_MSECS;

}
Although it isn't necessary at this point, i guess the above is not thread safe.
Any advice is greatly appreciated.
regards,
Martin



------------------------------------------------------------------------

> Subject: RE: [lwip-users] How to get network address (MAC) of gateway
> From: address@hidden
> To: address@hidden
> Date: Thu, 9 Oct 2008 09:23:11 +0100
>
> On Thu, 2008-10-09 at 09:16 +0200, B B wrote:
> >
> > Hi again,
> >
> > i am still looking into this, if someone could tell if this is
> > possible or not,
> > that would be very helpful.
> >
> > I am using the netconn api. and lwip is running in an OS, freertos.
> >
> > I have looked at etharp.c, and i see that i can make a query, but this
> > only, gives an indication of whether or not an ip address is in use.
> > Thats how dhcp is using this module.
> >
> > I my case, the dhcp server and default gateway, is not one and the
> > same.
>
> Does the reply from the DHCP server when you request an IP address
> include the gateway to use?
>
> Kieran
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users


------------------------------------------------------------------------
Connect to the next generation of MSN Messenger Get it now! <http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline>
------------------------------------------------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users





reply via email to

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