Commit 34b25ca74eab49cedf994193dc7727e3f2613219
1 parent
436e5e53
Allow devices be notified of link status change (Mark McLoughlin)
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6248 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
6 additions
and
0 deletions
net.c
... | ... | @@ -1718,6 +1718,9 @@ int do_set_link(const char *name, const char *up_or_down) |
1718 | 1718 | term_printf("invalid link status '%s'; only 'up' or 'down' valid\n", |
1719 | 1719 | up_or_down); |
1720 | 1720 | |
1721 | + if (vc->link_status_changed) | |
1722 | + vc->link_status_changed(vc); | |
1723 | + | |
1721 | 1724 | return 1; |
1722 | 1725 | } |
1723 | 1726 | ... | ... |
net.h
... | ... | @@ -9,12 +9,15 @@ typedef ssize_t (IOReadvHandler)(void *, const struct iovec *, int); |
9 | 9 | |
10 | 10 | typedef struct VLANClientState VLANClientState; |
11 | 11 | |
12 | +typedef void (LinkStatusChanged)(VLANClientState *); | |
13 | + | |
12 | 14 | struct VLANClientState { |
13 | 15 | IOReadHandler *fd_read; |
14 | 16 | IOReadvHandler *fd_readv; |
15 | 17 | /* Packets may still be sent if this returns zero. It's used to |
16 | 18 | rate-limit the slirp code. */ |
17 | 19 | IOCanRWHandler *fd_can_read; |
20 | + LinkStatusChanged *link_status_changed; | |
18 | 21 | int link_down; |
19 | 22 | void *opaque; |
20 | 23 | struct VLANClientState *next; | ... | ... |