|Subject:||Re: [lwip-users] Configuring PPP Options in Version 2.0.0 Beta1|
|Date:||Tue, 10 May 2016 15:10:55 +0000|
Hi, Sylvain. Thank you for your replies. I have some comments below.
On Wed, May 04, 2016 at 08:10:41PM +0000, Greg Smith wrote:
> I have been looking forward to the PPP enhancements made in lwIP 2.0.0
> Beta1 compared to 1.4.1. I've added the new version to my project
> with success and have a few questions about configuring PPP. I
> appreciate any help you can give.
> 1) How can I setup a static IP address when _not_ running in PPP
> Server mode? (I have been successful when setting the IP address as
> second argument of pppapi_listen() when running as a server.) However,
> when running as a "client" using pppapi_connect(), the only thing I've
> found to work is something like: pppapi_connect(pppPcb, 0);
> pppPcb->ipcp_wantoptions.ouraddr = usartPpp.ip_addr.addr;
> That seems kludgy and wrong. And, it does not work if the delay time
> (second argument of pppapi_connect()) is set >0. I would like to be
> able to set a static IP address and have a delay time.
> So how do I get something like:
> // <-- function call to set static IP address here --> //
> pppapi_connect(pppPcb, 10);
Well, you are right, you can't. You are actually the first one to ask. I can't remember that far away but that wasn't possible in 1.4.1 as well isn't it ?
It was not in 1.4.1, either. But I found a blog post somewhere with the above hack. Since there was no delay in connecting, it worked fine. In 2.0.0, with the optional delay, that workaround now only works for no delay.
Since the server function wasn't really working in 1.4.1 (at least, it wasn't for me), I needed a way to set a fixed address as a "client". Now that the feature is working, this may be moot. However, it would be a nice feature, I think , for future revs.
> 2) In lcp_init(), several PPP options are hard-coded, such as
> negotiating the async map and compression. Is there a programmatic
> way to set these options at either compile-time or run-time without
> directly modifying the lcp_init() function? If so, how?
Well, you can't, this is the same issue as 1).
What worry me about both of them is that it is not possible to add them without an API change, and we are in beta… that would have been possible months ago but it's a bit too late now, you should have tried the Git master branch :-)
I just started using lwIP earlier this year and am pretty new at all IP stacks. While I wanted the newer stuff in 1.5/2.0 (master) builds, I couldn't tolerate that kind of volatility. I just needed to get the thing working to begin with! It's just coincidentally fortunate that at the 2.0.0 beta, I was at a point where I could try upgrading to it.
The only way to achieve that is to add a timeframe when the user can change the default configuration after PPP initialisation, this way:
... user configuration changes ...
pppXX_connect(ppp_pcb *ppp, ...);
It changes the API because the user will be then responsible of clearing the PPP machine state before re-connecting, which in my non-perfect world means that most of them won't do it properly.
The only configurable settings, using functions or macro if they exist are currently our ppp_settings structure. That's actually the only way to add your 1) and 2) without breaking the API, but we can't do that for all options provided by the PPP stack, there are just too many configurable values everywhere.
What you could do, for now, is to remove ppp_clear(ppp); calls from
pppos_connect() and pppos_listen(), then don't forget to call it before calling pppos_connect() and pppos_listen(). This way it adds the necessary timeframe you need to manually change settings into all protocols structures.
What I'm really after is being able to adjust the settings at compile-time (or during init at runtime) so that when a new version of lwIP comes out, it doesn't clobber my changes when I overwrite with the new files. I don't think there's going to need to be a lot of configuration once we get it close to production and get things settled. So I'll take a look at ppp_settings.
If I understand your comment above, I'll remove ppp_clear() from the source files as they are now, then update ppp_settings as I need, then call ppp_clear(), and finally, ppp_connect()/listen().
This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
|[Prev in Thread]||Current Thread||[Next in Thread]|