int tcp_ctl(struct socket *so)

{

    Slirp *slirp = so->slirp;

    struct sbuf *sb = &so->so_snd;

    struct ex_list *ex_ptr;

    int do_pty;



    DEBUG_CALL("tcp_ctl");

    DEBUG_ARG("so = %lx", (long )so);



    if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {

        /* Check if it's pty_exec */

        for (ex_ptr = slirp->exec_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_pty == 3) {

                    so->s = -1;

                    so->extra = (void *)ex_ptr->ex_exec;

                    return 1;

                }

                do_pty = ex_ptr->ex_pty;

                DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));

                return fork_exec(so, ex_ptr->ex_exec, do_pty);

            }

        }

    }

    sb->sb_cc =

        snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),

                 "Error: No application configured.\r\n");

    sb->sb_wptr += sb->sb_cc;

    return 0;

}

int tcp_ctl(struct socket *so)

{

    Slirp *slirp = so->slirp;

    struct sbuf *sb = &so->so_snd;

    struct ex_list *ex_ptr;

    int do_pty;



    DEBUG_CALL("tcp_ctl");

    DEBUG_ARG("so = %lx", (long )so);



    if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {

        

        for (ex_ptr = slirp->exec_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_pty == 3) {

                    so->s = -1;

                    so->extra = (void *)ex_ptr->ex_exec;

                    return 1;

                }

                do_pty = ex_ptr->ex_pty;

                DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));

                return fork_exec(so, ex_ptr->ex_exec, do_pty);

            }

        }

    }

    sb->sb_cc =

        snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),

                 "Error: No application configured.\r\n");

    sb->sb_wptr += sb->sb_cc;

    return 0;

}

int FUNC_0(struct socket *VAR_0)

{

    Slirp *slirp = VAR_0->slirp;

    struct sbuf *VAR_1 = &VAR_0->so_snd;

    struct ex_list *VAR_2;

    int VAR_3;



    DEBUG_CALL("FUNC_0");

    DEBUG_ARG("VAR_0 = %lx", (long )VAR_0);



    if (VAR_0->so_faddr.s_addr != slirp->vhost_addr.s_addr) {

        

        for (VAR_2 = slirp->exec_list; VAR_2; VAR_2 = VAR_2->ex_next) {

            if (VAR_2->ex_fport == VAR_0->so_fport &&

                VAR_0->so_faddr.s_addr == VAR_2->ex_addr.s_addr) {

                if (VAR_2->ex_pty == 3) {

                    VAR_0->s = -1;

                    VAR_0->extra = (void *)VAR_2->ex_exec;

                    return 1;

                }

                VAR_3 = VAR_2->ex_pty;

                DEBUG_MISC((dfd, " executing %s \n",VAR_2->ex_exec));

                return fork_exec(VAR_0, VAR_2->ex_exec, VAR_3);

            }

        }

    }

    VAR_1->sb_cc =

        snprintf(VAR_1->sb_wptr, VAR_1->sb_datalen - (VAR_1->sb_wptr - VAR_1->sb_data),

                 "Error: No application configured.\r\n");

    VAR_1->sb_wptr += VAR_1->sb_cc;

    return 0;

}

int FUNC_0(struct socket *VAR_0)
{ Slirp *slirp = VAR_0->slirp; struct sbuf *VAR_1 = &VAR_0->so_snd; struct ex_list *VAR_2; int VAR_3; DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %lx", (long )VAR_0); if (VAR_0->so_faddr.s_addr != slirp->vhost_addr.s_addr) { for (VAR_2 = slirp->exec_list; VAR_2; VAR_2 = VAR_2->ex_next) { if (VAR_2->ex_fport == VAR_0->so_fport &&
VAR_0->so_faddr.s_addr == VAR_2->ex_addr.s_addr) { if (VAR_2->ex_pty == 3) { VAR_0->s = -1; VAR_0->extra = (void *)VAR_2->ex_exec; return 1; } VAR_3 = VAR_2->ex_pty; DEBUG_MISC((dfd, " executing %s \n",VAR_2->ex_exec)); return fork_exec(VAR_0, VAR_2->ex_exec, VAR_3); } } } VAR_1->sb_cc =
snprintf(VAR_1->sb_wptr, VAR_1->sb_datalen - (VAR_1->sb_wptr - VAR_1->sb_data),
"Error: No application configured.\r\n"); VAR_1->sb_wptr += VAR_1->sb_cc; return 0; }