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

{

    struct slirp_config_str *config;

    const char *vhost;

    const char *vhostname;

    const char *vdhcp_start;

    const char *vnamesrv;

    const char *tftp_export;

    const char *bootfile;

    const char *smb_export;

    const char *vsmbsrv;

    const char *restrict_opt;

    char *vnet = NULL;

    int restricted = 0;

    int ret;



    vhost       = qemu_opt_get(opts, "host");

    vhostname   = qemu_opt_get(opts, "hostname");

    vdhcp_start = qemu_opt_get(opts, "dhcpstart");

    vnamesrv    = qemu_opt_get(opts, "dns");

    tftp_export = qemu_opt_get(opts, "tftp");

    bootfile    = qemu_opt_get(opts, "bootfile");

    smb_export  = qemu_opt_get(opts, "smb");

    vsmbsrv     = qemu_opt_get(opts, "smbserver");



    restrict_opt = qemu_opt_get(opts, "restrict");

    if (restrict_opt) {

        if (!strcmp(restrict_opt, "on") ||

            !strcmp(restrict_opt, "yes") || !strcmp(restrict_opt, "y")) {

            restricted = 1;

        } else if (strcmp(restrict_opt, "off") &&

            strcmp(restrict_opt, "no") && strcmp(restrict_opt, "n")) {

            error_report("invalid option: 'restrict=%s'", restrict_opt);

            return -1;

        }

    }



    if (qemu_opt_get(opts, "ip")) {

        const char *ip = qemu_opt_get(opts, "ip");

        int l = strlen(ip) + strlen("/24") + 1;



        vnet = g_malloc(l);



        /* emulate legacy ip= parameter */

        pstrcpy(vnet, l, ip);

        pstrcat(vnet, l, "/24");

    }



    if (qemu_opt_get(opts, "net")) {

        if (vnet) {

            g_free(vnet);

        }

        vnet = g_strdup(qemu_opt_get(opts, "net"));

    }



    qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0);



    ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost,

                         vhostname, tftp_export, bootfile, vdhcp_start,

                         vnamesrv, smb_export, vsmbsrv);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        g_free(config);

    }



    g_free(vnet);



    return ret;

}

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

{

    struct slirp_config_str *config;

    const char *vhost;

    const char *vhostname;

    const char *vdhcp_start;

    const char *vnamesrv;

    const char *tftp_export;

    const char *bootfile;

    const char *smb_export;

    const char *vsmbsrv;

    const char *restrict_opt;

    char *vnet = NULL;

    int restricted = 0;

    int ret;



    vhost       = qemu_opt_get(opts, "host");

    vhostname   = qemu_opt_get(opts, "hostname");

    vdhcp_start = qemu_opt_get(opts, "dhcpstart");

    vnamesrv    = qemu_opt_get(opts, "dns");

    tftp_export = qemu_opt_get(opts, "tftp");

    bootfile    = qemu_opt_get(opts, "bootfile");

    smb_export  = qemu_opt_get(opts, "smb");

    vsmbsrv     = qemu_opt_get(opts, "smbserver");



    restrict_opt = qemu_opt_get(opts, "restrict");

    if (restrict_opt) {

        if (!strcmp(restrict_opt, "on") ||

            !strcmp(restrict_opt, "yes") || !strcmp(restrict_opt, "y")) {

            restricted = 1;

        } else if (strcmp(restrict_opt, "off") &&

            strcmp(restrict_opt, "no") && strcmp(restrict_opt, "n")) {

            error_report("invalid option: 'restrict=%s'", restrict_opt);

            return -1;

        }

    }



    if (qemu_opt_get(opts, "ip")) {

        const char *ip = qemu_opt_get(opts, "ip");

        int l = strlen(ip) + strlen("/24") + 1;



        vnet = g_malloc(l);



        

        pstrcpy(vnet, l, ip);

        pstrcat(vnet, l, "/24");

    }



    if (qemu_opt_get(opts, "net")) {

        if (vnet) {

            g_free(vnet);

        }

        vnet = g_strdup(qemu_opt_get(opts, "net"));

    }



    qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0);



    ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost,

                         vhostname, tftp_export, bootfile, vdhcp_start,

                         vnamesrv, smb_export, vsmbsrv);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        g_free(config);

    }



    g_free(vnet);



    return ret;

}

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

{

    struct slirp_config_str *VAR_3;

    const char *VAR_4;

    const char *VAR_5;

    const char *VAR_6;

    const char *VAR_7;

    const char *VAR_8;

    const char *VAR_9;

    const char *VAR_10;

    const char *VAR_11;

    const char *VAR_12;

    char *VAR_13 = NULL;

    int VAR_14 = 0;

    int VAR_15;



    VAR_4       = qemu_opt_get(VAR_0, "host");

    VAR_5   = qemu_opt_get(VAR_0, "hostname");

    VAR_6 = qemu_opt_get(VAR_0, "dhcpstart");

    VAR_7    = qemu_opt_get(VAR_0, "dns");

    VAR_8 = qemu_opt_get(VAR_0, "tftp");

    VAR_9    = qemu_opt_get(VAR_0, "VAR_9");

    VAR_10  = qemu_opt_get(VAR_0, "smb");

    VAR_11     = qemu_opt_get(VAR_0, "smbserver");



    VAR_12 = qemu_opt_get(VAR_0, "restrict");

    if (VAR_12) {

        if (!strcmp(VAR_12, "on") ||

            !strcmp(VAR_12, "yes") || !strcmp(VAR_12, "y")) {

            VAR_14 = 1;

        } else if (strcmp(VAR_12, "off") &&

            strcmp(VAR_12, "no") && strcmp(VAR_12, "n")) {

            error_report("invalid option: 'restrict=%s'", VAR_12);

            return -1;

        }

    }



    if (qemu_opt_get(VAR_0, "VAR_16")) {

        const char *VAR_16 = qemu_opt_get(VAR_0, "VAR_16");

        int VAR_17 = strlen(VAR_16) + strlen("/24") + 1;



        VAR_13 = g_malloc(VAR_17);



        

        pstrcpy(VAR_13, VAR_17, VAR_16);

        pstrcat(VAR_13, VAR_17, "/24");

    }



    if (qemu_opt_get(VAR_0, "net")) {

        if (VAR_13) {

            g_free(VAR_13);

        }

        VAR_13 = g_strdup(qemu_opt_get(VAR_0, "net"));

    }



    qemu_opt_foreach(VAR_0, net_init_slirp_configs, NULL, 0);



    VAR_15 = net_slirp_init(VAR_2, "user", VAR_1, VAR_14, VAR_13, VAR_4,

                         VAR_5, VAR_8, VAR_9, VAR_6,

                         VAR_7, VAR_10, VAR_11);



    while (slirp_configs) {

        VAR_3 = slirp_configs;

        slirp_configs = VAR_3->next;

        g_free(VAR_3);

    }



    g_free(VAR_13);



    return VAR_15;

}

int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)
{ struct slirp_config_str *VAR_3; const char *VAR_4; const char *VAR_5; const char *VAR_6; const char *VAR_7; const char *VAR_8; const char *VAR_9; const char *VAR_10; const char *VAR_11; const char *VAR_12; char *VAR_13 = NULL; int VAR_14 = 0; int VAR_15; VAR_4       = qemu_opt_get(VAR_0, "host"); VAR_5   = qemu_opt_get(VAR_0, "hostname"); VAR_6 = qemu_opt_get(VAR_0, "dhcpstart"); VAR_7    = qemu_opt_get(VAR_0, "dns"); VAR_8 = qemu_opt_get(VAR_0, "tftp"); VAR_9    = qemu_opt_get(VAR_0, "VAR_9"); VAR_10  = qemu_opt_get(VAR_0, "smb"); VAR_11     = qemu_opt_get(VAR_0, "smbserver"); VAR_12 = qemu_opt_get(VAR_0, "restrict"); if (VAR_12) { if (!strcmp(VAR_12, "on") ||
!strcmp(VAR_12, "yes") || !strcmp(VAR_12, "y")) { VAR_14 = 1; } else if (strcmp(VAR_12, "off") && strcmp(VAR_12, "no") && strcmp(VAR_12, "n")) { error_report("invalid option: 'restrict=%s'", VAR_12); return -1; } } if (qemu_opt_get(VAR_0, "VAR_16")) { const char *VAR_16 = qemu_opt_get(VAR_0, "VAR_16"); int VAR_17 = strlen(VAR_16) + strlen("/24") + 1; VAR_13 = g_malloc(VAR_17); pstrcpy(VAR_13, VAR_17, VAR_16); pstrcat(VAR_13, VAR_17, "/24"); } if (qemu_opt_get(VAR_0, "net")) { if (VAR_13) { g_free(VAR_13); } VAR_13 = g_strdup(qemu_opt_get(VAR_0, "net")); } qemu_opt_foreach(VAR_0, net_init_slirp_configs, NULL, 0); VAR_15 = net_slirp_init(VAR_2, "user", VAR_1, VAR_14, VAR_13, VAR_4,
VAR_5, VAR_8, VAR_9, VAR_6,
VAR_7, VAR_10, VAR_11); while (slirp_configs) { VAR_3 = slirp_configs; slirp_configs = VAR_3->next; g_free(VAR_3); } g_free(VAR_13); return VAR_15; }