Open Joecowboy opened 2 years ago
Hi Joecowboy,
try an absolute path to bindToInterface.so
, then it should work.
Can you shortly describe what telephathy-ofono is? There is no readme and no description. I'm just curious.
Hello JsBergbau,
Telepathy-ofono (from the ofono platform) is basically man in the middle app between android layer and ubports (Ubuntu Touch -- Ubuntu 16.04) for mms on my phone. I am trying to figure out a way while I have WiFi enabled I can still send and receive pics, videos, emojis, ect. and have it routed to the cell network interface (rmnet_data0) only. As it stands if WiFi is enabled and Cell Network Data is enabled; sending and receiving files via mms will error but texting is fine. Disable Wifi everything works flawlessly. Even if I run the following command with sudo I still get the same error. Also, I cannot use IPtables because -m cgroup because match with cgroup is not enabled in the kernel. So I am looking at your solution.
I am getting the same error with LD_PRELOAD:
phablet@ubuntu-phablet:~/Downloads$ BIND_INTERFACE=rmnet_data0 LD_PRELOAD=/home/phablet/Downloads/bindToInterface.so /usr/lib/telepathy/telepathy-ofono ERROR: ld.so: object '/home/phablet/Downloads/bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Protocol.Interface.Addressing" plugged tp-qt 0.9.7 DEBUG: Protocol "ofono" added to CM tp-qt 0.9.7 DEBUG: Registering protocol "ofono" at path "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" for CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 WARN: Unable to register service "org.freedesktop.Telepathy.ConnectionManager.ofono" - name already registered by another process
It may be possible that telepathy-ofono runs under a different user account or drops some rights. So it could be possible that telepathy-ofono can't access bindToInterface.so
in /home/phablet/Downloads
.
Try placing it in /opt/bindToInterface.so
and grant user, group and other read and executable access.
Okay, here is killing the pid of telepathy-ofono with it copied to /opt as you suggested but as you notice the ERROR is still there. Do you have a way to compile this for Ubuntu 16.04 for testing?:
phablet@ubuntu-phablet:~$ pidof telepathy-ofono 6555 phablet@ubuntu-phablet:~$ kill 6555 phablet@ubuntu-phablet:~$ BIND_INTERFACE=rmnet_data0 LD_PRELOAD=/opt/bindToInterface.so /usr/lib/telepathy/telepathy-ofono ERROR: ld.so: object '/opt/bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Protocol.Interface.Addressing" plugged tp-qt 0.9.7 DEBUG: Protocol "ofono" added to CM tp-qt 0.9.7 DEBUG: Registering protocol "ofono" at path "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" for CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 DEBUG: Registering CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Requests" plugged tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.EmergencyMode" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.Voicemail" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.USSD" plugged oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Contacts" plugged tp-qt 0.9.7 DEBUG: cmName: "ofono" escapedProtocolName: "ofono" name: "connection_f242b77f97597add8f36d0bf79847dda" tp-qt 0.9.7 DEBUG: busName: "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_f242b77f97597add8f36d0bf79847dda" objectName: "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_f242b77f97597add8f36d0bf79847dda" tp-qt 0.9.7 DEBUG: Connection: registering interfaces at Tp::DBusObject(0x338694b0) tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_f242b77f97597add8f36d0bf79847dda" at bus name "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_f242b77f97597add8f36d0bf79847dda" tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Requests" plugged tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.EmergencyMode" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.Voicemail" plugged tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.USSD" plugged oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Contacts" plugged tp-qt 0.9.7 DEBUG: cmName: "ofono" escapedProtocolName: "ofono" name: "connection_a747d1c01780dde754c6574aaecdc20f" tp-qt 0.9.7 DEBUG: busName: "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_a747d1c01780dde754c6574aaecdc20f" objectName: "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_a747d1c01780dde754c6574aaecdc20f" tp-qt 0.9.7 DEBUG: Connection: registering interfaces at Tp::DBusObject(0x338a0660) tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_a747d1c01780dde754c6574aaecdc20f" at bus name "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_a747d1c01780dde754c6574aaecdc20f" tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x338a0b50) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses oFonoConnection::connect tp-qt 0.9.7 DEBUG: BaseConnection::setStatus 0 1 oFonoConnection(0x3387dd10) tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses oFonoConnection::connect tp-qt 0.9.7 DEBUG: BaseConnection::setStatus 0 1 oFonoConnection(0x338a0b50) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) getContactAttributes (1) () oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") getContactAttributes (1) () oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3387dd10) tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x338a0b50) tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("-----------") getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") oFonoConnection::inspectHandles contact (1) oFonoConnection::inspectHandles ("") oFonoConnection::onMMSServiceAdded "/org/ofono/mms/310410965737678"
Very strange: Can you please try BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/opt/bindToInterface.so curl ifconfig.me
and see if you get the IP address of your mobile connection?
Found something useful https://linux.die.net/man/8/ld-linux
LD_PRELOAD (...) For set-user-ID/set-group-ID ELF binaries, preload pathnames containing slashes are ignored, and libraries in the standard search directories are loaded only if the set-user-ID permission bit is enabled on the library file.
So if I understand this correctly: If telepathy-ofono uses set-user-ID and/or set-group-ID LD_PRELOAD will only work if it is in a standard search directory. According to this https://unix.stackexchange.com/a/22999/334883 that are
In a nutshell, when it's looking for a dynamic library (.so file) the linker tries:
directories listed in the LD_LIBRARY_PATH environment variable (DYLD_LIBRARY_PATH on OSX); directories listed in the executable's rpath; directories on the system search path, which (on Linux at least) consists of the entries in /etc/ld.so.conf plus /lib and /usr/lib.
If done chmod ug+s bindToInterface.so
and put it into /lib and tried BIND_INTERFACE=ovpnLD_PRELOAD=bindToInterface.so curl ifconfig.me
but this didn't work
cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
cat /etc/ld.so.conf.d/arm-linux-gnueabihf.conf
# Multiarch support
/usr/local/lib/arm-linux-gnueabihf
/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf
Also put library to /usr/lib/arm-linux-gnueabihf
but still this didn't work with curl, so standard searchpath seems to be ignored.
So if the curl example BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/opt/bindToInterface.so curl ifconfig.me
works, please still try putting it into a path in /etc/ld.so.conf and then try loading it by the simple example BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=bindToInterface.so curl ifconfig.me
. If then the same error occurs, I suggest asking at stackoverflow whats wrong here. Sorry my knowledge about Preloading is quite limited. On windows it is even harder. There you need some framework like detours https://en.wikipedia.org/wiki/Microsoft_Detours to do so.
I moved bindToInterface.so from /opt to /lib then chmod ug+s on the file and tried your curl requests. The error still persists as you can see from the last two outputs. Thank you for your time and trying to figure this out.
cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
cat /etc/ld.so.conf.d/aarch64-linux-gnu.conf
# Multiarch support
/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu
root@ubuntu-phablet:/lib# BIND_INTERFACE=ovpn LD_PRELOAD=bindToIntelibce.so curl ifconfig.me ERROR: ld.so: object 'bindToIntelibce.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. "IP ADDRESS OUTPUT"
root@ubuntu-phablet:/lib# BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me ERROR: ld.so: object '/lib/bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. "IP ADDRESS OUTPUT"
Thanks for the output. So this problem has primarily nothing to do with telephathy-ofono.
Did you compile bindInterface.so on that machine?
Please post output of file bindToInterface.so
and output of arch
.
No I didn't, because it's my phone and no gcc compiler. I compiled it on an another ubuntu box.
That should be the issue. You compiled for another architecture and thats why it can't be loaded. You need to crosscompile the the file for the architecture of your phone.
I thought about that too. I guess I can try and install gcc on the phone and report back.
Ok I installed gcc and libc6-dev to compile your project. I compiled it without any errors on the phone now. However, I am still receiving the ERROR. Do you have any other ideas?:
BIND_INTERFACE=ovpn LD_PRELOAD=/usr/local/lib/bindToIntelibce.so curl ifconfig.me ERROR: ld.so: object '/usr/local/lib/bindToIntelibce.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. "IP ADDRESS OUTPUT"
Please try this line BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me
ovpn
is an example, I don't think you have that interface and there is a typo in the library name bindToIntelibce.so
Here is the output from what you wanted me to try with "NO" ERROR:
BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me
curl: (6) Could not resolve host: ifconfig.me
However, I am still getting the ERROR with telepathy-ofono. Do you have anymore thoughts. I thought about moving it to /system/lib to see if that would make a difference.:
BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so /usr/lib/telepathy/telepathy-ofono
ERROR: ld.so: object '/lib/bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Protocol.Interface.Addressing" plugged
tp-qt 0.9.7 DEBUG: Protocol "ofono" added to CM
tp-qt 0.9.7 DEBUG: Registering protocol "ofono" at path "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" for CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedes
ktop.Telepathy.ConnectionManager.ofono"
tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono"
tp-qt 0.9.7 DEBUG: Registering CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono"
tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono"
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Requests" plugged
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.EmergencyMode" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.Voicemail" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.USSD" plugged
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Contacts" plugged
tp-qt 0.9.7 DEBUG: cmName: "ofono" escapedProtocolName: "ofono" name: "connection_7747c8e6360b95f1b9592cf38bcb9d6f"
tp-qt 0.9.7 DEBUG: busName: "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_7747c8e6360b95f1b9592cf38bcb9d6f" objectName: "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection
_7747c8e6360b95f1b9592cf38bcb9d6f"
tp-qt 0.9.7 DEBUG: Connection: registering interfaces at Tp::DBusObject(0x3a5ae4b0)
tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_7747c8e6360b95f1b9592cf38bcb9d6f" at bus name "org.freedesktop.Telepathy.Connection.ofono.ofono.conn
ection_7747c8e6360b95f1b9592cf38bcb9d6f"
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Requests" plugged
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.EmergencyMode" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.Voicemail" plugged
tp-qt 0.9.7 DEBUG: Interface "com.canonical.Telephony.USSD" plugged
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Connection.Interface.Contacts" plugged
tp-qt 0.9.7 DEBUG: cmName: "ofono" escapedProtocolName: "ofono" name: "connection_587b5b8ee5989f8ddd717274d81aec13"
tp-qt 0.9.7 DEBUG: busName: "org.freedesktop.Telepathy.Connection.ofono.ofono.connection_587b5b8ee5989f8ddd717274d81aec13" objectName: "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection
_587b5b8ee5989f8ddd717274d81aec13"
tp-qt 0.9.7 DEBUG: Connection: registering interfaces at Tp::DBusObject(0x3a5ea6f0)
tp-qt 0.9.7 DEBUG: Registered object "/org/freedesktop/Telepathy/Connection/ofono/ofono/connection_587b5b8ee5989f8ddd717274d81aec13" at bus name "org.freedesktop.Telepathy.Connection.ofono.ofono.conn
ection_587b5b8ee5989f8ddd717274d81aec13"
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 2 oFonoConnection(0x3a5ea7a0)
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
oFonoConnection::connect
tp-qt 0.9.7 DEBUG: BaseConnection::setStatus 0 1 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
oFonoConnection::connect
tp-qt 0.9.7 DEBUG: BaseConnection::setStatus 0 1 oFonoConnection(0x3a5ea7a0)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
getContactAttributes (1) ()
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
getContactAttributes (1) ()
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
tp-qt 0.9.7 WARN: BaseConnectionSimplePresenceInterface::Adaptee::setPresence: status is not in statuses
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5ea7a0)
tp-qt 0.9.7 DEBUG: BaseConnection::status = 0 oFonoConnection(0x3a5c2d10)
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
tp-qt 0.9.7 DEBUG: BaseConnectionRequestsInterface::requestableChannelClasses
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("")
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
getContactAttributes (1) ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence")
oFonoConnection::inspectHandles contact (1)
oFonoConnection::inspectHandles ("-----------")
BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me
curl: (6) Could not resolve host: ifconfig.me
That looks better now. However resolving should work. Lets focus on getting this working first and than look regarding telepathy-ofono
Try to use the DNS-Server of your provider in DNS_OVERRIDE_IP and see if you get the IP of your mobile data connection. If not please please uncomment line 13 in bindToInterface.c so debugging is enabled https://github.com/JsBergbau/BindToInterface/blob/main/bindToInterface.c#L13
Then please compile again and execute again the example with curl and your provider DNS and post the output here.
I uncommented line 13 to enable debugging.
Curl seems to work if I disable the wlan0 interface:
BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me
Detected DNS query to: 127.0.1.1:53, overwriting with 8.8.8.8:53
connecting to: 8.8.8.8:53
Bound Interface: none. Socket not bound to desired interface (Bound to: none). Binding to interface: rmnet_data0
connecting to: 34.117.59.81:80
Bound Interface: none. Socket not bound to desired interface (Bound to: none). Binding to interface: rmnet_data0
"MY IP ADDRESS OUTPUT"
With wlan0 enabled curl does not resolve the host:
BIND_INTERFACE=rmnet_data0 DNS_OVERRIDE_IP=8.8.8.8 LD_PRELOAD=/lib/bindToInterface.so curl ifconfig.me
Detected DNS query to: 127.0.1.1:53, overwriting with 8.8.8.8:53
connecting to: 8.8.8.8:53
Bound Interface: none. Socket not bound to desired interface (Bound to: none). Binding to interface: rmnet_data0
Detected DNS query to: 8.8.8.8:53, overwriting with 8.8.8.8:53
connecting to: 8.8.8.8:53
Bound Interface: none. Socket not bound to desired interface (Bound to: none). Binding to interface: rmnet_data0
curl: (6) Could not resolve host: ifconfig.me
It looks like there is some prevention that mobile data is used while wifi connection is established. To verify this please use without any preloading:
curl --interface rmnet_data0 ifconfig.me
one time with wlan0 enabled, one time without.
With wlan0 disabled:
curl --interface rmnet_data0 ifconfig.me
"MY IP ADDRESS OUTPUT"
With wlan0 enabled:
curl --interface rmnet_data0 ifconfig.me
curl: (7) Failed to connect to ifconfig.me port 80: Connection timed out
Here is output from: nmcli g STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN connected full enabled enabled enabled enabled
Thanks. So there is definitely something preventing using your mobile data while wlan0 is enabled.
curl --interface
I recommend you to post your example on https://android.stackexchange.com/ using the curl --interface rmnet_data0
. You can post the link here too, then I'll have a look at the stackexchange answers.
Once you manage it to get it to work with curl, we'll also get it working with BindToInterface.
Okay I will do that.
OKay, I created a question over on Android Enthusiasts per your request:
Another option to try
sudo curl --interface rmnet_data0
while wifi enabled.
Does this work?
It didn't work still times out using sudo.
With Wi-Fi enabled
sudo curl --interface rmnet_data0 ifconfig.me
curl: (7) Failed to connect to ifconfig.me port 80: Connection timed out
@IrfanLatif from Android Enthusiasts was suggesting for me to look at his solution here and I was trying to think how this would help us with this situation because we don't want all traffic routed from wlan0 to rmnet_data0 we need it per application. Unless, I am missing something:
Using routing tables is another solution. The beauty of BindToInterface or curl --interface
is that you don't need specific routing table entries. The traffic is bound to that interface. When destination is on local net it uses directly that network interface or otherwise it uses the default gateway of this interface.
Asking for trying with sudo was to verfiy if it is some kind of permission thing, but it seems not.
Just to check: Can you try sudo whoami
? This should print root
phablet@ubuntu-phablet:~$ sudo whoami root
How can we test what might be blocking the rmnet_data0 interface while wlan0 is enabled. Both interfaces are set to default and what's weird if you look at the route tables when wlan0 is disabled the routes for rmnet_data0 do not changed. wlan0 routs are just deleted.
I don't really know. If there was something in ip rule it would have been worth a closer look, but that is a normal routing table which should work.
Have a look there https://unix.stackexchange.com/a/498140/334883 Preloading libraries are very common for this usecase and as already mentioned, if there is native support like with curl, then you don't even have to preload a library.
I had to install curl on the phone.
Here is my firewall on the phone for iptables:
phablet@ubuntu-phablet:~$ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:bootps ACCEPT udp -- anywhere anywhere udp dpt:bootps
Chain FORWARD (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT) target prot opt source destination DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900 DROP udp -- anywhere anywhere udp dpt:1900
Chain nm_mdmprxy_doze_mode_skip (0 references) target prot opt source destination
Chain nm_mdmprxy_iface_pkt_fwder (0 references) target prot opt source destination
How do I use use ld_preload to force the interface gateway with your app like those other apps were talking about in the link you posted?
LD_PRELOAD with my app does the same as curl --interface
so if that doesn't work, LD_PRELOAD also won't help. I posted the link to show, that this method is known to work. So it is very strange, that even curl --interface won't work.
I apologize I misunderstood. So I just need to figure out what's preventing binding to rmnet_data0.
Exactly. Once curl --interface
option works, then BindToInterface should also work, at least with some tweaks.
Set a policy of accepting all traffic by default.
I tried resetting the iptables and ACCEPT ALL on wlan0 and rmnet_data0 but the connection still times out doing curl --interface rmnet_data0. So tables look like this:
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
Chain FORWARD (policy ACCEPT) target prot opt source destination
Chain OUTPUT (policy ACCEPT) target prot opt source destination
Chain nm_mdmprxy_doze_mode_skip (0 references) target prot opt source destination
Chain nm_mdmprxy_iface_pkt_fwder (0 references) target prot opt source destination
When you have Chain INPUT (policy ACCEPT)
you don't need to set other accept rules.
How did you reset iptables. If it is really an iptables issue, try https://serverfault.com/a/633623 to reset all tables.
I am just trying to rule out any iptables issue. I reset the iptables by: sudo iptables -F
I tried the solution but still curl still times out with Wi-Fi enabled: iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT
root@ubuntu-phablet:/# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination
Chain FORWARD (policy ACCEPT) target prot opt source destination
Chain OUTPUT (policy ACCEPT) target prot opt source destination iptables -P OUTPUT ACCEPT
Then it is not iptables related and also not ip rule related. But still I have no clue what could be wrong here.
I am trying to figure out if it's a Ubports Kernel Issue blocking the usage of Mobile network interface when Wi-Fi is enabled. Not sure how I would test this.
Do you have a public IP adress on mobile data interface? If so you could try if ping works and see if it changes when enabling Wifi.
Went to ipchicken.com and got my IP address when running only the Mobile Network Interface
I went to https://www.ipaddressguide.com/ping and was able to ping the IP address with Wi-Fi enabled and disabled.
Thats not the right way, because there is probably NAT inwolved. Is the ip from ipchicken.com the same as in ifconfig? If not this way doesn't work.
Different Different IP from ifconfig. It will not ping that address with Wi-Fi enabled or disabled.
Good Day to you JSBergbau,
By the way here is the Halium 9 project I am using from @RyanAM https://gitlab.com/RyanAM/oneplus-guacamole-halium9
I am still at a loss if it's UBports kernel preventing the binding to the interface or if its the ofono layer. I am not sure how to test to see what's preventing it. Unless I can find some kernel logs or ofono logs.
Here is the output of dbs-monitor when executing: sudo curl --interface rmnet_data0 ifconfig.me
method call time=1635631597.369505 sender=:1.140 -> destination=com.lomiri.hfd serial=350 path=/com/lomiri/hfd; interface=org.freedesktop.DBus.Introspectable; member=Introspect error time=1635631597.369576 sender=org.freedesktop.DBus -> destination=:1.140 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=350 string "The name com.lomiri.hfd was not provided by any .service files" method call time=1635631597.369999 sender=:1.140 -> destination=org.freedesktop.DBus serial=351 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='com.lomiri.hfd'" method call time=1635631597.370613 sender=:1.140 -> destination=org.freedesktop.DBus serial=352 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner string "com.lomiri.hfd" error time=1635631597.370880 sender=org.freedesktop.DBus -> destination=:1.140 error_name=org.freedesktop.DBus.Error.NameHasNoOwner reply_serial=352 string "Could not get owner of name 'com.lomiri.hfd': no such name" method call time=1635631597.371390 sender=:1.140 -> destination=org.freedesktop.DBus serial=353 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='com.lomiri.hfd'" signal time=1635631600.010986 sender=:1.0 -> destination=(null destination) serial=100277 path=/com/ubuntu/Upstart; interface=com.ubuntu.Upstart0_6; member=EventEmitted
@Joecowboy I've encountered a similiar problem as yours and I've updated the documentation https://github.com/JsBergbau/BindToInterface#multiple-physical-nics
So basically for physical NICs you need to specify a default route for the NIC you want to bind to.
You can check/get the required IP via ip route
and then set the route.
Since you got
curl --interface rmnet_data0 ifconfig.me
curl: (7) Failed to connect to ifconfig.me port 80: Connection timed out
this might be a different error, because with missing gateway, I got "no route to host" with curl --interface eth1
. But at least it is worth a try.
I am hitting the same issue..
~/bin/BindToInterface> curl --version
curl 8.5.0 (x86_64-conda-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.2.13 libssh2/1.10.0 nghttp2/1.57.0
Release-Date: 2023-12-06
ERROR: ld.so: object '/home/tian/bin/BindToInterface/bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
No avail
What happens when using curl --interface <interfacename> ifconfig.me
?
sudo -i unset LD_PRELOAD unset LD_LIBRARY_PATH
LD_PRELOAD= LD_LIBRARY_PATH=
On Mon, May 13, 2024, 1:41 PM JsBergbau @.***> wrote:
What happens when using curl --interface
ifconfig.me? — Reply to this email directly, view it on GitHub https://github.com/JsBergbau/BindToInterface/issues/3#issuecomment-2108663874, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSRO2UF2DD5SXIIDJBM743ZCEJO5AVCNFSM5FHEBWD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJQHA3DMMZYG42A . You are receiving this because you were mentioned.Message ID: @.***>
I know telephathy-ofono is already registered. I just have to kill it's process to get around it. I am getting the following error trying to LD_PRELOAD:
BIND_INTERFACE=rmnet_data0 LD_PRELOAD=./bindToInterface.so /usr/lib/telepathy/telepathy-ofono ERROR: ld.so: object './bindToInterface.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. tp-qt 0.9.7 DEBUG: Interface "org.freedesktop.Telepathy.Protocol.Interface.Addressing" plugged tp-qt 0.9.7 DEBUG: Protocol "ofono" added to CM tp-qt 0.9.7 DEBUG: Registering protocol "ofono" at path "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" for CM "/org/freedesktop/Telepathy/ConnectionManager/ofono" at bus name "org.freedesktop.Telepathy.ConnectionManager.ofono" tp-qt 0.9.7 WARN: Unable to register object "/org/freedesktop/Telepathy/ConnectionManager/ofono/ofono" - path already registered