direct-io.hg

changeset 15195:e2ba95ed2b09

hvm: Exceed maximum number of ioemu's NIC for VNIF.

QEMU should ignore excess NICs instead of failing to initialise.

Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Thu May 31 10:58:22 2007 +0100 (2007-05-31)
parents 4c2b8ca4842c
children f6ff5d42164f
files tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Thu May 31 10:53:11 2007 +0100
     1.2 +++ b/tools/ioemu/vl.c	Thu May 31 10:58:22 2007 +0100
     1.3 @@ -3965,30 +3965,30 @@ static int net_client_init(const char *s
     1.4          NICInfo *nd;
     1.5          uint8_t *macaddr;
     1.6  
     1.7 -        if (nb_nics >= MAX_NICS) {
     1.8 +        if (nb_nics < MAX_NICS) {
     1.9 +            nd = &nd_table[nb_nics];
    1.10 +            macaddr = nd->macaddr;
    1.11 +            macaddr[0] = 0x52;
    1.12 +            macaddr[1] = 0x54;
    1.13 +            macaddr[2] = 0x00;
    1.14 +            macaddr[3] = 0x12;
    1.15 +            macaddr[4] = 0x34;
    1.16 +            macaddr[5] = 0x56 + nb_nics;
    1.17 +
    1.18 +            if (get_param_value(buf, sizeof(buf), "macaddr", p)) {
    1.19 +                if (parse_macaddr(macaddr, buf) < 0) {
    1.20 +                    fprintf(stderr, "invalid syntax for ethernet address\n");
    1.21 +                    return -1;
    1.22 +                }
    1.23 +            }
    1.24 +            if (get_param_value(buf, sizeof(buf), "model", p)) {
    1.25 +                nd->model = strdup(buf);
    1.26 +            }
    1.27 +            nd->vlan = vlan;
    1.28 +            nb_nics++;
    1.29 +        } else {
    1.30              fprintf(stderr, "Too Many NICs\n");
    1.31 -            return -1;
    1.32 -        }
    1.33 -        nd = &nd_table[nb_nics];
    1.34 -        macaddr = nd->macaddr;
    1.35 -        macaddr[0] = 0x52;
    1.36 -        macaddr[1] = 0x54;
    1.37 -        macaddr[2] = 0x00;
    1.38 -        macaddr[3] = 0x12;
    1.39 -        macaddr[4] = 0x34;
    1.40 -        macaddr[5] = 0x56 + nb_nics;
    1.41 -
    1.42 -        if (get_param_value(buf, sizeof(buf), "macaddr", p)) {
    1.43 -            if (parse_macaddr(macaddr, buf) < 0) {
    1.44 -                fprintf(stderr, "invalid syntax for ethernet address\n");
    1.45 -                return -1;
    1.46 -            }
    1.47 -        }
    1.48 -        if (get_param_value(buf, sizeof(buf), "model", p)) {
    1.49 -            nd->model = strdup(buf);
    1.50 -        }
    1.51 -        nd->vlan = vlan;
    1.52 -        nb_nics++;
    1.53 +	}
    1.54          ret = 0;
    1.55      } else
    1.56      if (!strcmp(device, "none")) {