Skip to content

Commit

Permalink
Expand Android Netlink Warning and Match DevGuide
Browse files Browse the repository at this point in the history
Also fix some minor typos in the section.
  • Loading branch information
iguessthislldo committed Feb 1, 2024
1 parent 3055313 commit 15ea600
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions dds/DCPS/LinuxNetworkConfigMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ bool LinuxNetworkConfigMonitor::open_i()
if (socket_.open(addr, AF_NETLINK, NETLINK_ROUTE) != 0) {
#ifdef ACE_ANDROID
if (log_level >= LogLevel::Warning) {
ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: LinuxNetworkConfigMonitor::open_i: could not open socket"
" this is expected for API30+\n"));
ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: LinuxNetworkConfigMonitor::open_i: "
"could not open Netlink socket "
"(this is expected for API>=30, see Android section in the Developer's Guide)\n"));
}
#else
if (log_level >= LogLevel::Error) {
ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: LinuxNetworkConfigMonitor::open_i: could not open socket: %m\n"));
ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: LinuxNetworkConfigMonitor::open_i: "
"could not open Netlink socket: %m\n"));
}
#endif
return false;
Expand Down
8 changes: 4 additions & 4 deletions docs/devguide/building/android.rst
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,12 @@ Failure to do so will result in ACE failing to access any sockets and OpenDDS wi
Network Availability
--------------------

When not running in an application targeting API 30 later on Android 10 or later, Android builds of OpenDDS use the ``LinuxNetworkConfigMonitor`` to reconfigure OpenDDS connections automatically when the device switches from one network (cellular or wifi) to another.
When not running in an application targeting API 30 or later on Android 10 or later, Android builds of OpenDDS use the ``LinuxNetworkConfigMonitor`` to reconfigure OpenDDS connections automatically when the device switches from one network (cellular or WiFi) to another.

When running in an application targeting API 30 later on Android 10, ``LinuxNetworkConfigMonitor`` can no longer be used, as Netlink sockets are blocked by the OS for security reasons.
In the logs this error show up as:
When running in an application targeting API 30 or later on Android 10, ``LinuxNetworkConfigMonitor`` can no longer be used, as Netlink sockets are blocked by the OS for security reasons.
In the logs this warning shows up as:

ERROR: LinuxNetworkConfigMonitor::open: could not open socket: Permission denied
WARNING: LinuxNetworkConfigMonitor::open_i: could not open Netlink socket (this is expected for API>=30, see Android section in the Developer's Guide)

Instead, ``NetworkConfigModifier`` is utilized.
As a consequence of this, two variables are required from the user, :ref:`android_sdk`, and :ref:`android_target_api`.
Expand Down

0 comments on commit 15ea600

Please sign in to comment.