mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
slirp: generalize guestfwd with a callback based approach
Instead of calling into QEMU chardev directly, and mixing it with slirp_add_exec() handling, add a new function slirp_add_guestfwd() which takes a write callback. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
aaa0c642b1
commit
44b4ff2488
7 changed files with 74 additions and 31 deletions
|
@ -964,9 +964,9 @@ int tcp_ctl(struct socket *so)
|
|||
for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
|
||||
if (ex_ptr->ex_fport == so->so_fport &&
|
||||
so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
|
||||
if (ex_ptr->ex_chardev) {
|
||||
if (ex_ptr->write_cb) {
|
||||
so->s = -1;
|
||||
so->chardev = ex_ptr->ex_chardev;
|
||||
so->guestfwd = ex_ptr;
|
||||
return 1;
|
||||
}
|
||||
DEBUG_MISC(" executing %s", ex_ptr->ex_exec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue