This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PPP connection dinamically configured

With RL-TCPnet library my PPP situation is:
1) setting PPP Local IP address = 0.0.0.0 in Net_Config.c, I successfully establish a PPP connection with my isp using ppp_connect (i get a public PPP IP address): everything works fine.
2) with identical software, i change only the PPP Local IP address in Net_Config.c, setting it to 10.0.0.1.
Reloading the target, i can't establish the ppp connection with isp. Monitoring the PPP protocol with PPP_monitor utility (i send all frames between CPU and modem to the PC using 2 serial ports on my target), i see that, after a successfull PAP, the target sends a IPCP Configure Request with IP=10.0.0.1. At this point, the isp hangs up.
3) now i delete the ppp_connect and use ppp_listen. From my pc i phone to the target. Now the situation is the reverse: if i set PPP IP local address in Net_config.c at 10.0.0.1, PC can connect successfully to my target. But if i set 0.0.0.0, PC can't connect. Once again, the problem is in the IPCP handshake.
4) i need to configure dinamically my kind of connection: at target startup i must decide if call a ppp_connect or a ppp_listen. I have tried to change localm[NETIF_PPP].IpAdr variable before init_TcpNet, without success. It seems that the library uses only nlocalm structure, but i can't change it. Any help will be greatly appreciated.
Regards.

  • Please enable Obtain Client IP address automatically in the Net_Config.c

    This will ignore the default PPP IP address for the PPP Client for ppp_connect. In other words, if you set PPP IP address in Net_Config.c to 10.0.0.1 and you have the above option enabled, the PPP module treats it as if it is set to 0.0.0.0

    When you use ppp_listen then a default IP address from Net_Config.c is used.

    In this way your application should work for both PPP Server and PPP client mode without any modifications to Net_Config.c configuration.

    Franc

  • Many thanks for your reply, Franc.
    I have enabled Obtain Client IP address automatically in the Net_Config.c, but the result has been the same. I have now tried this workaround, and it seems to work: i have commented "const" near nlocalm[] declaration in Net_Config.c; than, before calling the init_TcpNet, i set to 0.0.0.0 the nlocalm[NETIF_PPP].IpAdr[] field if i am configured for ppp_connect; and set this field to 10.0.0.1 if i am configured for ppp_listen.
    Do you think it is correct ?
    P.S. i have done another test, with a result that i don't understand: with 10.0.0.1 in Net_Config.c, obtain ip address ... enabled, ppp_connect works if the baudrate vs. modem is 9600 baud. If baudrate vs. modem is 38400, ppp_connect does not work. Please note, in both cases modem answers correctly to my driver (i see it with ppp_monitor). Furthermore, if with the setting of 38400 i change the PPP ip address in Net_Config.c with 0.0.0.0, ppp_connect again works fine...
    Thanks again and best regards.