int net_init_slirp(const NetClientOptions *opts, const char *name,

                   NetClientState *peer, Error **errp)

{

    /* FIXME error_setg(errp, ...) on failure */

    struct slirp_config_str *config;

    char *vnet;

    int ret;

    const NetdevUserOptions *user;

    const char **dnssearch;



    assert(opts->kind == NET_CLIENT_OPTIONS_KIND_USER);

    user = opts->user;



    vnet = user->has_net ? g_strdup(user->net) :

           user->has_ip  ? g_strdup_printf("%s/24", user->ip) :

           NULL;



    dnssearch = slirp_dnssearch(user->dnssearch);



    /* all optional fields are initialized to "all bits zero" */



    net_init_slirp_configs(user->hostfwd, SLIRP_CFG_HOSTFWD);

    net_init_slirp_configs(user->guestfwd, 0);



    ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet,

                         user->host, user->hostname, user->tftp,

                         user->bootfile, user->dhcpstart, user->dns, user->smb,

                         user->smbserver, dnssearch);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        g_free(config);

    }



    g_free(vnet);

    g_free(dnssearch);



    return ret;

}

int net_init_slirp(const NetClientOptions *opts, const char *name,

                   NetClientState *peer, Error **errp)

{

    

    struct slirp_config_str *config;

    char *vnet;

    int ret;

    const NetdevUserOptions *user;

    const char **dnssearch;



    assert(opts->kind == NET_CLIENT_OPTIONS_KIND_USER);

    user = opts->user;



    vnet = user->has_net ? g_strdup(user->net) :

           user->has_ip  ? g_strdup_printf("%s/24", user->ip) :

           NULL;



    dnssearch = slirp_dnssearch(user->dnssearch);



    



    net_init_slirp_configs(user->hostfwd, SLIRP_CFG_HOSTFWD);

    net_init_slirp_configs(user->guestfwd, 0);



    ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet,

                         user->host, user->hostname, user->tftp,

                         user->bootfile, user->dhcpstart, user->dns, user->smb,

                         user->smbserver, dnssearch);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        g_free(config);

    }



    g_free(vnet);

    g_free(dnssearch);



    return ret;

}

int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,

                   NetClientState *VAR_2, Error **VAR_3)

{

    

    struct slirp_config_str *VAR_4;

    char *VAR_5;

    int VAR_6;

    const NetdevUserOptions *VAR_7;

    const char **VAR_8;



    assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_USER);

    VAR_7 = VAR_0->VAR_7;



    VAR_5 = VAR_7->has_net ? g_strdup(VAR_7->net) :

           VAR_7->has_ip  ? g_strdup_printf("%s/24", VAR_7->ip) :

           NULL;



    VAR_8 = slirp_dnssearch(VAR_7->VAR_8);



    



    net_init_slirp_configs(VAR_7->hostfwd, SLIRP_CFG_HOSTFWD);

    net_init_slirp_configs(VAR_7->guestfwd, 0);



    VAR_6 = net_slirp_init(VAR_2, "VAR_7", VAR_1, VAR_7->q_restrict, VAR_5,

                         VAR_7->host, VAR_7->hostname, VAR_7->tftp,

                         VAR_7->bootfile, VAR_7->dhcpstart, VAR_7->dns, VAR_7->smb,

                         VAR_7->smbserver, VAR_8);



    while (slirp_configs) {

        VAR_4 = slirp_configs;

        slirp_configs = VAR_4->next;

        g_free(VAR_4);

    }



    g_free(VAR_5);

    g_free(VAR_8);



    return VAR_6;

}

int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,
NetClientState *VAR_2, Error **VAR_3)
{ struct slirp_config_str *VAR_4; char *VAR_5; int VAR_6; const NetdevUserOptions *VAR_7; const char **VAR_8; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_USER); VAR_7 = VAR_0->VAR_7; VAR_5 = VAR_7->has_net ? g_strdup(VAR_7->net) :
VAR_7->has_ip  ? g_strdup_printf("%s/24", VAR_7->ip) :
NULL; VAR_8 = slirp_dnssearch(VAR_7->VAR_8); net_init_slirp_configs(VAR_7->hostfwd, SLIRP_CFG_HOSTFWD); net_init_slirp_configs(VAR_7->guestfwd, 0); VAR_6 = net_slirp_init(VAR_2, "VAR_7", VAR_1, VAR_7->q_restrict, VAR_5,
VAR_7->host, VAR_7->hostname, VAR_7->tftp,
VAR_7->bootfile, VAR_7->dhcpstart, VAR_7->dns, VAR_7->smb,
VAR_7->smbserver, VAR_8); while (slirp_configs) { VAR_4 = slirp_configs; slirp_configs = VAR_4->next; g_free(VAR_4); } g_free(VAR_5); g_free(VAR_8); return VAR_6; }