static int net_tap_init(VLANState *vlan, const char *model,

                        const char *name, const char *ifname1,

                        const char *setup_script, const char *down_script)

{

    TAPState *s;

    int fd;

    char ifname[128];



    if (ifname1 != NULL)

        pstrcpy(ifname, sizeof(ifname), ifname1);

    else

        ifname[0] = '\0';

    TFR(fd = tap_open(ifname, sizeof(ifname)));

    if (fd < 0)

        return -1;



    if (!setup_script || !strcmp(setup_script, "no"))

        setup_script = "";

    if (setup_script[0] != '\0') {

	if (launch_script(setup_script, ifname, fd))

	    return -1;

    }

    s = net_tap_fd_init(vlan, model, name, fd);

    if (!s)

        return -1;

    snprintf(s->vc->info_str, sizeof(s->vc->info_str),

             "ifname=%s,script=%s,downscript=%s",

             ifname, setup_script, down_script);

    if (down_script && strcmp(down_script, "no")) {

        snprintf(s->down_script, sizeof(s->down_script), "%s", down_script);

        snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname);

    }

    return 0;

}

static int net_tap_init(VLANState *vlan, const char *model,

                        const char *name, const char *ifname1,

                        const char *setup_script, const char *down_script)

{

    TAPState *s;

    int fd;

    char ifname[128];



    if (ifname1 != NULL)

        pstrcpy(ifname, sizeof(ifname), ifname1);

    else

        ifname[0] = '\0';

    TFR(fd = tap_open(ifname, sizeof(ifname)));

    if (fd < 0)

        return -1;



    if (!setup_script || !strcmp(setup_script, "no"))

        setup_script = "";

    if (setup_script[0] != '\0') {

	if (launch_script(setup_script, ifname, fd))

	    return -1;

    }

    s = net_tap_fd_init(vlan, model, name, fd);

    if (!s)

        return -1;

    snprintf(s->vc->info_str, sizeof(s->vc->info_str),

             "ifname=%s,script=%s,downscript=%s",

             ifname, setup_script, down_script);

    if (down_script && strcmp(down_script, "no")) {

        snprintf(s->down_script, sizeof(s->down_script), "%s", down_script);

        snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname);

    }

    return 0;

}

    if (!s)         return -1;         return -1;
static int FUNC_0(VLANState *VAR_0, const char *VAR_1,

                        const char *VAR_2, const char *VAR_3,

                        const char *VAR_4, const char *VAR_5)

{

    TAPState *s;

    int VAR_6;

    char VAR_7[128];



    if (VAR_3 != NULL)

        pstrcpy(VAR_7, sizeof(VAR_7), VAR_3);

    else

        VAR_7[0] = '\0';

    TFR(VAR_6 = tap_open(VAR_7, sizeof(VAR_7)));

    if (VAR_6 < 0)

        return -1;



    if (!VAR_4 || !strcmp(VAR_4, "no"))

        VAR_4 = "";

    if (VAR_4[0] != '\0') {

	if (launch_script(VAR_4, VAR_7, VAR_6))

	    return -1;

    }

    s = net_tap_fd_init(VAR_0, VAR_1, VAR_2, VAR_6);

    if (!s)

        return -1;

    snprintf(s->vc->info_str, sizeof(s->vc->info_str),

             "VAR_7=%s,script=%s,downscript=%s",

             VAR_7, VAR_4, VAR_5);

    if (VAR_5 && strcmp(VAR_5, "no")) {

        snprintf(s->VAR_5, sizeof(s->VAR_5), "%s", VAR_5);

        snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", VAR_7);

    }

    return 0;

}

static int FUNC_0(VLANState *VAR_0, const char *VAR_1,
const char *VAR_2, const char *VAR_3,
const char *VAR_4, const char *VAR_5)
{ TAPState *s; int VAR_6; char VAR_7[128]; if (VAR_3 != NULL)
pstrcpy(VAR_7, sizeof(VAR_7), VAR_3); else
VAR_7[0] = '\0'; TFR(VAR_6 = tap_open(VAR_7, sizeof(VAR_7))); if (VAR_6 < 0)
return -1; if (!VAR_4 || !strcmp(VAR_4, "no"))
VAR_4 = ""; if (VAR_4[0] != '\0') { if (launch_script(VAR_4, VAR_7, VAR_6))
return -1; } s = net_tap_fd_init(VAR_0, VAR_1, VAR_2, VAR_6); if (!s)
return -1; snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"VAR_7=%s,script=%s,downscript=%s",
VAR_7, VAR_4, VAR_5); if (VAR_5 && strcmp(VAR_5, "no")) { snprintf(s->VAR_5, sizeof(s->VAR_5), "%s", VAR_5); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", VAR_7); } return 0; }