Use LinkAddress in address notifications.

Currently address{Updated,Removed} pass in the address as a
string such as "fe80::1/64". Use LinkAddresses instead, since
that's what it is.

This makes the code more robust in the unlikely case that netd
passes in an invalid string. In the future we can move flags and
scope into the LinkAddress itself and simplify the code further.

Bug: 9180552
Change-Id: I66599f9529cf421caa7676fdd0141bb110b8589e
This commit is contained in:
Lorenzo Colitti
2013-11-17 15:05:02 +09:00
parent 9d4ac97036
commit 5ad421a3d0
5 changed files with 30 additions and 19 deletions

View File

@ -17,6 +17,7 @@
package com.android.server.net;
import android.net.INetworkManagementEventObserver;
import android.net.LinkAddress;
/**
* Base {@link INetworkManagementEventObserver} that provides no-op
@ -36,12 +37,12 @@ public class BaseNetworkObserver extends INetworkManagementEventObserver.Stub {
}
@Override
public void addressUpdated(String address, String iface, int flags, int scope) {
public void addressUpdated(LinkAddress address, String iface, int flags, int scope) {
// default no-op
}
@Override
public void addressRemoved(String address, String iface, int flags, int scope) {
public void addressRemoved(LinkAddress address, String iface, int flags, int scope) {
// default no-op
}