Snap for 4407698 from 6691db85e7 to pi-release
Change-Id: I814ae532ea31d2662265cd582bda331b5035a3ff
This commit is contained in:
@@ -248,25 +248,6 @@ class EthernetNetworkFactory {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setStaticIpAddress(StaticIpConfiguration staticConfig) {
|
|
||||||
if (staticConfig.ipAddress != null &&
|
|
||||||
staticConfig.gateway != null &&
|
|
||||||
staticConfig.dnsServers.size() > 0) {
|
|
||||||
try {
|
|
||||||
Log.i(TAG, "Applying static IPv4 configuration to " + mIface + ": " + staticConfig);
|
|
||||||
InterfaceConfiguration config = mNMService.getInterfaceConfig(mIface);
|
|
||||||
config.setLinkAddress(staticConfig.ipAddress);
|
|
||||||
mNMService.setInterfaceConfig(mIface, config);
|
|
||||||
return true;
|
|
||||||
} catch(RemoteException|IllegalStateException e) {
|
|
||||||
Log.e(TAG, "Setting static IP address failed: " + e.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Invalid static IP configuration.");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateAgent() {
|
public void updateAgent() {
|
||||||
if (mNetworkAgent == null) return;
|
if (mNetworkAgent == null) return;
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
@@ -332,17 +313,8 @@ class EthernetNetworkFactory {
|
|||||||
mNetworkInfo));
|
mNetworkInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkProperties linkProperties;
|
|
||||||
|
|
||||||
IpConfiguration config = mEthernetManager.getConfiguration();
|
IpConfiguration config = mEthernetManager.getConfiguration();
|
||||||
|
|
||||||
if (config.getIpAssignment() == IpAssignment.STATIC) {
|
|
||||||
if (!setStaticIpAddress(config.getStaticIpConfiguration())) {
|
|
||||||
// We've already logged an error.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
linkProperties = config.getStaticIpConfiguration().toLinkProperties(mIface);
|
|
||||||
} else {
|
|
||||||
mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, mHwAddr);
|
mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, mHwAddr);
|
||||||
IpManager.Callback ipmCallback = new IpManager.Callback() {
|
IpManager.Callback ipmCallback = new IpManager.Callback() {
|
||||||
@Override
|
@Override
|
||||||
@@ -375,12 +347,18 @@ class EthernetNetworkFactory {
|
|||||||
mIpManager.setTcpBufferSizes(tcpBufferSizes);
|
mIpManager.setTcpBufferSizes(tcpBufferSizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ProvisioningConfiguration provisioningConfiguration =
|
final ProvisioningConfiguration provisioningConfiguration;
|
||||||
mIpManager.buildProvisioningConfiguration()
|
if (config.getIpAssignment() == IpAssignment.STATIC) {
|
||||||
|
provisioningConfiguration = IpManager.buildProvisioningConfiguration()
|
||||||
|
.withStaticConfiguration(config.getStaticIpConfiguration())
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
provisioningConfiguration = mIpManager.buildProvisioningConfiguration()
|
||||||
.withProvisioningTimeoutMs(0)
|
.withProvisioningTimeoutMs(0)
|
||||||
.build();
|
.build();
|
||||||
mIpManager.startProvisioning(provisioningConfiguration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mIpManager.startProvisioning(provisioningConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user