Re: [lwip-users] TCIP Support Flow for PPPos

2014-11-14 Thread chrysn
On Mon, Oct 27, 2014 at 10:53:25AM -0700, mjackson wrote:
 1. After PPP has completed negotiations (LCP, AUTH and IPCP), 
which api should I call to connect to a remote server? 

your application can use the regular lwip mechanisms once the link is
up, without special consideration for ppp (eg. udp_sendto); which
exactly you need depends on your NO_SYS value, whether you want TCP or
UDP etc.

 2. After connecting to a remote server, should I used the following
api's to send and receive data.

   - ppp_netif_output_ip4(...) or ppp_write(...)
   - pppos_input(...)

once lcp, auth and ipcp have run, there should be no further need to
call ppp specific functions. you do need pppos_input, but you should
already have used that to feed incoming bytes to the ppp subsystem
during link setup, so just continue to do so.

best regards
chrysn

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread chrysn
hello lwip users,

i'd like to keep track of my gsm device's position while a ppp data
connection is active. unfortunately, that means that the non-ppp
messages (/\r\n+CENG:[0-9,a-f]+\r\n/ in my case) arrive in the same
stream as ppp messages. (at least, it appears, they are not fully
interleaved).

does the lwip ppp stack provide a mechanism to feed back rejected
strings somewhere else, or do i need to inspect the ppp stack's internal
state from outside, determine whether it is currenlty inside or outside
of a frame, and divert \r\n... sequences from it if no frame is
currently being received?

for reference, i'm working with lwip master branch, and the modem i'm
using is a simcom sim900d. apart from the CENG messages, occasional
\r\nUNDER-VOLTAGE WARNNING\r\n (sic) messages appear, and those can't
be switched off.

best regards
chrysn

-- 
This may seem a bit weird, but that's okay, because it is weird.
  -- perldata(1) about perl variables


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread Sylvain Rochet
Hi chrysn,


On Fri, Nov 14, 2014 at 10:09:18AM +0100, chrysn wrote:
 hello lwip users,
 
 i'd like to keep track of my gsm device's position while a ppp data
 connection is active. unfortunately, that means that the non-ppp
 messages (/\r\n+CENG:[0-9,a-f]+\r\n/ in my case) arrive in the same
 stream as ppp messages. (at least, it appears, they are not fully
 interleaved).

I feel dazed and confused, is this really a thing which is actually 
usual in the wild or is it specific to your modem ?

AFAIK modems usually use DTR level to switch from data mode to command 
mode, which is an OOB mechanism so it doesn't need dubious parsing. I 
know about the pause +++ pause mechanism but it is nowadays rarely 
used since it is prone to erroneous termination, and +STRING+ is not it.

Anyway, maybe you have a way out of that, modems in data mode are in 
strict binary mode of course so any ASCII parsing of the binary stream 
should result in a failure... but PPP use HDLC framing and your GSM 
modem is in charge of creating those HDLC frames as well as sending your 
ASCII string and I hope they are not overlapping.

HDLC frames always start with 0xff 0x03 in case of PPP over serial line, 
which goes to the following with the added HDLC flags:
  0x7e 0xff 0x03 ... 0x7e

While your ASCII frame will probably be:
  0x7e 0x0d(\r) 0x0a(\n) 0x2b(+) ... 0x7e

So you can probably split up those frames without much issue.


 does the lwip ppp stack provide a mechanism to feed back rejected
 strings somewhere else, or do i need to inspect the ppp stack's internal
 state from outside, determine whether it is currenlty inside or outside
 of a frame, and divert \r\n... sequences from it if no frame is
 currently being received?

Well, this looks like an ugly hack, I am not sure this belong to the 
lwIP stack, especially if this is specific to one modem. It actually 
breaks the HDLC framing protocol.

HDLC is pretty simple to parse and you don't need to do PPP packet 
formatting, then you can parse the HDLC stream and split up HDLC valid 
frames vs ASCII frames in the way your modem specific implementation 
does and before sending them to lwIP.

You don't even need to take care of HDLC byte-escaping because you 
should not find 0x7e inside a frame, well, 0x7e is also ASCII character 
~ and this is at least one reason why it actually breaks the HDLC 
framing.


 for reference, i'm working with lwip master branch, and the modem i'm
 using is a simcom sim900d. apart from the CENG messages, occasional
 \r\nUNDER-VOLTAGE WARNNING\r\n (sic) messages appear, and those can't
 be switched off.

[libel shield running, empty text here] ;-)


Sylvain


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Assertion pbuf_free: p-ref 0 failed at line 651 in ../src/lwip/core/pbuf.c

2014-11-14 Thread Sergio R. Caprile
If I was you, I would:
- make sure the port I'm using works, by first running known good examples.
- study those examples to learn how to work with lwip.
- read the wiki, it is great for bed reading.
- trace assertions to my code, execute step by step and see what I'm
doing wrong.
- try to figure it out by myself, but if I can't, I would write a brief
and concise description of what I'm doing, what I can't solve, and what
I don't understand. That description would include a description of the
system in which I'm doing that, stating that I followed the previous
steps and the system works, and what type of lwIP API I'm using.

With the data you provide, I can only direct you to line 651 of pbuf.c
and see why something you are passing to that function is incorrect.
OK, I feel like wasting some time today, here I go:
$ vi src/core/pbuf.c
651
/pbuf_free(struct pbuf *p)/
{
[...]
/* all pbufs in a chain are referenced at least once */
*651--LWIP_ASSERT(pbuf_free: p-ref  0, p-ref  0);*
//* decrease reference count (number of pointers to pbuf) *///
//ref = --(p-ref);/

that means you are trying to free an already freed pbuf.

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread Sergio R. Caprile
My view:
Since PPP expects a serial transparent interface, and you are not
providing that, I would write a tap which provides that to PPP and
taps all other data out.

GSM modem  real serial -- my module - PPP virtual serial

--- tracking virtual serial

Some GSM modems provide a packetization interface to clearly separate
muxed channels on the same serial interface. If yours does not, you'll
have to work harder.



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread Sergio R. Caprile
BTW, 
\r\nUNDER-VOLTAGE WARNING\r\n
is a clear indication that your power supply is not well designed and/or
your module is not well decoupled.
It needs 2A current to transmit for a very short time, you need a 100uF
low impedance
in parallel with 2uF MLCC close to the module; or better, what the
hardware manual recommends.
And make sure your power supply can provide that current for that amount
of time,
which you'll find in the manual.

Sorry about that, but I used to work with the tech support for Simcom in
Argentina...


On 14/11/2014 10:06 a.m., Sergio R. Caprile wrote:
 My view:
 Since PPP expects a serial transparent interface, and you are not
 providing that, I would write a tap which provides that to PPP and
 taps all other data out.

 GSM modem  real serial -- my module - PPP virtual serial

 --- tracking virtual serial

 Some GSM modems provide a packetization interface to clearly separate
 muxed channels on the same serial interface. If yours does not, you'll
 have to work harder.




-- 
-
Sergio R. Caprile, Human Being, Bs.As., Argentina
Electronics Engineer, Musician (guitarist), TaoFx 
http://www.scaprile.ldir.com.ar/
-


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


[lwip-users] Assertion pbuf_free: p-ref 0 failed at line 651 in ../src/lwip/core/pbuf.c

2014-11-14 Thread aaisha
Hi, 
I'm trying to send ping and udp packets. But for both packets I'm getting 
assertion failed like this 
Assertion pbuf_free: p-ref  0 failed at line 651 in ../src/lwip/core/pbuf.c 
Can anyone please help me.. 

Regards, 
Aaisha Ahmed.
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Sending to a non-local network without default netif set

2014-11-14 Thread HaaCee2
In response to the remark:
Simon is right: routing doesn't have anything to do with the source address
and it shouldn't have to

I think Simon is not right (no pun intended).
I am not entirely familiar with the ideas behind LwIP. But sourcebased
routing is very much in line with rfc1122 (ip for hosts). I quote:

 Under the Strong ES model, the route computation for an outgoing datagram
 is the mapping:
 
  route(src IP addr, dest IP addr, TOS) - gateway
 
 Here the source address is included as a parameter in order to select a
 gateway that is directly reachable on the corresponding physical
 interface. Note that this model logically requires that in general there
 be at least one default gateway, and preferably multiple defaults, for
 each IP source address.

We are facing a similar challenge with our project and we need a similar
mechanism. Is the adaptation of the ip_route available somewhere in the
community?

Regards,

Erik van Veelen




--
View this message in context: 
http://lwip.100.n7.nabble.com/Sending-to-a-non-local-network-without-default-netif-set-tp22981p23521.html
Sent from the lwip-users mailing list archive at Nabble.com.

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread chrysn
hello sergio,

thank you for your responses.

On Fri, Nov 14, 2014 at 10:06:00AM -0300, Sergio R. Caprile wrote:
 Since PPP expects a serial transparent interface, and you are not
 providing that, I would write a tap which provides that to PPP and
 taps all other data out.
 
 GSM modem  real serial -- my module - PPP virtual serial
 
 --- tracking virtual serial
 
 Some GSM modems provide a packetization interface to clearly separate
 muxed channels on the same serial interface. If yours does not, you'll
 have to work harder.

that is what i'm about to implement right now. unless the ascii jabber
inbetween contains 0x7e 0xff sequences, that should be doable with
reasonable effort.

On Fri, Nov 14, 2014 at 10:11:01AM -0300, Sergio R. Caprile wrote:
 BTW, 
 \r\nUNDER-VOLTAGE WARNING\r\n
 is a clear indication that your power supply is not well designed and/or
 your module is not well decoupled.
 It needs 2A current to transmit for a very short time, you need a 100uF
 low impedance
 in parallel with 2uF MLCC close to the module; or better, what the
 hardware manual recommends.

i was afraid so when i first saw them, but i never ran into an
UNDER-VOLTAGE POWER DOWN condition so far; thing is, i'm running my
entire board off 3.3V, which is the threshold for the warning. the
module can do down to 3.2V, and a 2m2 cap in parallel with a 4u7 and
100n make sure it won't even if the usb power supply doesn't handle
bursts well.

i hope it's sufficient -- or are you confident that this is indication
of trouble even when running on 3v3?

 Sorry about that, but I used to work with the tech support for Simcom in
 Argentina...

honestly, i wasn't aware that such a thing exists; when it comes to
support, nothing the simcom website has looks like you'll ever talk to a
technician. could you point me to where i can reach their (possibly
local, paid if needed) tech support?

best regard
chrysn

-- 
Most people would leave. Not us. We're Vikings. We have stubbornness
issues.
  -- Hiccup, son of Stoic


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread Sergio R. Caprile
Chrysn,
yes, Simcom tech department sucks... they've had some internal issues on
the move from SIM340 to SIM900.
They are chinese and english docs are poor and mostly non-existent.
We've had a tech contact long ago but hopefully I haven't contacted them
for years.
Regarding the hw, you are too close to the limit, I've never run them
bellow 3.6V. You need a heck of a stable power supply to drop only 0.1V
with a 2A pull. It might work OK in the lab/city (close to the cell)
and fail on a moving truck.
Should you need anything else, you can pm me so we don't bother lwIP users.



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] Sending to a non-local network without default netif set

2014-11-14 Thread goldsi...@gmx.de

HaaCee2 wrote:

I am not entirely familiar with the ideas behind LwIP. But sourcebased
routing is very much in line with rfc1122 (ip for hosts). I quote:


Under the Strong ES model, the route computation for an outgoing datagram
is the mapping:

  route(src IP addr, dest IP addr, TOS) - gateway

Here the source address is included as a parameter in order to select a
gateway that is directly reachable on the corresponding physical
interface. Note that this model logically requires that in general there
be at least one default gateway, and preferably multiple defaults, for
each IP source address.


Well, that excerpt is one of 2 possibilities in the RFC. The other 
possibility is to do like lwIP does. I admit though that it looks kind 
of strange sending packets with IP address A to the interface B just 
because you have a matching destination gateway on that netif...


By now, I'm tempted to add source-based routing as an option, although I 
expect people using lwIP wih more than one interface being only a small 
percentage...



Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] Sending to a non-local network without default netif set

2014-11-14 Thread HaaCee2

On 14-11-14 20:27, Simon Goldschmidt [via lwIP] wrote:
 HaaCee2 wrote:

  I am not entirely familiar with the ideas behind LwIP. But sourcebased
  routing is very much in line with rfc1122 (ip for hosts). I quote:
 
  Under the Strong ES model, the route computation for an outgoing 
 datagram
  is the mapping:
 
route(src IP addr, dest IP addr, TOS) - 
 gateway
 
  Here the source address is included as a parameter in order to 
 select a
  gateway that is directly reachable on the corresponding physical
  interface. Note that this model logically requires that in general 
 there
  be at least one default gateway, and preferably multiple defaults, for
  each IP source address.

 Well, that excerpt is one of 2 possibilities in the RFC. The other
 possibility is to do like lwIP does. I admit though that it looks kind
 of strange sending packets with IP address A to the interface B just
 because you have a matching destination gateway on that netif...
You are correct that it is only 1 of the 2 possibilities, and as 
indicated I am not familiar with the design of lwIP. So it's a perfectly 
valid choice NOT to support sourcebased routing.

 By now, I'm tempted to add source-based routing as an option, although I
 expect people using lwIP wih more than one interface being only a small
 percentage...
I beg to differ
In my opinion the best approach to deal with vlans is to have multiple 
interfaces and then I think one is required to do sourcebased routing. 
Otherwise datagrams destined for a host on one vlan can be visible on 
another vlan (which is obviously undesirable).
Multiple stacks is a possibility here as well, but in embedded designs 
hardly an option

Erik


 Simon

 ___
 lwip-users mailing list
 [hidden email] /user/SendEmail.jtp?type=nodenode=23524i=0
 https://lists.nongnu.org/mailman/listinfo/lwip-users


 
 If you reply to this email, your message will be added to the 
 discussion below:
 http://lwip.100.n7.nabble.com/Sending-to-a-non-local-network-without-default-netif-set-tp22981p23524.html
  

 To unsubscribe from Sending to a non-local network without default 
 netif set, click here 
 http://lwip.100.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=22981code=ZXZ2ZWVsZW5AYWltdmFsbGV5Lm5sfDIyOTgxfC01NzI0OTAwNzY=.
 NAML 
 http://lwip.100.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
  


-- 
Erik van Veelen
AimValley B.V.
Utrechtseweg 38, 1213 TV Hilversum, The Netherlands
Tel: +31 35 689 1929, Fax: +31 35 689 1901
AimValley certificate 
http://www.aimvalley.com/aimvalley-ca-certificate-2007.crt




--
View this message in context: 
http://lwip.100.n7.nabble.com/Sending-to-a-non-local-network-without-default-netif-set-tp22981p23525.html
Sent from the lwip-users mailing list archive at Nabble.com.___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Sending to a non-local network without default netif set

2014-11-14 Thread goldsi...@gmx.de

HaaCee2 wrote:

I beg to differ


I've added a task for this to the tracker:

https://savannah.nongnu.org/task/index.php?13397


Simon
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread Sylvain Rochet
Hi chrysn,

On Fri, Nov 14, 2014 at 05:43:47PM +0100, chrysn wrote:
 
 i was afraid so when i first saw them, but i never ran into an
 UNDER-VOLTAGE POWER DOWN condition so far; thing is, i'm running my
 entire board off 3.3V, which is the threshold for the warning. the
 module can do down to 3.2V, and a 2m2 cap in parallel with a 4u7 and
 100n make sure it won't even if the usb power supply doesn't handle
 bursts well.
 
 i hope it's sufficient -- or are you confident that this is indication
 of trouble even when running on 3v3?

GSM modems connected to anything else than a li-ion battery should 
really be powered with a 3.8V 2A-peak low ripple power supply with 
enough decoupling capacitors (300 µF at least if powered through a DC/DC 
converter) for them to work correctly.

Sylvain


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] hayes commands popping up in ppp stream

2014-11-14 Thread nkarakotas
Hi,


The product is fine,I have been using the SIM900D without any problems in many 
different countries as well. It may run for a days without dropping the 
connection. Obviously you have a hardware issue as your not supplying enough 
voltage or power supply voltage drops when the gsm signal is low and requires 
2W.  Also it maybe a setup problem. Are you setting up the SIM900d as 
transparent mode?


const char *AT_CIPMODE = AT+CIPMODE=1\r;  
err = sim_send_recv(AT_CIPMODE,13,buf,length,br);







Nick





From: chrysn
Sent: ‎Friday‎, ‎14‎ ‎November‎ ‎2014 ‎6‎:‎39‎ ‎PM
To: lwip-users@nongnu.org





hello lwip users,

i'd like to keep track of my gsm device's position while a ppp data
connection is active. unfortunately, that means that the non-ppp
messages (/\r\n+CENG:[0-9,a-f]+\r\n/ in my case) arrive in the same
stream as ppp messages. (at least, it appears, they are not fully
interleaved).

does the lwip ppp stack provide a mechanism to feed back rejected
strings somewhere else, or do i need to inspect the ppp stack's internal
state from outside, determine whether it is currenlty inside or outside
of a frame, and divert \r\n... sequences from it if no frame is
currently being received?

for reference, i'm working with lwip master branch, and the modem i'm
using is a simcom sim900d. apart from the CENG messages, occasional
\r\nUNDER-VOLTAGE WARNNING\r\n (sic) messages appear, and those can't
be switched off.

best regards
chrysn

-- 
This may seem a bit weird, but that's okay, because it is weird.
  -- perldata(1) about perl variables___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users