net: Look up 'vlan' net clients using hubs

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2012-07-24 16:35:06 +01:00
parent d33d93b2c4
commit 90d87a33c7
4 changed files with 30 additions and 29 deletions

View file

@ -164,6 +164,29 @@ VLANClientState *net_hub_add_port(int hub_id, const char *name)
return &port->nc;
}
/**
* Find a specific client on a hub
*/
VLANClientState *net_hub_find_client_by_name(int hub_id, const char *name)
{
NetHub *hub;
NetHubPort *port;
VLANClientState *peer;
QLIST_FOREACH(hub, &hubs, next) {
if (hub->id == hub_id) {
QLIST_FOREACH(port, &hub->ports, next) {
peer = port->nc.peer;
if (peer && strcmp(peer->name, name) == 0) {
return peer;
}
}
}
}
return NULL;
}
/**
* Print hub configuration
*/