int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan)

{

    TAPState *s;

    int fd, vnet_hdr;



    if (!qemu_opt_get(opts, "br")) {

        qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE);

    }

    if (!qemu_opt_get(opts, "helper")) {

        qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER);

    }



    fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"),

                               qemu_opt_get(opts, "br"));

    if (fd == -1) {

        return -1;

    }



    fcntl(fd, F_SETFL, O_NONBLOCK);



    vnet_hdr = tap_probe_vnet_hdr(fd);



    s = net_tap_fd_init(vlan, "bridge", name, fd, vnet_hdr);

    if (!s) {

        close(fd);

        return -1;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s",

             qemu_opt_get(opts, "helper"), qemu_opt_get(opts, "br"));



    return 0;

}

int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan)

{

    TAPState *s;

    int fd, vnet_hdr;



    if (!qemu_opt_get(opts, "br")) {

        qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE);

    }

    if (!qemu_opt_get(opts, "helper")) {

        qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER);

    }



    fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"),

                               qemu_opt_get(opts, "br"));

    if (fd == -1) {

        return -1;

    }



    fcntl(fd, F_SETFL, O_NONBLOCK);



    vnet_hdr = tap_probe_vnet_hdr(fd);



    s = net_tap_fd_init(vlan, "bridge", name, fd, vnet_hdr);

    if (!s) {

        close(fd);

        return -1;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s",

             qemu_opt_get(opts, "helper"), qemu_opt_get(opts, "br"));



    return 0;

}

        return -1; int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan)
int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)

{

    TAPState *s;

    int VAR_3, VAR_4;



    if (!qemu_opt_get(VAR_0, "br")) {

        qemu_opt_set(VAR_0, "br", DEFAULT_BRIDGE_INTERFACE);

    }

    if (!qemu_opt_get(VAR_0, "helper")) {

        qemu_opt_set(VAR_0, "helper", DEFAULT_BRIDGE_HELPER);

    }



    VAR_3 = net_bridge_run_helper(qemu_opt_get(VAR_0, "helper"),

                               qemu_opt_get(VAR_0, "br"));

    if (VAR_3 == -1) {

        return -1;

    }



    fcntl(VAR_3, F_SETFL, O_NONBLOCK);



    VAR_4 = tap_probe_vnet_hdr(VAR_3);



    s = net_tap_fd_init(VAR_2, "bridge", VAR_1, VAR_3, VAR_4);

    if (!s) {

        close(VAR_3);

        return -1;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s",

             qemu_opt_get(VAR_0, "helper"), qemu_opt_get(VAR_0, "br"));



    return 0;

}

int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)
{ TAPState *s; int VAR_3, VAR_4; if (!qemu_opt_get(VAR_0, "br")) { qemu_opt_set(VAR_0, "br", DEFAULT_BRIDGE_INTERFACE); } if (!qemu_opt_get(VAR_0, "helper")) { qemu_opt_set(VAR_0, "helper", DEFAULT_BRIDGE_HELPER); } VAR_3 = net_bridge_run_helper(qemu_opt_get(VAR_0, "helper"),
qemu_opt_get(VAR_0, "br")); if (VAR_3 == -1) { return -1; } fcntl(VAR_3, F_SETFL, O_NONBLOCK); VAR_4 = tap_probe_vnet_hdr(VAR_3); s = net_tap_fd_init(VAR_2, "bridge", VAR_1, VAR_3, VAR_4); if (!s) { close(VAR_3); return -1; } snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s",
qemu_opt_get(VAR_0, "helper"), qemu_opt_get(VAR_0, "br")); return 0; }