You are using the ChibiOS lwIP binding to access the network your microcontroller application.
You need to access the lwIP
struct netif structure, for example to get the current DHCP IP address assigned to the network interface. However, the default ChibiOS implementaton in
lwipthread.c does not export the interface structure.
You can simply use the lwIP default interface declared in
netif.h like this:
/** The default network interface. */
extern struct netif *netif_default;
If you use multiple interface, you can also use the
netif_find(const char* name) function.
Old solution (deprecated, kept for compatibility)
There are three simple modifications you need to make:
lwipthread.c, just below the line containing
THD_WORKING_AREA in ChibiOS 3.x), add these lines:
//The ethernet interface in use
struct netif thisif;
lwipthread.c, remove this line in
static struct netif thisif;
lwipthread.h, add this line just below the line where
wa_lwip_thread is declared:
extern struct netif thisif;
By doing this, you will be able to access
thisif from any file where you have
lwipthread.h included. Note that the exact locations of the declarations described above do not matter but were added as a guidance.
This approach was tested with both ChibiOS 3.x (git) and ChibiOS 2.6.x.