I have a VPN service, using ParcelFileDescriptor, and a builder to set the network parameters. Something like this code:
private Builder builder = new Builder().setSession("myService")
.addAddress(...)
.addDnsServer(...)
.establish()
Now, I want to update the network parameters (DNS server for example), while I'm connected.
The relevant part from the documentation is this:
To avoid conflicts, there can be only one active VPN interface at the same time. Usually network parameters are never changed during the lifetime of a VPN connection. It is also common for an application to create a new file descriptor after closing the previous one. However, it is rare but not impossible to have two interfaces while performing a seamless handover. In this case, the old interface will be deactivated when the new one is created successfully. Both file descriptors are valid but now outgoing packets will be routed to the new interface. Therefore, after draining the old file descriptor, the application MUST close it and start using the new file descriptor. If the new interface cannot be created, the existing interface and its file descriptor remain untouched.
and as it said - "Usually network parameters are never changed during the lifetime of a VPN connection", but I do want to change them. Is it possible?
from VpnService - update network parameters
No comments:
Post a Comment