From: Asias He Date: Sun, 17 Jul 2011 08:57:04 +0000 (+0800) Subject: kvm tools: Initialize MAC and IP address for uip properly X-Git-Tag: next-20110824~3^2~91 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fb6481536bef3287a51ec5121335efd03548b0b0;p=karo-tx-linux.git kvm tools: Initialize MAC and IP address for uip properly - Drop static initialization - Use {host,guet}_{ip,mac} to initialize Signed-off-by: Asias He Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c index af9b7409f6ba..739f15744920 100644 --- a/tools/kvm/virtio/net.c +++ b/tools/kvm/virtio/net.c @@ -93,9 +93,6 @@ static struct net_dev ndev = { | 1UL << VIRTIO_NET_F_GUEST_TSO4 | 1UL << VIRTIO_NET_F_GUEST_TSO6, .info = { - .host_mac.addr = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01}, - .guest_mac.addr = {0x00, 0x15, 0x15, 0x15, 0x15, 0x15}, - .host_ip = 0xc0a82101, .buf_nr = 20, } }; @@ -455,14 +452,20 @@ void virtio_net__init(const struct virtio_net_parameters *params) ndev.base_addr = net_base_addr; pci__register(&pci_header, dev); - for (i = 0 ; i < 6 ; i++) - ndev.config.mac[i] = params->guest_mac[i]; + for (i = 0 ; i < 6 ; i++) { + ndev.config.mac[i] = params->guest_mac[i]; + ndev.info.guest_mac.addr[i] = params->guest_mac[i]; + ndev.info.host_mac.addr[i] = params->host_mac[i]; + } ndev.mode = params->mode; if (ndev.mode == NET_MODE_TAP) { virtio_net__tap_init(params); ndev.ops = &tap_ops; } else { + ndev.info.host_ip = ntohl(inet_addr(params->host_ip)); + ndev.info.guest_ip = ntohl(inet_addr(params->guest_ip)); + ndev.info.guest_netmask = ntohl(inet_addr("255.255.255.0")); uip_init(&ndev.info); ndev.ops = &uip_ops; }