Revision 6f7b3b1b

b/net.c
830 830
    const char *type;
831 831
    net_client_init_func init;
832 832
    QemuOptDesc desc[NET_MAX_DESC];
833
} net_client_types[] = {
834
    {
833
} net_client_types[NET_CLIENT_TYPE_MAX] = {
834
    [NET_CLIENT_TYPE_NONE] = {
835 835
        .type = "none",
836 836
        .desc = {
837 837
            NET_COMMON_PARAMS_DESC,
838 838
            { /* end of list */ }
839 839
        },
840
    }, {
840
    },
841
    [NET_CLIENT_TYPE_NIC] = {
841 842
        .type = "nic",
842 843
        .init = net_init_nic,
843 844
        .desc = {
......
866 867
            },
867 868
            { /* end of list */ }
868 869
        },
870
    },
869 871
#ifdef CONFIG_SLIRP
870
    }, {
872
    [NET_CLIENT_TYPE_USER] = {
871 873
        .type = "user",
872 874
        .init = net_init_slirp,
873 875
        .desc = {
......
927 929
            },
928 930
            { /* end of list */ }
929 931
        },
932
    },
930 933
#endif
931
    }, {
934
    [NET_CLIENT_TYPE_TAP] = {
932 935
        .type = "tap",
933 936
        .init = net_init_tap,
934 937
        .desc = {
......
975 978
#endif /* _WIN32 */
976 979
            { /* end of list */ }
977 980
        },
978
    }, {
981
    },
982
    [NET_CLIENT_TYPE_SOCKET] = {
979 983
        .type = "socket",
980 984
        .init = net_init_socket,
981 985
        .desc = {
......
1003 1007
            },
1004 1008
            { /* end of list */ }
1005 1009
        },
1010
    },
1006 1011
#ifdef CONFIG_VDE
1007
    }, {
1012
    [NET_CLIENT_TYPE_VDE] = {
1008 1013
        .type = "vde",
1009 1014
        .init = net_init_vde,
1010 1015
        .desc = {
......
1028 1033
            },
1029 1034
            { /* end of list */ }
1030 1035
        },
1036
    },
1031 1037
#endif
1032
    }, {
1038
    [NET_CLIENT_TYPE_DUMP] = {
1033 1039
        .type = "dump",
1034 1040
        .init = net_init_dump,
1035 1041
        .desc = {
......
1046 1052
            { /* end of list */ }
1047 1053
        },
1048 1054
    },
1049
    { /* end of list */ }
1050 1055
};
1051 1056

  
1052 1057
int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
......
1094 1099
        name = qemu_opt_get(opts, "name");
1095 1100
    }
1096 1101

  
1097
    for (i = 0; net_client_types[i].type != NULL; i++) {
1098
        if (!strcmp(net_client_types[i].type, type)) {
1102
    for (i = 0; i < NET_CLIENT_TYPE_MAX; i++) {
1103
        if (net_client_types[i].type != NULL &&
1104
            !strcmp(net_client_types[i].type, type)) {
1099 1105
            VLANState *vlan = NULL;
1100 1106
            int ret;
1101 1107

  
......
1330 1336
            case NET_CLIENT_TYPE_NIC:
1331 1337
                has_nic = 1;
1332 1338
                break;
1333
            case NET_CLIENT_TYPE_SLIRP:
1339
            case NET_CLIENT_TYPE_USER:
1334 1340
            case NET_CLIENT_TYPE_TAP:
1335 1341
            case NET_CLIENT_TYPE_SOCKET:
1336 1342
            case NET_CLIENT_TYPE_VDE:
b/net.h
31 31
typedef enum {
32 32
    NET_CLIENT_TYPE_NONE,
33 33
    NET_CLIENT_TYPE_NIC,
34
    NET_CLIENT_TYPE_SLIRP,
34
    NET_CLIENT_TYPE_USER,
35 35
    NET_CLIENT_TYPE_TAP,
36 36
    NET_CLIENT_TYPE_SOCKET,
37 37
    NET_CLIENT_TYPE_VDE,
38
    NET_CLIENT_TYPE_DUMP
38
    NET_CLIENT_TYPE_DUMP,
39

  
40
    NET_CLIENT_TYPE_MAX
39 41
} net_client_type;
40 42

  
41 43
typedef void (NetPoll)(VLANClientState *, bool enable);
b/net/slirp.c
128 128
}
129 129

  
130 130
static NetClientInfo net_slirp_info = {
131
    .type = NET_CLIENT_TYPE_SLIRP,
131
    .type = NET_CLIENT_TYPE_USER,
132 132
    .size = sizeof(SlirpState),
133 133
    .receive = net_slirp_receive,
134 134
    .cleanup = net_slirp_cleanup,

Also available in: Unified diff