DHCP address in lwip

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: DHCP address in lwip

Postby steved » Thu Feb 01, 2018 2:35 pm

Certainly be interested to see an alternative to LWIP. I've not looked in detail yet, but a potential downside for picoTcp is that it is GPL-licensed (same as WolfSSL) which is going to make it significantly less attractive than Lwip for some.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: DHCP address in lwip

Postby Giovanni » Thu Feb 01, 2018 3:39 pm

Yes, it is GPL only, still good for the FOSS users.

If you guys think it is worth the effort we may try to contact them to discuss additional licensing options.

Giovanni

User avatar
danielinux
Posts: 20
Joined: Sat Nov 04, 2017 12:38 pm
Location: Amsterdam, The Netherlands
Has thanked: 4 times
Been thanked: 2 times

Re: DHCP address in lwip

Postby danielinux » Thu Feb 08, 2018 8:45 am

Sorry about the delay, due to FOSDEM weekend etc.

About the wolfSSL integration:
yes, picoTCP is supported natively by wolfSSL, and I've already worked on industrial production projects using wolfSSL TLS sockets on top of picoTCP (on Cortex-M3/M4 devices).

About the license:
picoTCP is owned by Altran Belgium, and AFAIK they provide non-GPL licenses (at user's option) to integrate into non-Free projects. It's basically the same licensing model as wolfSSL

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: DHCP address in lwip

Postby steved » Fri Apr 27, 2018 1:45 pm

Found a way to get the address as set by DHCP, so no need for patch:

Code: Select all

#include "lwip/def.h"
#include "lwip/netif.h"

/*
 * https://techoverflow.net/2015/03/16/accessing-lwip-struct-netif-instance-in-chibios/
 */
uint32_t getCurrentNetworkAddress(uint8_t addrType)
{
  if (netif_default == NULL)
    return 0;
  switch (addrType)
  {
  case 1 :
    return ntohl(netif_default->netmask.addr);
  case 2 :
    return ntohl(netif_default->gw.addr);
  case 0 :
  default :
    return ntohl(netif_default->ip_addr.addr);
  }
}

Works OK on a quick check


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 14 guests