示例#1
0
void
vr_interface_req_process(void *s)
{
    char name[50];
    vr_interface_req *req = (vr_interface_req *)s;

    if (add_set)
        vr_ifindex = req->vifr_idx;

    if (!get_set && !list_set)
        return;

    printf("vif%d/%d\tOS: %s", req->vifr_rid, req->vifr_idx,
           req->vifr_os_idx ? if_indextoname(req->vifr_os_idx, name): "NULL");
    if (req->vifr_speed >= 0) {
        printf(" (Speed %d,", req->vifr_speed);
        if (req->vifr_duplex >= 0)
            printf(" Duplex %d", req->vifr_duplex);
        printf(")");
    }
    printf("\n");

    printf("\tType:%s HWaddr:"MAC_FORMAT" IPaddr:%x\n",
           vr_get_if_type_string(req->vifr_type),
           MAC_VALUE((uint8_t *)req->vifr_mac), req->vifr_ip);
    printf("\tVrf:%d Flags:%s MTU:%d Ref:%d\n", req->vifr_vrf,
           req->vifr_flags ? vr_if_flags(req->vifr_flags) : "NULL" ,
           req->vifr_mtu, req->vifr_ref_cnt);
    printf("\tRX packets:%" PRId64 "  bytes:%" PRId64 " errors:%" PRId64 "\n",
           req->vifr_ipackets,
           req->vifr_ibytes, req->vifr_ierrors);
    printf("\tTX packets:%" PRId64 "  bytes:%" PRId64 " errors:%" PRId64 "\n",
           req->vifr_opackets,
           req->vifr_obytes, req->vifr_oerrors);
    printf("\n");

    if (list_set)
        dump_marker = req->vifr_idx;

    if (get_set && req->vifr_flags & VIF_FLAG_SERVICE_IF) {
        vr_vrf_assign_dump = true;
        printf("VRF table(vlan:vrf):\n");
        vr_ifindex = req->vifr_idx;
    }

    return;
}
示例#2
0
void
vr_interface_req_process(void *s)
{
    char name[50];
    vr_interface_req *req = (vr_interface_req *)s;
    unsigned int printed = 0;

    if (add_set)
        vr_ifindex = req->vifr_idx;

    if (!get_set && !list_set)
        return;

    printed = printf("vif%d/%d", req->vifr_rid, req->vifr_idx);
    for (; printed < 12; printed++)
        printf(" ");
    printf("OS: %s", req->vifr_os_idx ?
        if_indextoname(req->vifr_os_idx, name): "NULL");

    if (req->vifr_type == VIF_TYPE_PHYSICAL) {
        if (req->vifr_speed >= 0) {
            printf(" (Speed %d,", req->vifr_speed);
            if (req->vifr_duplex >= 0)
                printf(" Duplex %d", req->vifr_duplex);
            printf(")");
        }
    } else if (req->vifr_type == VIF_TYPE_VIRTUAL_VLAN) {
        printf(" Vlan(o/i)(,S): %d/%d", req->vifr_ovlan_id, req->vifr_vlan_id);
        if (req->vifr_src_mac_size && req->vifr_src_mac)
            printf(", "MAC_FORMAT, MAC_VALUE((uint8_t *)req->vifr_src_mac));
        printf(" Bridge Index: %d", req->vifr_bridge_idx);
    }

    if (req->vifr_parent_vif_idx >= 0)
        printf(" Parent:vif0/%d", req->vifr_parent_vif_idx);

    printf("\n");

    vr_interface_print_header();
    printf("Type:%s HWaddr:"MAC_FORMAT" IPaddr:%x\n",
            vr_get_if_type_string(req->vifr_type),
            MAC_VALUE((uint8_t *)req->vifr_mac), req->vifr_ip);
    vr_interface_print_header();
    printf("Vrf:%d Flags:%s MTU:%d Ref:%d\n", req->vifr_vrf,
            req->vifr_flags ? vr_if_flags(req->vifr_flags) : "NULL" ,
            req->vifr_mtu, req->vifr_ref_cnt);
    vr_interface_print_header();
    printf("RX packets:%" PRId64 "  bytes:%" PRId64 " errors:%" PRId64 "\n",
            req->vifr_ipackets,
            req->vifr_ibytes, req->vifr_ierrors);
    vr_interface_print_header();
    printf("TX packets:%" PRId64 "  bytes:%" PRId64 " errors:%" PRId64 "\n",
            req->vifr_opackets,
            req->vifr_obytes, req->vifr_oerrors);
    printf("\n");

    if (list_set)
        dump_marker = req->vifr_idx;

    if (get_set && req->vifr_flags & VIF_FLAG_SERVICE_IF) {
        vr_vrf_assign_dump = true;
        printf("VRF table(vlan:vrf):\n");
        vr_ifindex = req->vifr_idx;
    }

    return;
}