Skip to content

Conversation

@oleksii-skidan
Copy link

@oleksii-skidan oleksii-skidan commented Nov 17, 2025

Problem

We have noticed that the socket protector on Apple appears to rebind sockets too frequently. For example, when a cellular connection is enabled and the system transitions from Wi-Fi, it will rebind sockets first due to the change in the Cellular interface, then due to the change in the Wi-Fi interface. What I noticed was that when this was happening, the Cellular interface was not the primary one yet.

We have a suspicion that this may be causing hard-to-track no-nets. I made a build for Rolandas Pakėnas with this fix (as he was the one who reported the most frequent occurrences of no-nets), which he daily drove for a week. His feedback was that the no-nets stopped occurring for him.

Solution

I added a bit of code (not included in this MR) that was dumping the changed DynamicStore keys. That's how I know that sometimes we try rebinding sockets due to changes in non-primary interfaces. From the numerous dumps, the keys that we are interested in the most seem to be these:

  • State:/Network/Interface/<interface>/IPConfigurationBusy
  • State:/Network/Global/IPv4
  • State:/Network/Interface/<interface>/IPv4
  • State:/Network/Interface/<interface-UUID>/IPv4

Theoretically, when we get IPConfigurationBusy, we must check if the corresponding value is true and rebind only if it is. But at the moment, it seems to be too much of a change for a single MR. And without this pedantic change, the results are quite promising.

The change is: I added a filtering step to dynamic_store_callback in telio-sockets/src/protector/apple.rs. It checks if the change key is one of the above. And it checks if the interface is primary.

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

@oleksii-skidan oleksii-skidan requested a review from a team as a code owner November 17, 2025 12:16
@nord-llt
Copy link

nord-llt commented Nov 17, 2025

CLA assistant check
All committers have signed the CLA.

@LukasPukenis LukasPukenis added the run tests PR is ready for CI label Nov 17, 2025
@LukasPukenis LukasPukenis removed the run tests PR is ready for CI label Nov 17, 2025
tomasz-grz
tomasz-grz previously approved these changes Nov 17, 2025
Copy link
Contributor

@tomasz-grz tomasz-grz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor notes, otherwise +1

@tomasz-grz
Copy link
Contributor

Nice! Please clean up the commit history before merging.

Also if you add a comment in the .unreleased/NAPPCORE-2747_broadcast_only_primary_interface_events file, regarding the changes, it should appear in the release changelog, so that the Apple Team is inform.... oh wait.. 😅

@oleksii-skidan
Copy link
Author

oleksii-skidan commented Nov 21, 2025

Hey @tomasz-grz, what do you mean by "clean up commit history"? Do you suggest squashing it all?

And regarding the file in the .unreleased directory. I noticed that they are all empty. Is there a template or structure to the contents of the file? I mean, should I have a one-liner describing what it is or write an essay? 😆

@tomasz-grz
Copy link
Contributor

@oleksii-skidan Yes squash them, or you can "Squash and Merge" (Just don't tell anybody I said that) 😀

Not sure why check-dod is not happy...
Can you try adding this to the bottom of your PR description?

### :ballot_box_with_check: Definition of Done checklist
- [x] Commit history is clean ([requirements](../blob/main/docs/git_commit_messages_requirements.md))
- [x] README.md is updated
- [x] Functionality is covered by unit or integration tests

@tomasz-grz
Copy link
Contributor

tomasz-grz commented Nov 25, 2025

@oleksii-skidan regarding the .unreleased, usually they are empty when the changes don't affect the apps/platforms so much.

If you add a simple oneliner like this the ticket/PR will be listed in the changelog.

@oleksii-skidan oleksii-skidan force-pushed the feat/NAPPCORE-2747_In_libtelio_don_t_rebind_sockets_on_irrelevant_dynamic_store_updates branch from eaf374c to f7800f9 Compare December 8, 2025 09:53
@oleksii-skidan
Copy link
Author

Hey @tomasz-grz, sorry for the delay :) I squashed it, updated the PR description, and added a one-liner to the changelog.

@oleksii-skidan
Copy link
Author

Also, our QA tested this change and it works as expected 🎉

@oleksii-skidan
Copy link
Author

Hey @tomasz-grz and @LukasPukenis, could you please take another look at this PR, approve it, and merge? 🥺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants