lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Slipif serial deviece selection.


From: mcondarelli
Subject: [lwip-users] Slipif serial deviece selection.
Date: Tue, 15 Nov 2011 01:09:19 +0100 (CET)

Hi,
please understand this is the first time I attempt to use lwIP, so I might ask 
stupid questions ;)

I need to implement slip connection over a (fast) serial line.

My initialization code looks like:


   IP4_ADDR(&gw, 192, 168, 0, 1);
   IP4_ADDR(&ipaddr, 192, 168, 0, 2);
   IP4_ADDR(&netmask, 255, 255, 255, 0);

   lwip_init();
   netif_add(&netif, &ipaddr, &netmask, &gw, NULL, slipif_init, tcpip_input);
   netif_set_default(&netif);

This way I have no means to specify which serial line should be used for the 
communication (my hardware has three UARTs).

slipif_init() has a comment saying:

 * @note netif->num must contain the number of the serial port to open
 *       (0 by default)

This is good, but adding something like:
   netif.num = MY_UART_NUM;
before the call to netif_add() is no good because netif_add() itself changes 
netif->num setting it to a sequential number:


struct netif *
netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
  ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
{
  static u8_t netifnum = 0;
  ...
  netif->num = netifnum++;
  ...


What am I missing?
This looks like a bug, but I would like confirmation before I modify some 
internal lwIP file.

Many Thanks in Advance.
Mauro



reply via email to

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