Revision 7cb7434b

b/hw/e1000.c
1074 1074
    d->vc = qemu_new_vlan_client(nd->vlan, nd->model,
1075 1075
                                 e1000_receive, e1000_can_receive, d);
1076 1076

  
1077
    snprintf(d->vc->info_str, sizeof(d->vc->info_str),
1078
             "%s macaddr=%02x:%02x:%02x:%02x:%02x:%02x", info_str,
1079
             d->nd->macaddr[0], d->nd->macaddr[1], d->nd->macaddr[2],
1080
             d->nd->macaddr[3], d->nd->macaddr[4], d->nd->macaddr[5]);
1077
    qemu_format_nic_info_str(d->vc, d->nd->macaddr);
1081 1078

  
1082 1079
    register_savevm(info_str, -1, 2, nic_save, nic_load, d);
1083 1080
}
b/hw/eepro100.c
1779 1779
    s->vc = qemu_new_vlan_client(nd->vlan, nd->model,
1780 1780
                                 nic_receive, nic_can_receive, s);
1781 1781

  
1782
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1783
             "eepro100 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
1784
             s->macaddr[0],
1785
             s->macaddr[1],
1786
             s->macaddr[2], s->macaddr[3], s->macaddr[4], s->macaddr[5]);
1782
    qemu_format_nic_info_str(s->vc, s->macaddr);
1787 1783

  
1788 1784
    qemu_register_reset(nic_reset, s);
1789 1785

  
b/hw/mipsnet.c
256 256
        s->vc = NULL;
257 257
    }
258 258

  
259
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
260
             "mipsnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
261
              s->nd->macaddr[0],
262
              s->nd->macaddr[1],
263
              s->nd->macaddr[2],
264
              s->nd->macaddr[3],
265
              s->nd->macaddr[4],
266
              s->nd->macaddr[5]);
259
    qemu_format_nic_info_str(s->vc, s->nd->macaddr);
267 260

  
268 261
    mipsnet_reset(s);
269 262
    register_savevm("mipsnet", 0, 0, mipsnet_save, mipsnet_load, s);
b/hw/ne2000.c
744 744
    s->vc = qemu_new_vlan_client(nd->vlan, nd->model,
745 745
                                 ne2000_receive, ne2000_can_receive, s);
746 746

  
747
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
748
             "ne2000 macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
749
             s->macaddr[0],
750
             s->macaddr[1],
751
             s->macaddr[2],
752
             s->macaddr[3],
753
             s->macaddr[4],
754
             s->macaddr[5]);
747
    qemu_format_nic_info_str(s->vc, s->macaddr);
755 748

  
756 749
    register_savevm("ne2000", -1, 2, ne2000_save, ne2000_load, s);
757 750
}
......
814 807
    s->vc = qemu_new_vlan_client(nd->vlan, nd->model,
815 808
                                 ne2000_receive, ne2000_can_receive, s);
816 809

  
817
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
818
             "ne2000 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
819
             s->macaddr[0],
820
             s->macaddr[1],
821
             s->macaddr[2],
822
             s->macaddr[3],
823
             s->macaddr[4],
824
             s->macaddr[5]);
810
    qemu_format_nic_info_str(s->vc, s->macaddr);
825 811

  
826 812
    register_savevm("ne2000", -1, 3, ne2000_save, ne2000_load, s);
827 813
}
b/hw/pcnet.c
1939 1939
        d->vc = qemu_new_vlan_client(nd->vlan, nd->model,
1940 1940
                                     pcnet_receive, pcnet_can_receive, d);
1941 1941

  
1942
        snprintf(d->vc->info_str, sizeof(d->vc->info_str),
1943
                 "pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
1944
                 d->nd->macaddr[0],
1945
                 d->nd->macaddr[1],
1946
                 d->nd->macaddr[2],
1947
                 d->nd->macaddr[3],
1948
                 d->nd->macaddr[4],
1949
                 d->nd->macaddr[5]);
1942
        qemu_format_nic_info_str(d->vc, d->nd->macaddr);
1950 1943
    } else {
1951 1944
        d->vc = NULL;
1952 1945
    }
b/hw/rtl8139.c
3441 3441
    s->vc = qemu_new_vlan_client(nd->vlan, nd->model,
3442 3442
                                 rtl8139_receive, rtl8139_can_receive, s);
3443 3443

  
3444
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
3445
             "rtl8139 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
3446
             s->macaddr[0],
3447
             s->macaddr[1],
3448
             s->macaddr[2],
3449
             s->macaddr[3],
3450
             s->macaddr[4],
3451
             s->macaddr[5]);
3444
    qemu_format_nic_info_str(s->vc, s->macaddr);
3452 3445

  
3453 3446
    s->cplus_txbuffer = NULL;
3454 3447
    s->cplus_txbuffer_len = 0;
b/hw/usb-net.c
1456 1456
    s->vc = qemu_new_vlan_client(nd->vlan, nd->model,
1457 1457
                    usbnet_receive, usbnet_can_receive, s);
1458 1458

  
1459
    qemu_format_nic_info_str(s->vc, s->mac);
1460

  
1459 1461
    snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
1460 1462
                    "%02x%02x%02x%02x%02x%02x",
1461 1463
                    0x40, s->mac[1], s->mac[2],
1462 1464
                    s->mac[3], s->mac[4], s->mac[5]);
1463
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
1464
                    "usbnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
1465
                    s->mac[0], s->mac[1], s->mac[2],
1466
                    s->mac[3], s->mac[4], s->mac[5]);
1467 1465
    fprintf(stderr, "usbnet: initialized mac %02x:%02x:%02x:%02x:%02x:%02x\n",
1468 1466
                    s->mac[0], s->mac[1], s->mac[2],
1469 1467
                    s->mac[3], s->mac[4], s->mac[5]);
b/net.c
296 296
}
297 297
#endif
298 298

  
299
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6])
300
{
301
    snprintf(vc->info_str, sizeof(vc->info_str),
302
             "macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
303
             macaddr[0], macaddr[1], macaddr[2],
304
             macaddr[3], macaddr[4], macaddr[5]);
305
}
306

  
299 307
static char *assign_name(VLANClientState *vc1, const char *model)
300 308
{
301 309
    VLANState *vlan;
......
474 482
    }
475 483
    slirp_vc = qemu_new_vlan_client(vlan, model,
476 484
                                    slirp_receive, NULL, NULL);
477
    snprintf(slirp_vc->info_str, sizeof(slirp_vc->info_str), "user redirector");
485
    slirp_vc->info_str[0] = '\0';
478 486
    return 0;
479 487
}
480 488

  
......
699 707
    s->vc->fd_readv = tap_receive_iov;
700 708
#endif
701 709
    qemu_set_fd_handler(s->fd, tap_send, NULL, s);
702
    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
710
    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd);
703 711
    return s;
704 712
}
705 713

  
......
954 962
    if (!s)
955 963
        return -1;
956 964
    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
957
             "tap: ifname=%s setup_script=%s", ifname, setup_script);
965
             "ifname=%s,script=%s,downscript=%s",
966
             ifname, setup_script, down_script);
958 967
    if (down_script && strcmp(down_script, "no"))
959 968
        snprintf(s->down_script, sizeof(s->down_script), "%s", down_script);
960 969
    return 0;
......
1016 1025
    }
1017 1026
    s->vc = qemu_new_vlan_client(vlan, model, vde_from_qemu, NULL, s);
1018 1027
    qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
1019
    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "vde: sock=%s fd=%d",
1028
    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d",
1020 1029
             sock, vde_datafd(s->vde));
1021 1030
    return 0;
1022 1031
}
......
1639 1648
    for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
1640 1649
        term_printf("VLAN %d devices:\n", vlan->id);
1641 1650
        for(vc = vlan->first_client; vc != NULL; vc = vc->next)
1642
            term_printf("  %s\n", vc->info_str);
1651
            term_printf("  %s: %s\n", vc->name, vc->info_str);
1643 1652
    }
1644 1653
}
1645 1654

  
......
1657 1666
                char ifname[64];
1658 1667
                TAPState *s = vc->opaque;
1659 1668

  
1660
                if (sscanf(vc->info_str, "tap: ifname=%63s ", ifname) == 1 &&
1669
                if (strcmp(vc->model, "tap") == 0 &&
1670
                    sscanf(vc->info_str, "ifname=%63s ", ifname) == 1 &&
1661 1671
                    s->down_script[0])
1662 1672
                    launch_script(s->down_script, ifname, s->fd);
1663 1673
            }
b/net.h
41 41
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
42 42
                          int iovcnt);
43 43
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
44
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
44 45
void qemu_handler_true(void *opaque);
45 46

  
46 47
void do_info_network(void);

Also available in: Unified diff