mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809006 - B2G Network Manager: Unable to set default route and DNS when required system properties not available. r=vicamo
This commit is contained in:
parent
4a08c209ba
commit
f8b7383acb
@ -389,7 +389,10 @@ NetworkManager.prototype = {
|
||||
let options = {
|
||||
cmd: this.active.dhcp ? "runDHCPAndSetDefaultRouteAndDNS" : "setDefaultRouteAndDNS",
|
||||
ifname: this.active.name,
|
||||
oldIfname: (oldInterface && oldInterface != this.active) ? oldInterface.name : null
|
||||
oldIfname: (oldInterface && oldInterface != this.active) ? oldInterface.name : null,
|
||||
gateway_str: this.active.gateway,
|
||||
dns1_str: this.active.dns1,
|
||||
dns2_str: this.active.dns2
|
||||
};
|
||||
this.worker.postMessage(options);
|
||||
this.setNetworkProxy();
|
||||
|
@ -123,11 +123,9 @@ function networkInterfaceStatsSuccess(params) {
|
||||
* Name of the network interface.
|
||||
*/
|
||||
function getIFProperties(ifname) {
|
||||
let gateway_str = libcutils.property_get("net." + ifname + ".gw");
|
||||
return {
|
||||
ifname: ifname,
|
||||
gateway: netHelpers.stringToIP(gateway_str),
|
||||
gateway_str: gateway_str,
|
||||
gateway_str: libcutils.property_get("net." + ifname + ".gw"),
|
||||
dns1_str: libcutils.property_get("net." + ifname + ".dns1"),
|
||||
dns2_str: libcutils.property_get("net." + ifname + ".dns2"),
|
||||
};
|
||||
@ -159,13 +157,15 @@ function setDefaultRouteAndDNS(options) {
|
||||
libnetutils.ifc_remove_default_route(options.oldIfname);
|
||||
}
|
||||
|
||||
if (!options.gateway || !options.dns1_str) {
|
||||
options = getIFProperties(options.ifname);
|
||||
}
|
||||
let ifprops = getIFProperties(options.ifname);
|
||||
let gateway_str = options.gateway_str || ifprops.gateway_str;
|
||||
let dns1_str = options.dns1_str || ifprops.dns1_str;
|
||||
let dns2_str = options.dns2_str || ifprops.dns2_str;
|
||||
let gateway = netHelpers.stringToIP(gateway_str);
|
||||
|
||||
libnetutils.ifc_set_default_route(options.ifname, options.gateway);
|
||||
libcutils.property_set("net.dns1", options.dns1_str);
|
||||
libcutils.property_set("net.dns2", options.dns2_str);
|
||||
libnetutils.ifc_set_default_route(options.ifname, gateway);
|
||||
libcutils.property_set("net.dns1", dns1_str);
|
||||
libcutils.property_set("net.dns2", dns2_str);
|
||||
|
||||
// Bump the DNS change property.
|
||||
let dnschange = libcutils.property_get("net.dnschange", "0");
|
||||
|
Loading…
Reference in New Issue
Block a user