Hi Mikkel,

For issue 1 we took a slightly different approach and used the attached 
patch.

Sean

Mikkel Christensen wrote:
> Hi all,
>
> Sorry for the long post, but thought this might also help others
> trying to get PPP over GPRS running on Android!
>
> We are trying to get data call working on Android with the reference
> RIL for Omapzoom board. We are using a 3GPP 07.10 Multiplexer that
> will carry an AT command channel (for control) and a second channel
> for PPP data.
>
> We have set the property “ro.radio.use-ppp yes” and this gives
> problems. We have identified four potential problem areas that we have
> made work-a round’s for, but still with no success. If somebody has a
> good advice it is really appreciated. We are not running iptables.
>
>
> Issue 1)
>
>
> In File /telephony/java/com/android/internal/telephony/gsm/
> GSMPhone.java in the constructor a new DataConnectioTracker is
> created.
> 144      mDataConnection = new DataConnectionTracker (this);
>
>
> In /telephony/java/com/android/internal/telephony/gsm/
> DataConnectionTracker.java the constructor calls the function
> createAllPdpList.
> 319     createAllPdpList();
>
>
> This function creates a new PdpConnection which takes a phone object
> as a parameter.
>
>
> 1459     private void createAllPdpList() {
> 1460       pdpList = new ArrayList<PdpConnection>();
> 1461       PdpConnection pdp;
> 1462
> 1463       for (int i = 0; i < PDP_CONNECTION_POOL_SIZE; i++) {
> 1464             pdp = new PdpConnection(phone);
> 1465             pdpList.add(pdp);
> 1466          }
> 1467     }
>
>
> In the file /telephony/java/com/android/internal/telephony/gsm/
> PdpConnection.java the constructor has a check if the property “use-
> ppp” is set to yes.
>
>
> 157         if (SystemProperties.get("ro.radio.use-ppp","no").equals
> ("yes")) {
> 158           dataLink = new PppLink(phone.mDataConnection);
> 159           dataLink.setOnLinkChange(this, EVENT_LINK_STATE_CHANGED,
> null);
> 160         }
>
>
> The problem is that a new PppLink is created which takes
> phone.mDataConnection as a parameter. The problem is that this is in
> fact the object that we are in the process of instantiating, so we
> cannot pass it along at this moment. This results in a NULL pointer
> exception when code later on tries to access the mDataConnection.
>
> As a work around we commented out the createAllPdpList() call in the
> DataConnectionTracker constructor. We also made the createAllPdpList
> function public and added to GSMPhone constructor a call to this:
>
> 144      mDataConnection = new DataConnectionTracker (this);
> //Workaround start
> mDataConnection.createAllPdpList(this);
> //Workaround end
> 145      mSimCard = new GsmSimCard(this);
>
>
> Issue 2)
>
>
> In file /telephony/java/com/android/internal/telephony/gsm/
> PppLink.java we also found that the checkPPP() function never would
> find the PPP link to be in up (or unknown) state if the following
> statement was never true:
>
>
> 151            // Unfortunately, we're currently seeing operstate
> 152            // "unknown" where one might otherwise expect "up"
> 153            if (ArrayUtils.equals(mCheckPPPBuffer, UP_ASCII_STRING,
> UP_ASCII_STRING.length)
> 154                    || ArrayUtils.equals(mCheckPPPBuffer,
> UNKNOWN_ASCII_STRING,
> 155                           UNKNOWN_ASCII_STRING.length)
> 156                             && dataConnection.state ==
> State.CONNECTING) {
>
>
> The problem is that in the file "/sys/class/net/ppp0/operstate “ will
> only say "unknown" when the link is up and we cannot see anywhere that
> dataConnection.state was set to CONNECTING.
> To overcome this we set dataConnection.state = State.CONNECTING in the
> connect() function in the file. This makes Android aware of the PPP
> link that is established.
>
> Issue 3)
>
> In file /core/java/android/net/MobileDataStateTracker.java we saw
> problems with the DNS servers not being set correctly if we did not
> add ppp0 to the sDnsPropNames list:
>
> 53    private static final String[] sDnsPropNames = {
> 54          "net.rmnet0.dns1",
> 55          "net.rmnet0.dns2",
> 56          "net.eth0.dns1",
> 57          "net.eth0.dns2",
> 58          "net.eth0.dns3",
> 59          "net.eth0.dns4",
> 60          "net.gprs.dns1",
> 61          "net.gprs.dns2",
> //Workaround start
>               “net.ppp0.dns1”,
>               “net.ppp0.dns2”,
> //Workaround end
> 62     };
>
>
>
> Issue 4)
>
>
> In file /telephony/java/com/android/internal/telephony/gsm/
> PdpConnection.java in function handleMessage() in case of
> EVENT_SETUP_PDP_DONE we also found a potential problem.
> This event is received when a PDP context has been established in the
> Reference RIL. The reponse from from the Reference RIL contains a
> context ID and the interface name. The present code will only set the
> local variables like “interfaceName” and “ipAddress” if there are more
> than 2 responses from the reference RIL.
>
>
> 403   if (response.length > 2) {
>
>
> This is not the case so we added the following code:
> 401  cid = Integer.parseInt(response[0]);
> //Workaround start
> interfaceName = response[1];
> {
>  String prefix = "net." + interfaceName + ".";
>  ipAddress = SystemProperties.get(prefix + "local-ip");
>  gatewayAddress = SystemProperties.get(prefix + "gw");
>  dnsServers[0] = SystemProperties.get(prefix + "dns1");
>  dnsServers[1] = SystemProperties.get(prefix + "dns2");
> }
> //Workaround end
> 403   if (response.length > 2) {
>
>
>
> Unfortunately we are still not getting any data trough either trough
> the web browser or trough ping. Here is a log with pppd and netcfg.
> The ping never goes trough.
>
>
> # logcat  pppd:V *:S&
> # <6>android_power: wakeup (0->0) at 18931640625 (2000-01-02
> 02:18:20.748687745 UTC)
> android_power: wakeup (0->0) at 18931640625 (2000-01-02
> 02:18:20.748687745 UTC)
> I/pppd    (  812): Starting pppd
> D/pppd    (  813): pppd options in effect:
> D/pppd    (  813): debug                # (from command line)
> D/pppd    (  813): nodetach             # (from command line)
> D/pppd    (  813): dump         # (from command line)
> D/pppd    (  813): noauth               # (from command line)
> D/pppd    (  813): /dev/pts/1           # (from command line)
> D/pppd    (  813): 460800               # (from command line)
> D/pppd    (  813): crtscts              # (from command line)
> D/pppd    (  813): novj         # (from command line)
> D/pppd    (  813): novjccomp            # (from command line)
> D/pppd    (  813): ipcp-accept-local            # (from command line)
> D/pppd    (  813): ipcp-accept-remote           # (from command line)
> D/pppd    (  813): noipdefault          # (from command line)
> D/pppd    (  813): defaultroute         # (from command line)
> D/pppd    (  813): usepeerdns           # (from command line)
> D/pppd    (  813): using channel 1
> D/pppd    (  813): Using interface ppp0
> D/pppd    (  813): Connect: ppp0 <--> /dev/pts/1
> D/pppd    (  813): sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic
> 0x95cdd2fc> <pcomp> <accomp>]
> D/pppd    (  813): rcvd [LCP ConfRej id=0x1 <magic 0x95cdd2fc>]
> D/pppd    (  813): sent [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp>
> <accomp>]
> D/pppd    (  813): rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp>
> <accomp>]
> D/pppd    (  813): rcvd [LCP ConfReq id=0x1 <auth chap MD5> <pcomp>
> <accomp>]
> D/pppd    (  813): No auth is possible
> D/pppd    (  813): sent [LCP ConfRej id=0x1 <auth chap MD5>]
> D/pppd    (  813): rcvd [LCP ConfReq id=0x2 <pcomp> <accomp>]
> D/pppd    (  813): sent [LCP ConfAck id=0x2 <pcomp> <accomp>]
> D/pppd    (  813): sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1
> 0.0.0.0> <ms-dns3 0.0.0.0>]
> D/pppd    (  813): sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1
> 0.0.0.0> <ms-dns3 0.0.0.0>]
> D/pppd    (  813): rcvd [IPCP ConfReq id=0x1]
> D/pppd    (  813): sent [IPCP ConfNak id=0x1 <addr 0.0.0.0>]
> D/pppd    (  813): rcvd [IPCP ConfNak id=0x1 <addr 25.239.167.204> <ms-
> dns1 66.94.9.120> <ms-dns3 66.94.25.120>]
> D/pppd    (  813): sent [IPCP ConfReq id=0x2 <addr 25.239.167.204> <ms-
> dns1 66.94.9.120> <ms-dns3 66.94.25.120>]
> D/pppd    (  813): rcvd [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
> D/pppd    (  813): sent [IPCP ConfRej id=0x2 <addr 0.0.0.0>]
> D/pppd    (  813): rcvd [IPCP ConfAck id=0x2 <addr 25.239.167.204> <ms-
> dns1 66.94.9.120> <ms-dns3 66.94.25.120>]
> D/pppd    (  813): rcvd [IPCP ConfReq id=0x3]
> D/pppd    (  813): sent [IPCP ConfAck id=0x3]
> D/pppd    (  813): Could not determine remote IP address: defaulting
> to 10.64.64.64
> D/pppd    (  813): local  IP address 25.239.167.204
> D/pppd    (  813): remote IP address 10.64.64.64
> D/pppd    (  813): primary   DNS address 66.94.9.120
> D/pppd    (  813): secondary DNS address 66.94.25.120
> D/pppd    (  813): Script /etc/ppp/ip-up started (pid 821)
> D/pppd    (  813): Script /etc/ppp/ip-up finished (pid 821), status =
> 0x0
> E/NetworkStateTracker(  675): net.tcp.buffersize.unknown not found in
> system properties. Using defaults
> E/NetworkStateTracker(  675): Can't set tcp buffer
> sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/tcp_rmem_min
> #
> #
> # netcfg
> lo       UP    127.0.0.1       255.0.0.0       0x00000049
> eth0     DOWN  0.0.0.0         0.0.0.0         0x00001002
> ppp0     UP    25.239.167.204  255.255.255.255 0x000010d1
> #
> #
> # ping www.google.com -I ppp0&
>
>
>
> >
>   


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

diff --git a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
index 79e48f9..057da72 100644
--- a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
@@ -153,11 +153,6 @@ public class PdpConnection extends Handler {
         this.dataLink = null;
         receivedDisconnectReq = false;
         this.dnsServers = new String[2];
-
-        if (SystemProperties.get("ro.radio.use-ppp","no").equals("yes")) {
-            dataLink = new PppLink(phone.mDataConnection);
-            dataLink.setOnLinkChange(this, EVENT_LINK_STATE_CHANGED, null);
-        }
     }
 
     /**
@@ -197,6 +192,7 @@ public class PdpConnection extends Handler {
         if (state == PdpState.ACTIVE) {
             if (dataLink != null) {
                 dataLink.disconnect();
+                dataLink = null;
             }
 
             if (phone.mCM.getRadioState().isOn()) {
@@ -422,10 +418,17 @@ public class PdpConnection extends Handler {
                                 break;
                             }
                         }
-                        
+
+                        if (SystemProperties.get("ro.radio.use-ppp","no").equals("yes")) {
+                            dataLink = new PppLink(phone.mDataConnection);
+                            dataLink.setOnLinkChange(this, EVENT_LINK_STATE_CHANGED, null);
+                        }
+
                         if (dataLink != null) {
+                            if (DBG) log("PDP connecting to dataLink");
                             dataLink.connect();
                         } else {
+                            if (DBG) log("PDP there is no dataLink");
                             onLinkStateChanged(DataLink.LinkState.LINK_UP);
                         }
                         

Reply via email to