mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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:
parent
d33d93b2c4
commit
90d87a33c7
4 changed files with 30 additions and 29 deletions
23
net/hub.c
23
net/hub.c
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue