Revision 4b37156c net.c
b/net.c | ||
---|---|---|
34 | 34 |
#include "monitor.h" |
35 | 35 |
#include "qemu-common.h" |
36 | 36 |
#include "qemu_socket.h" |
37 |
#include "qmp-commands.h" |
|
37 | 38 |
#include "hw/qdev.h" |
38 | 39 |
#include "iov.h" |
39 | 40 |
|
... | ... | |
1258 | 1259 |
} |
1259 | 1260 |
} |
1260 | 1261 |
|
1261 |
int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|
1262 |
void qmp_set_link(const char *name, bool up, Error **errp)
|
|
1262 | 1263 |
{ |
1263 | 1264 |
VLANState *vlan; |
1264 | 1265 |
VLANClientState *vc = NULL; |
1265 |
const char *name = qdict_get_str(qdict, "name"); |
|
1266 |
int up = qdict_get_bool(qdict, "up"); |
|
1267 | 1266 |
|
1268 | 1267 |
QTAILQ_FOREACH(vlan, &vlans, next) { |
1269 | 1268 |
QTAILQ_FOREACH(vc, &vlan->clients, next) { |
... | ... | |
1280 | 1279 |
done: |
1281 | 1280 |
|
1282 | 1281 |
if (!vc) { |
1283 |
qerror_report(QERR_DEVICE_NOT_FOUND, name);
|
|
1284 |
return -1;
|
|
1282 |
error_set(errp, QERR_DEVICE_NOT_FOUND, name);
|
|
1283 |
return; |
|
1285 | 1284 |
} |
1286 | 1285 |
|
1287 | 1286 |
vc->link_down = !up; |
... | ... | |
1300 | 1299 |
if (vc->peer && vc->peer->info->link_status_changed) { |
1301 | 1300 |
vc->peer->info->link_status_changed(vc->peer); |
1302 | 1301 |
} |
1303 |
return 0; |
|
1304 | 1302 |
} |
1305 | 1303 |
|
1306 | 1304 |
void net_cleanup(void) |
Also available in: Unified diff