Revision 7cb7434b net.c

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
            }

Also available in: Unified diff