virDomainPtr dom;
const char *iface;
const char *state;
- const char *mac;
+ const char *value;
const char *desc;
+ unsigned char macaddr[VIR_MAC_BUFLEN];
+ const char *element;
+ const char *attr;
bool persistent;
bool ret = false;
unsigned int flags = 0;
goto cleanup;
}
+ if (virParseMacAddr(iface, macaddr) == 0) {
+ element = "mac";
+ attr = "address";
+ } else {
+ element = "target";
+ attr = "dev";
+ }
+
/* find interface with matching mac addr */
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
cur = obj->nodesetval->nodeTab[i]->children;
while (cur) {
if (cur->type == XML_ELEMENT_NODE &&
- xmlStrEqual(cur->name, BAD_CAST "mac")) {
- mac = virXMLPropString(cur, "address");
+ xmlStrEqual(cur->name, BAD_CAST element)) {
+ value = virXMLPropString(cur, attr);
- if (STRCASEEQ(mac, iface)) {
- VIR_FREE(mac);
+ if (STRCASEEQ(value, iface)) {
+ VIR_FREE(value);
goto hit;
}
- VIR_FREE(mac);
+ VIR_FREE(value);
}
cur = cur->next;
}
}
- vshError(ctl, _("interface with address '%s' not found"), iface);
+ vshError(ctl, _("interface (%s: %s) not found"), element, iface);
goto cleanup;
hit:
const char *iface = NULL;
int flags = 0;
char *state = NULL;
- char *mac = NULL;
+ char *value = NULL;
+ unsigned char macaddr[VIR_MAC_BUFLEN];
+ const char *element;
+ const char *attr;
bool ret = false;
int i;
char *desc;
goto cleanup;
}
+ if (virParseMacAddr(iface, macaddr) == 0) {
+ element = "mac";
+ attr = "address";
+ } else {
+ element = "target";
+ attr = "dev";
+ }
+
/* find interface with matching mac addr */
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
cur = obj->nodesetval->nodeTab[i]->children;
while (cur) {
if (cur->type == XML_ELEMENT_NODE &&
- xmlStrEqual(cur->name, BAD_CAST "mac")) {
+ xmlStrEqual(cur->name, BAD_CAST element)) {
- mac = virXMLPropString(cur, "address");
+ value = virXMLPropString(cur, attr);
- if (STRCASEEQ(mac, iface)){
- VIR_FREE(mac);
+ if (STRCASEEQ(value, iface)) {
+ VIR_FREE(value);
goto hit;
}
- VIR_FREE(mac);
+ VIR_FREE(value);
}
cur = cur->next;
}
}
- vshError(ctl, _("Interface with address '%s' not found."), iface);
+ vshError(ctl, _("Interface (%s: %s) not found."), element, iface);
goto cleanup;
hit:
Get network interface stats for a running domain.
-=item B<domif-setlink> I<domain> I<interface-MAC> I<state> I<--persistent>
+=item B<domif-setlink> I<domain> I<interface-device> I<state> I<--persistent>
Modify link state of the domain's virtual interface. Possible values for
state are "up" and "down. If --persistent is specified, only the persistent
configuration of the domain is modified.
+I<interface-device> can be the interface's target name or the MAC address.
-=item B<domif-getlink> I<domain> I<interface-MAC> I<--persistent>
+=item B<domif-getlink> I<domain> I<interface-device> I<--persistent>
Query link state of the domain's virtual interface. If --persistent
is specified, query the persistent configuration.
+I<interface-device> can be the interface's target name or the MAC address.
=item B<domiftune> I<domain> I<interface-device>
[[I<--config>] [I<--live>] | [I<--current>]]