kyujin-cho / pixel-volte-patch

Pixel IMS: Rootless replacement for Tensor Pixel VoLTE patch
GNU General Public License v3.0
1.29k stars 87 forks source link

WiFi calling does not work on airplane mode with WiFi connection #2 #152

Open chuckman opened 1 year ago

chuckman commented 1 year ago

Creating a new issue as I'm not sure you will see the #15 as it is closed. First of all again, thank you for your work, it really is a shame that ISP/manufacturers cannot make this work. I have a Pixel 6 with Movistar in Spain and cannot get VoWifi to work while in airplane mode and connected to wifi only, while it works when also connected to 4G/5G (not 3G as then it doesn't get IMS registration). With the same SIM on a Samsung Galaxy S10+ (Exynos version), VoWifi works perfectly while in airplane mode. Here is the carrier config of the Galaxy S10+: s10p-carrier_config.txt This was the file submitted by @combathero32: carrier_config.txt I hope with your experience you can identify where the issue might come from. I have both devices here and can help / provide any further info that you need. I'm hopeful with your help we will make it work this time.

chuckman commented 1 year ago

I grabbed a logcat of the Pixel 6 just after turning ON the VoWifi settings and I see the following errors:

EpdgTunnelManager[0]: Closing tunnel with exception for apn: ims with token: 4 sessionType:5 error: TYPE: IWLAN_IKE_PROTOCOL_EXCEPTION ERR: 7

06-15 22:08:38.899  2833  3342 I IKE     : IkeSessionStateMachine: handleReceivedIkePacket: Protected error
06-15 22:08:38.899  2833  3342 I IKE     : android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute

06-15 22:10:31.294  2833  3337 D IwlanDataService[0]: Tunnel closed!. APN: ims Error: TYPE: IWLAN_IKE_PROTOCOL_EXCEPTION ERR: 7

06-15 22:08:38.004  2833  2899 D IwlanDataService[0]: Setup data call with network: 5, DataProfile: [DataProfile=[ApnSetting] IMS, 4760, 21407, ims, , null, , null, null, 0, ims, IPV4V6, IPV4V6, true, 0, false, 0, 0, 0, 0, 0, null, , false, LTE|IWLAN|NR, UNKNOWN, 0, 34, -1, false, TrafficDescriptor={mDnn=ims, null}, preferred=false], isRoaming:false, allowRoaming: false, reason: 1, linkProperties: null, pduSessionId: 5

06-15 22:08:38.905  2333  2333 I SHANNON_IMS: 1436 [PROX] onPreciseDataConnectionStateChanged [ ApnName:ims, ConnectionState:DATA_DISCONNECTED, ConnectionId: -1, NetworkType: IWLAN, ApnType: APN_IMS, failCause: PDN_FAIL_CAUSE_IWLAN_NETWORK_FAILURE] [SLID:0 APM:true] (ImsConnectivityProxyListener$ImsPhoneStateListener%onPreciseDataConnectionStateChanged:487)
06-15 22:08:38.906  2333  2333 I SHANNON_IMS: 1439 [ADAP] Sending Registration Info STATE : DEREGISTERED RAT : 0 [SLID:0 ] (RegistrationAdaptor%sendRegistrationState:678)

Looks like an error on the IKE/IPSEC connection with the epdg server, especially this complain about dh group 16, which is 4096-bit modulus.

Some more details on the edpg server that it's trying to connect to:

06-15 22:08:38.028  2833  5468 D EpdgSelector: STATIC Method
06-15 22:08:38.030  2833  5468 D EpdgSelector: simCountry = es, currentCountry = ES
06-15 22:08:38.034  2833  5468 D EpdgSelector: Static Domain Names: [epdg.epc.mnc007.mcc214.pub.3gppnetwork.org]
06-15 22:08:38.045  2833  3337 D EpdgTunnelManager[0]: Valid ePDG Address List: [/213.4.100.137, /213.4.100.129, /213.4.100.153, /213.4.100.145], index = 0
06-15 22:08:38.045  2833  3337 D EpdgTunnelManager[0]: Bringing up tunnel for apn: imsePDG : 213.4.100.137
06-15 22:08:38.045  2833  3337 D EpdgTunnelManager[0]: Added token: 4 for apn: ims
06-15 22:08:49.166  2833  3337 E EpdgTunnelManager[0]: Invalid config value for dh group:16

@kyujin-cho Happy to share the whole file (~500kB) although would rather do it privately as it may contain personal info.

Edit: fix formatting

chuckman commented 1 year ago

Sorry for the persistence, I have spent countless hours trying to identify this issue and looks like I'm making progress.

Logcat from S10+ just after activating VoWifi in airplane mode + Wifi:

06-15 22:35:02.144  1487  1500 I eris    : 09[NET] received packet: from 213.4.100.137[500] to xxxxxxx[xxx] (38 bytes)
06-15 22:35:02.144  1487  1500 I eris    : 09[ENC] parsed IKE_SA_INIT response 0 [ N(INVAL_KE) ]
06-15 22:35:02.144  1487  1500 I eris    : 09[IKE] peer didn't accept DH group MODP_1024, it requested MODP_2048
06-15 22:35:02.144  1487  1500 I eris    : 09[IKE] initiating IKE_SA ims[1] to 213.4.100.137
06-15 22:35:02.166  1487  1500 I eris    : 09[ENC] generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(REDIR_SUP) ]
06-15 22:35:02.166  1487  1500 I eris    : 09[NET] sending packet: from xxxxxxxxxxx[xx] to 213.4.100.137[500] (504 bytes)
06-15 22:35:02.188  1487  1502 I eris    : 10[NET] received packet: from 213.4.100.137[500] to xxxxxxxxx[xxx] (416 bytes)
06-15 22:35:02.188  1487  1502 I eris    : 10[ENC] parsed IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) ]
06-15 22:35:02.210  1487  1502 I eris    : 10[IKE] local host is behind NAT, sending keep alives
06-15 22:35:02.210  1487  1502 I eris    : 10[IKE] establishing CHILD_SA ims{1}
06-15 22:35:02.210  1487  1502 I eris    : 10[ENC] generating IKE_AUTH request 1 [ IDi N(INIT_CONTACT) IDr CPRQ(MASK ADDR DNS PCSCF4 ADDR6 DNS6 PCSCF6) N(ESP_TFC_PAD_N) SA TSi TSr N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]

However, when comparing the carrier_config files, both have the option below: iwlan.supported_ike_session_encryption_algorithms_int_array = [12]

Edit: fix formatting

kyujin-cho commented 1 year ago

Hi! Maybe we can start from enabling bunch of other encryption algorithms. Android documentation describes that KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY(iwlan.diffie_hellman_groups_int_array) takes charge of controlling available DH group of cellphone side. Maybe we can start by adding all available DH group identifier here. Can you try following these?

  1. Visit your SIM config page at Pixel IMS app
  2. Click Manually Set Config section
  3. Set iwlan.diffie_hellman_groups_int_array as Key, IntArray as Value Type, and 2,5,24,15,16 as value (this should mark all available DH group as supported algorithm, check here for more)
  4. Click Confirm to save

After following these, please retry enabling VoWiFi on airplane mode.

chuckman commented 1 year ago

Hi kyujin-cho, thanks for taking the time and effort to try to fix this. Just tried adding the both: iwlan.diffie_hellman_groups_int_array and KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY (just in case) but I get a Cannot find specified keymessage.

BTW, I tried the values you gave 2,5,24,15,16 but also 2,5,14,15,16 which I believe is the correct one as I don't see a group with value 24. Still none of them are accepted and I still get the message above.

Any way to force that custom config?

kyujin-cho commented 1 year ago

@chuckman

Just tried adding the both: iwlan.diffie_hellman_groups_int_array and KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY (just in case) but I get a Cannot find specified keymessage.

Thanks for the update. After reviewing the code I found that current implementation does not allow updating values referenced by keys which are subset of a root key (iwlan in this case). I've created a new PR #158 to resolve this issue. Could you try once again with this APK?

BTW, I tried the values you gave 2,5,24,15,16 but also 2,5,14,15,16 which I believe is the correct one as I don't see a group with value 24. Still none of them are accepted and I still get the message above.

Oops, you were right. I've made a typo.

chuckman commented 1 year ago

@kyujin-cho , sorry, can't install the APK:

adb: failed to install Downloads/dev.bluehouse.enablevolte.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl814833368.tmp/base.apk: Attempt to get length of null array] Thanks

kyujin-cho commented 1 year ago

@chuckman Ah, sorry. Forgot to sign the APK. here is the updated link.

chuckman commented 1 year ago

@kyujin-cho Apologies for the radio silence. Yesterday I installed your APK, updated the iwlan.diffie_hellman_groups_int_array to different values, but basically, as seen from the S10+ logcat, the server prefers group 14 so I just used that value. The dh group 16 error is not there anymore, there's more progress on establishing the IKE tunnel, but then a new error appears: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute Below is the logcat from the Pixel 6, after setting the DH int array to only 14 and after adding an ims and xcap APNs, as I've seen some users of your patch have solved their issues that way:

06-18 16:39:39.664  2322  3048 D TmHandler: msg.what = EVENT_EPDG_ADDRESS_SELECTION_REQUEST_COMPLETE
06-18 16:39:39.664  2322  3048 D EpdgTunnelManager[0]: EVENT_EPDG_ADDRESS_SELECTION_REQUEST_COMPLETE
06-18 16:39:39.664  2322  3048 D EpdgTunnelManager[0]: mPendingBringUpRequests: [com.google.android.iwlan.epdg.EpdgTunnelManager$TunnelRequestWrapper@a743638]
06-18 16:39:39.664  2322  3048 D EpdgTunnelManager[0]: Valid ePDG Address List: [/213.4.100.137, /213.4.100.129, /213.4.100.153, /213.4.100.145], index = 1
06-18 16:39:39.664  2322  3048 D EpdgTunnelManager[0]: Bringing up tunnel for apn: imsePDG : 213.4.100.129
06-18 16:39:39.664  2322  3048 D EpdgTunnelManager[0]: Added token: 9 for apn: ims
06-18 16:39:39.690  2322  3048 D EpdgTunnelManager[0]: getLocalIdentification: Nai: 0214075553190673@nai.epc.mnc007.mcc214.3gppnetwork.org
06-18 16:39:39.714  2322  3048 D EpdgTunnelManager[0]: getEapConfig: Nai: 0214075553190673@nai.epc.mnc007.mcc214.3gppnetwork.org
06-18 16:39:39.754  2322  3048 D EpdgTunnelManager[0]: getRetransmissionTimeoutsFromConfig: [500, 1000, 2000, 4000, 8000]
06-18 16:39:39.759  2322  3048 D EpdgTunnelManager[0]: IKE_OPTION_INITIAL_CONTACT
06-18 16:39:39.769  2322  3048 D EpdgTunnelManager[0]: KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY : [1, 2]
06-18 16:39:39.785  2322  3048 D EpdgTunnelManager[0]: Invalid child session lifetime values, set hard: 14400, soft: 14340
06-18 16:39:39.820  2322  3048 D EpdgTunnelManager[0]: Added apn: ims to TunnelConfig
06-18 16:39:39.822  2322  3052 D TrafficStats: tagSocket(77) with statsTag=0x3e8, statsUid=-1
06-18 16:39:39.826  2322  3052 D TrafficStats: tagSocket(77) with statsTag=0x3e8, statsUid=-1
06-18 16:39:39.827  2322  3052 D TrafficStats: tagSocket(77) with statsTag=0x3e8, statsUid=-1
06-18 16:39:39.831  1313  1721 D ConnectivityService: NetReassign [no changes]
06-18 16:39:39.950  2322  3052 W IKE     : IkeNotifyPayload: Expected Procotol ID unset: Protocol ID is 1
06-18 16:39:39.950  2322  3052 W IKE     : IkeNotifyPayload: Expected Procotol ID unset: Protocol ID is 1
06-18 16:39:39.953  1313  3187 D TrafficStats: tagSocket(466) with statsTag=0xffffffff, statsUid=-1
06-18 16:39:39.954  1313  3187 D TrafficStats: tagSocket(482) with statsTag=0xffffffff, statsUid=1000
06-18 16:39:39.957  1313  3187 D TrafficStats: tagSocket(466) with statsTag=0xffffffff, statsUid=-1
06-18 16:39:39.958  1313  3187 V IpSecService: Binding to port 52794
06-18 16:39:39.964  1313  1426 D KeepaliveTracker: Created keepalive: KeepaliveInfo [ type=1 network=100 startedState=NOT_STARTED 192.168.69.249:52794->213.4.100.129:4500 interval=20 uid=1000 pid=2322 privileged=true packetData=4500001D0000000040113AA9C0A845F9D5046481CE3A11940009E0E4FF ]
06-18 16:39:39.964  2322  3052 D IKE     : new IkeAlarmWithListener for IkeAlarmReceiver.ACTION_DELETE_IKE
06-18 16:39:39.964  2322  3052 D IKE     : new IkeAlarmWithListener for IkeAlarmReceiver.ACTION_REKEY_IKE
06-18 16:39:39.964  1313  1721 D KeepaliveTracker: Starting keepalive 1 on [100 WIFI]
06-18 16:39:39.967  1868  2535 D ApfFilter: (wlan0): Adding NAT-T keepalive packet(1)
06-18 16:39:39.971   804   804 D WifiHAL : Start mkeep_alive command
06-18 16:39:39.977  1313  1721 D KeepaliveTracker: Started keepalive 1 on [100 WIFI]
06-18 16:39:39.977   804   804 D WifiHAL : Setting APF program, halHandle = 0xb400c01c5a49a540
06-18 16:39:39.977   804   804 I WifiHAL : createRequest: APF set program request
06-18 16:39:39.989   804   804 I WifiHAL : Done!
06-18 16:39:40.006  4698  4938 D BinderSender: onUidIdle: uid=10082, disabled=false
06-18 16:39:40.006  4698  4938 V BinderSender: Uid 10082 starts
06-18 16:39:40.007  4698  4938 D BinderSender: sendBinder to uid 10082: packages=app.vanadium.webview
06-18 16:39:40.018  1313  1426 D IpSecService: Allocated SPI 1114994644
06-18 16:39:40.374  2322  5472 I EAP     : CreatedState: Decoded message: EAP-REQUEST/EAP-AKA
06-18 16:39:40.375  2322  5472 I EAP     : MethodState: Decoded message: EAP-REQUEST/EAP-AKA
06-18 16:39:40.376  2322  5472 I EAP     : EapAkaTypeDataDecoder: Decoded EAP-AKA type data: Challenge attributes=[ AT_RAND AT_AUTN AT_MAC AT_CHECKCODE ]
06-18 16:39:40.376  2322  5472 I EAP     : EapAkaTypeDataDecoder: Decoded EAP-AKA type data: Challenge attributes=[ AT_RAND AT_AUTN AT_MAC AT_CHECKCODE ]
06-18 16:39:40.495  2322  3052 I EAP     : EapAuthenticator: EapStateMachine returned EapResponse
06-18 16:39:40.537  4698  4938 D BinderSender: onUidIdle: uid=10043, disabled=false
06-18 16:39:40.538  4698  4938 V BinderSender: Uid 10043 starts
06-18 16:39:40.539  4698  4938 D BinderSender: sendBinder to uid 10043: packages=com.stevesoltys.seedvault
06-18 16:39:40.915  2322  5472 I EAP     : MethodState: Decoded message: EAP-SUCCESS
06-18 16:39:40.915  2322  3052 I EAP     : EapAuthenticator: EapStateMachine returned EapSuccess
06-18 16:39:40.938  2322  3052 I IKE     : IkeSessionStateMachine: handleReceivedIkePacket: Protected error
06-18 16:39:40.938  2322  3052 I IKE     : android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.validateNetmaskInReply(IkeConfigPayload.java:160)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.<init>(IkeConfigPayload.java:124)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory$IkePayloadDecoder.decodeIkePayload(IkePayloadFactory.java:90)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory.getIkePayload(IkePayloadFactory.java:158)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decodePayloadList(IkeMessage.java:210)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.-$$Nest$smdecodePayloadList(Unknown Source:0)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:828)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:722)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decode(IkeMessage.java:182)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1809)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.processStateMessage(IkeSessionStateMachine.java:1713)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$CreateIkeLocalIkeAuthPostEap.processStateMessage(IkeSessionStateMachine.java:4257)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.AbstractSessionStateMachine$ExceptionHandlerBase.processMessage(AbstractSessionStateMachine.java:147)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.processMsg(StateMachine.java:993)
06-18 16:39:40.938  2322  3052 I IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.handleMessage(StateMachine.java:810)
06-18 16:39:40.938  2322  3052 I IKE     :      at android.os.Handler.dispatchMessage(Handler.java:106)
06-18 16:39:40.938  2322  3052 I IKE     :      at android.os.Looper.loopOnce(Looper.java:201)
06-18 16:39:40.938  2322  3052 I IKE     :      at android.os.Looper.loop(Looper.java:288)
06-18 16:39:40.938  2322  3052 I IKE     :      at android.os.HandlerThread.run(HandlerThread.java:67)
06-18 16:39:40.943  2322  3052 E IKE     : IkeSessionStateMachine: IKE Session fatal error in CreateIkeLocalIkeAuthPostEap
06-18 16:39:40.943  2322  3052 E IKE     : android.net.ipsec.ike.exceptions.InvalidSyntaxException: Generic processing error in the received response
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1842)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.processStateMessage(IkeSessionStateMachine.java:1713)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$CreateIkeLocalIkeAuthPostEap.processStateMessage(IkeSessionStateMachine.java:4257)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.AbstractSessionStateMachine$ExceptionHandlerBase.processMessage(AbstractSessionStateMachine.java:147)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.processMsg(StateMachine.java:993)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.handleMessage(StateMachine.java:810)
06-18 16:39:40.943  2322  3052 E IKE     :      at android.os.Handler.dispatchMessage(Handler.java:106)
06-18 16:39:40.943  2322  3052 E IKE     :      at android.os.Looper.loopOnce(Looper.java:201)
06-18 16:39:40.943  2322  3052 E IKE     :      at android.os.Looper.loop(Looper.java:288)
06-18 16:39:40.943  2322  3052 E IKE     :      at android.os.HandlerThread.run(HandlerThread.java:67)
06-18 16:39:40.943  2322  3052 E IKE     : Caused by: android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.validateNetmaskInReply(IkeConfigPayload.java:160)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.<init>(IkeConfigPayload.java:124)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory$IkePayloadDecoder.decodeIkePayload(IkePayloadFactory.java:90)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory.getIkePayload(IkePayloadFactory.java:158)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decodePayloadList(IkeMessage.java:210)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.-$$Nest$smdecodePayloadList(Unknown Source:0)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:828)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:722)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decode(IkeMessage.java:182)
06-18 16:39:40.943  2322  3052 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1809)
06-18 16:39:40.943  2322  3052 E IKE     :      ... 9 more
06-18 16:39:40.943  2322  5473 E EpdgTunnelManager[0]: Closing tunnel with exception for apn: ims with token: 9 sessionType:5 error: TYPE: IWLAN_IKE_PROTOCOL_EXCEPTION ERR: 7

Maybe you see something that I'm missing. Any ideas? Thanks again!

kyujin-cho commented 1 year ago

@chuckman Glad to hear you've made some progress. I've read the source code of IkeConfigPayload.java which originates the InvalidSyntaxException and it shows both INTERNAL_IP4_NETMASK and INTERNLA_IP4_ADDRESS are set by remote tunnel server, not by us. Perhaps this can be a side-effect of invalid carrier-related configuration of the local (android cellphone) side. Could you install this newer version of Pixel IMS app on both your Pixel and S10+ with SIM installed, go to Dump Config menu, long click the result (this should copy dumped config to clipboard), create the payload as new file and attach as a reply to this issue? Of course you can redact all sensitive informations.

chuckman commented 1 year ago

Hi there @kyujin-cho , thanks again for the help! Here are the files you requested, didn't see anything sensitive but let me know if you see something. S10+ Dump config: S10pdumpconfig.txt Pixel 6 Dump config: p6dumpconfig.txt Hope this helps!

kyujin-cho commented 1 year ago

Hmm, interesting. Looks like lots of WFC-related configs are actually disabled on the S10+, whilst being turned on the Pixel...

image image
kyujin-cho commented 1 year ago

@chuckman

image

These are the values which makes difference between S10+ and your Pixel. Can you try updating configuration to the ones highlighted on the right side and try again?

chuckman commented 1 year ago

Hi @kyujin-cho , I have added manually the values on the right side from the previous post, but no change. I see that it now complains about the empty epdg address (key_epdg_static_address_string) but still is able to find it, resolve the DNS to obtain the IP list and connect. After that, same error:

06-21 22:43:57.459  2423  5161 D EpdgSelector: plmnsFromCarrierConfig:[]
06-21 22:43:57.462  2423  5161 D EpdgSelector: plmnsFromSubInfo:[]
06-21 22:43:57.462  2423  5161 D EpdgSelector: Final plmn list:[214-07]
06-21 22:43:57.462  2423  5161 D EpdgSelector: Input domainName : epdg.epc.mnc007.mcc214.pub.3gppnetwork.org
06-21 22:43:57.479  2423  5161 D EpdgSelector: STATIC Method
06-21 22:43:57.481  2423  5161 D EpdgSelector: simCountry = es, currentCountry = ES
06-21 22:43:57.487  2423  5161 D EpdgSelector: iwlan.epdg_static_address_string string is null
06-21 22:43:57.487  2423  5161 D EpdgSelector: Static address string is null
06-21 22:43:57.487  2423  3026 D TmHandler: msg.what = EVENT_EPDG_ADDRESS_SELECTION_REQUEST_COMPLETE
06-21 22:43:57.487  2423  3026 D EpdgTunnelManager[0]: EVENT_EPDG_ADDRESS_SELECTION_REQUEST_COMPLETE
06-21 22:43:57.487  2423  3026 D EpdgTunnelManager[0]: mPendingBringUpRequests: [com.google.android.iwlan.epdg.EpdgTunnelManager$TunnelRequestWrapper@388450c]
06-21 22:43:57.487  2423  3026 D EpdgTunnelManager[0]: Valid ePDG Address List: [/213.4.100.129, /213.4.100.145, /213.4.100.137, /213.4.100.153], index = 0
06-21 22:43:57.487  2423  3026 D EpdgTunnelManager[0]: Bringing up tunnel for apn: imsePDG : 213.4.100.129
06-21 22:43:57.487  2423  3026 D EpdgTunnelManager[0]: Added token: 4 for apn: ims
06-21 22:43:57.514  2423  3026 D EpdgTunnelManager[0]: getLocalIdentification: Nai: 0214075553190673@nai.epc.mnc007.mcc214.3gppnetwork.org
06-21 22:43:57.544  2423  3026 D EpdgTunnelManager[0]: getEapConfig: Nai: 0214075553190673@nai.epc.mnc007.mcc214.3gppnetwork.org
06-21 22:43:57.601  2423  3026 D EpdgTunnelManager[0]: getRetransmissionTimeoutsFromConfig: [500, 1000, 2000, 4000, 8000]
06-21 22:43:57.607  2423  3026 D EpdgTunnelManager[0]: IKE_OPTION_INITIAL_CONTACT
06-21 22:43:57.618  2423  3026 D EpdgTunnelManager[0]: KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY : [1, 2]
06-21 22:43:57.665  2423  3026 D EpdgTunnelManager[0]: Added apn: ims to TunnelConfig
06-21 22:43:57.843  1319  2326 D IpSecService: Allocated SPI 135349908
06-21 22:43:58.011  2423  5167 I EAP     : CreatedState: Decoded message: EAP-REQUEST/EAP-AKA
06-21 22:43:58.011  2423  5167 I EAP     : MethodState: Decoded message: EAP-REQUEST/EAP-AKA
06-21 22:43:58.012  2423  5167 I EAP     : EapAkaTypeDataDecoder: Decoded EAP-AKA type data: Challenge attributes=[ AT_RAND AT_AUTN AT_MAC AT_CHECKCODE ]
06-21 22:43:58.013  2423  5167 I EAP     : EapAkaTypeDataDecoder: Decoded EAP-AKA type data: Challenge attributes=[ AT_RAND AT_AUTN AT_MAC AT_CHECKCODE ]
06-21 22:43:58.135  2423  3032 I EAP     : EapAuthenticator: EapStateMachine returned EapResponse
06-21 22:43:58.338  1319  1668 D OomAdjuster: Not killing cached processes
06-21 22:43:58.497   808   808 I WifiHAL : Creating message to get link statistics; iface = 47
06-21 22:43:58.506  2423  5167 I EAP     : MethodState: Decoded message: EAP-SUCCESS
06-21 22:43:58.507  2423  3032 I EAP     : EapAuthenticator: EapStateMachine returned EapSuccess
06-21 22:43:58.543  2423  3032 I IKE     : IkeSessionStateMachine: handleReceivedIkePacket: Protected error
06-21 22:43:58.543  2423  3032 I IKE     : android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.validateNetmaskInReply(IkeConfigPayload.java:160)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.<init>(IkeConfigPayload.java:124)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory$IkePayloadDecoder.decodeIkePayload(IkePayloadFactory.java:90)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory.getIkePayload(IkePayloadFactory.java:158)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decodePayloadList(IkeMessage.java:210)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.-$$Nest$smdecodePayloadList(Unknown Source:0)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:828)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:722)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decode(IkeMessage.java:182)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1809)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.processStateMessage(IkeSessionStateMachine.java:1713)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$CreateIkeLocalIkeAuthPostEap.processStateMessage(IkeSessionStateMachine.java:4257)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.AbstractSessionStateMachine$ExceptionHandlerBase.processMessage(AbstractSessionStateMachine.java:147)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.processMsg(StateMachine.java:993)
06-21 22:43:58.543  2423  3032 I IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.handleMessage(StateMachine.java:810)
06-21 22:43:58.543  2423  3032 I IKE     :      at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 22:43:58.543  2423  3032 I IKE     :      at android.os.Looper.loopOnce(Looper.java:201)
06-21 22:43:58.543  2423  3032 I IKE     :      at android.os.Looper.loop(Looper.java:288)
06-21 22:43:58.543  2423  3032 I IKE     :      at android.os.HandlerThread.run(HandlerThread.java:67)
06-21 22:43:58.546   808   808 I WifiHAL : In GetLinkStatsCommand::handleResponse
06-21 22:43:58.551  2423  3032 E IKE     : IkeSessionStateMachine: IKE Session fatal error in CreateIkeLocalIkeAuthPostEap
06-21 22:43:58.551  2423  3032 E IKE     : android.net.ipsec.ike.exceptions.InvalidSyntaxException: Generic processing error in the received response
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1842)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.processStateMessage(IkeSessionStateMachine.java:1713)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$CreateIkeLocalIkeAuthPostEap.processStateMessage(IkeSessionStateMachine.java:4257)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.AbstractSessionStateMachine$ExceptionHandlerBase.processMessage(AbstractSessionStateMachine.java:147)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.processMsg(StateMachine.java:993)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.handleMessage(StateMachine.java:810)
06-21 22:43:58.551  2423  3032 E IKE     :      at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 22:43:58.551  2423  3032 E IKE     :      at android.os.Looper.loopOnce(Looper.java:201)
06-21 22:43:58.551  2423  3032 E IKE     :      at android.os.Looper.loop(Looper.java:288)
06-21 22:43:58.551  2423  3032 E IKE     :      at android.os.HandlerThread.run(HandlerThread.java:67)
06-21 22:43:58.551  2423  3032 E IKE     : Caused by: android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.validateNetmaskInReply(IkeConfigPayload.java:160)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.<init>(IkeConfigPayload.java:124)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory$IkePayloadDecoder.decodeIkePayload(IkePayloadFactory.java:90)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkePayloadFactory.getIkePayload(IkePayloadFactory.java:158)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decodePayloadList(IkeMessage.java:210)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.-$$Nest$smdecodePayloadList(Unknown Source:0)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:828)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:722)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.message.IkeMessage.decode(IkeMessage.java:182)
06-21 22:43:58.551  2423  3032 E IKE     :      at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1809)
06-21 22:43:58.551  2423  3032 E IKE     :      ... 9 more
06-21 22:43:58.551  2423  5168 E EpdgTunnelManager[0]: Closing tunnel with exception for apn: ims with token: 4 sessionType:5 error: TYPE: IWLAN_IKE_PROTOCOL_EXCEPTION ERR: 7
06-21 22:43:58.551  2423  5168 E EpdgTunnelManager[0]: DATA:
06-21 22:43:58.551  2423  5168 W System.err: android.net.ipsec.ike.exceptions.InvalidSyntaxException: Generic processing error in the received response
06-21 22:43:58.551  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1842)
06-21 22:43:58.551  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.processStateMessage(IkeSessionStateMachine.java:1713)
06-21 22:43:58.551  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$CreateIkeLocalIkeAuthPostEap.processStateMessage(IkeSessionStateMachine.java:4257)
06-21 22:43:58.551  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.AbstractSessionStateMachine$ExceptionHandlerBase.processMessage(AbstractSessionStateMachine.java:147)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.processMsg(StateMachine.java:993)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.utils.StateMachine$SmHandler.handleMessage(StateMachine.java:810)
06-21 22:43:58.552  2423  5168 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 22:43:58.552  2423  5168 W System.err:    at android.os.Looper.loopOnce(Looper.java:201)
06-21 22:43:58.552  2423  5168 W System.err:    at android.os.Looper.loop(Looper.java:288)
06-21 22:43:58.552  2423  5168 W System.err:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-21 22:43:58.552  2423  5168 W System.err: Caused by: android.net.ipsec.ike.exceptions.InvalidSyntaxException: Found INTERNAL_IP4_NETMASK attribute but no INTERNAL_IP4_ADDRESS attribute
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.validateNetmaskInReply(IkeConfigPayload.java:160)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeConfigPayload.<init>(IkeConfigPayload.java:124)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkePayloadFactory$IkePayloadDecoder.decodeIkePayload(IkePayloadFactory.java:90)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkePayloadFactory.getIkePayload(IkePayloadFactory.java:158)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeMessage.decodePayloadList(IkeMessage.java:210)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeMessage.-$$Nest$smdecodePayloadList(Unknown Source:0)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:828)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeMessage$IkeMessageHelper.decode(IkeMessage.java:722)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.message.IkeMessage.decode(IkeMessage.java:182)
06-21 22:43:58.552  2423  5168 W System.err:    at com.android.internal.net.ipsec.ike.IkeSessionStateMachine$BusyState.handleReceivedIkePacket(IkeSessionStateMachine.java:1809)
06-21 22:43:58.552  2423  5168 W System.err:    ... 9 more
06-21 22:43:58.553  2423  3026 D TmHandler: msg.what = EVENT_IKE_SESSION_CLOSED
06-21 22:43:58.553  2423  3026 D EpdgTunnelManager[0]: EVENT_IKE_SESSION_CLOSED

I compared against the last logcat and these are the exact same errors. Any ideas? Thanks!

kyujin-cho commented 1 year ago

@chuckman Aight. Then now we have two hypotheses left: we still have to tune some other parameters or your carrier is limiting establishing tunnel to ePDG entity only for whitelisted devices, especially when cellular device isn't actually connected to their cellular network. When looking at Android's ePDG connection mechanism it seems like they are passing device's IMEI value so this might be the case in rare chance. Anyway I'm out of the idea. If there's a carrier in my country servicing Wi-Fi Calling I can try debugging myself but sadly it's not. Sorry :(

chuckman commented 1 year ago

@kyujin-cho Any easy way to set custom config in bulk? Will try copying more parameters to the Pixel. I also have a Xiaomi Mi 10T Pro using an AOSP-based ROM where I can do some tests. In that case we could try the IMEI thing, as on the official firmware by Xiaomi vowifi works perfectly, even in airplane mode but in AOSP it doesn't work, even with cellular connection active. In that case we know for sure that the ISP is not actively blocking that device by IMEI as it is an officially supported device. Thanks!!