Esempio n. 1
0
File: rtmsg.c Progetto: t2mune/nield
/*
 * debug attribute RTA_METRICS
 */
void debug_rta_metrics(int lev, struct rtattr *rta, const char *name)
{
    struct rtattr *rtax[RTAX_MAX+1];

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(rta->rta_len));
    parse_rtattr(rtax, RTAX_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta));

    if(rtax[RTAX_LOCK])
        debug_rta_u32(lev+1, rtax[RTAX_LOCK],
            "RTAX_LOCK", NULL);

    if(rtax[RTAX_MTU])
        debug_rta_u32(lev+1, rtax[RTAX_MTU],
            "RTAX_MTU", NULL);

    if(rtax[RTAX_ADVMSS])
        debug_rta_u32(lev+1, rtax[RTAX_ADVMSS],
            "RTAX_ADVMSS", NULL);

    if(rtax[RTAX_HOPLIMIT])
        debug_rta_s32(lev+1, rtax[RTAX_HOPLIMIT],
            "RTAX_HOPLIMIT", NULL);

    if(rtax[RTAX_WINDOW])
        debug_rta_u32(lev+1, rtax[RTAX_WINDOW],
            "RTAX_WINDOW", NULL);
}
Esempio n. 2
0
/*
 * debug flow options
 */
void debug_tca_options_flow(int lev, struct rtattr *tca, const char *name)
{
    struct rtattr *flow[__TCA_FLOW_MAX];

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len));
    parse_nested_rtattr(flow, TCA_FLOW_MAX, tca);

    if(flow[TCA_FLOW_KEYS])
        debug_rta_u32(lev+1, flow[TCA_FLOW_KEYS],
            "TCA_FLOW_KEYS", conv_flow_key);

    if(flow[TCA_FLOW_MODE])
        debug_rta_u32(lev+1, flow[TCA_FLOW_MODE],
            "TCA_FLOW_MODE", conv_flow_mode);

    if(flow[TCA_FLOW_BASECLASS])
        debug_tca_classid(lev+1, flow[TCA_FLOW_BASECLASS],
            "TCA_FLOW_BASECLASS");

    if(flow[TCA_FLOW_RSHIFT])
        debug_rta_u32(lev+1, flow[TCA_FLOW_RSHIFT],
            "TCA_FLOW_RSHIT", NULL);

    if(flow[TCA_FLOW_ADDEND])
        debug_rta_u32x(lev+1, flow[TCA_FLOW_ADDEND],
            "TCA_FLOW_ADDEND", NULL);

    if(flow[TCA_FLOW_MASK])
        debug_rta_u32x(lev+1, flow[TCA_FLOW_MASK],
            "TCA_FLOW_MASK", NULL);

    if(flow[TCA_FLOW_XOR])
        debug_rta_u32x(lev+1, flow[TCA_FLOW_XOR],
            "TCA_FLOW_XOR", NULL);

    if(flow[TCA_FLOW_DIVISOR])
        debug_rta_u32(lev+1, flow[TCA_FLOW_DIVISOR],
            "TCA_FLOW_DIVISOR", NULL);

    if(flow[TCA_FLOW_ACT])
        debug_tca_acts(lev+1, flow[TCA_FLOW_ACT],
            "TCA_FLOW_ACT");

    if(flow[TCA_FLOW_POLICE])
        debug_tca_act_options_police(lev+1, flow[TCA_FLOW_POLICE],
            "TCA_FLOW_POLICE");

    if(flow[TCA_FLOW_EMATCHES])
        debug_tca_ematch(lev+1, flow[TCA_FLOW_EMATCHES],
            "TCA_FLOW_EMATCHES");

    if(flow[TCA_FLOW_PERTURB])
        debug_rta_u32(lev+1, flow[TCA_FLOW_PERTURB],
            "TCA_FLOW_PERTURB", NULL);
}
Esempio n. 3
0
/*
 * debug qfq options
 */
void debug_tca_options_qfq(int lev, struct rtattr *tca, const char *name)
{
    struct rtattr *qfq[__TCA_QFQ_MAX];

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len));
    parse_nested_rtattr(qfq, TCA_QFQ_MAX, tca);

    if(qfq[TCA_QFQ_WEIGHT])
        debug_rta_u32(lev+1, qfq[TCA_QFQ_WEIGHT],
                      "TCA_QFQ_WEIGHT", NULL);

    if(qfq[TCA_QFQ_LMAX])
        debug_rta_u32(lev+1, qfq[TCA_QFQ_LMAX],
                      "TCA_QFQ_LMAX", NULL);
}
Esempio n. 4
0
/*
 * debug netem options
 */
void debug_tca_options_netem(int lev, struct rtattr *tca, const char *name)
{
    struct rtattr *netem[__TCA_NETEM_MAX];
    struct tc_netem_qopt *qopt;

    if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt)))
        return;

    qopt = (struct tc_netem_qopt *)RTA_DATA(tca);

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len));
    rec_dbg(lev, "    [ tc_netem_qopt(%d) ]", sizeof(*qopt));
    rec_dbg(lev, "        latency(%d): %u", sizeof(qopt->latency), qopt->latency);
    rec_dbg(lev, "        limit(%d): %u", sizeof(qopt->limit), qopt->limit);
    rec_dbg(lev, "        loss(%d): %u", sizeof(qopt->loss), qopt->loss);
    rec_dbg(lev, "        gap(%d): %u", sizeof(qopt->gap), qopt->gap);
    rec_dbg(lev, "        duplicate(%d): %u", sizeof(qopt->duplicate), qopt->duplicate);
    rec_dbg(lev, "        jitter(%d): %u", sizeof(qopt->jitter), qopt->jitter);

    parse_rtattr(netem, TCA_NETEM_MAX,
        RTA_DATA(tca) + sizeof(struct tc_netem_qopt),
        RTA_PAYLOAD(tca) - sizeof(struct tc_netem_qopt));

    if(netem[TCA_NETEM_CORR])
        debug_tca_netem_corr(lev+1, netem[TCA_NETEM_CORR],
            "TCA_NETEM_CORR");

    if(netem[TCA_NETEM_DELAY_DIST])
        debug_rta_ignore(lev+1, netem[TCA_NETEM_DELAY_DIST],
            "TCA_NETEM_DELAY_DIST");

    if(netem[TCA_NETEM_REORDER])
        debug_tca_netem_reorder(lev+1, netem[TCA_NETEM_REORDER],
            "TCA_NETEM_REORDER");

    if(netem[TCA_NETEM_CORRUPT])
        debug_tca_netem_corrupt(lev+1, netem[TCA_NETEM_CORRUPT],
            "TCA_NETEM_CORRUPT");

#if HAVE_DECL_TCA_NETEM_LOSS
    if(netem[TCA_NETEM_LOSS])
        debug_tca_netem_loss(lev+1, netem[TCA_NETEM_LOSS],
            "TCA_NETEM_LOSS");
#endif

#if HAVE_DECL_TCA_NETEM_RATE
    if(netem[TCA_NETEM_RATE])
        debug_tca_netem_rate(lev+1, netem[TCA_NETEM_RATE],
            "TCA_NETEM_RATE");
#endif

#if HAVE_DECL_TCA_NETEM_ECN
    if(netem[TCA_NETEM_ECN])
        debug_rta_u32(lev+1, netem[TCA_NETEM_ECN],
            "TCA_NETEM_ECN", NULL);
#endif
}
Esempio n. 5
0
/*
 * debug attributes IFLA_BRPORT_*
 */
void debug_ifla_brport(int lev, struct rtattr *ifla)
{
    struct rtattr *brp[__IFLA_BRPORT_MAX];

	parse_nested_rtattr(brp, IFLA_BRPORT_MAX, ifla);

    if(brp[IFLA_BRPORT_STATE])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_STATE],
            "IFLA_BRPORT_STATE", conv_br_state);

    if(brp[IFLA_BRPORT_PRIORITY])
        debug_rta_u16(lev+1, brp[IFLA_BRPORT_PRIORITY],
            "IFLA_BRPORT_PRIORITY", NULL);

    if(brp[IFLA_BRPORT_COST])
        debug_rta_u32(lev+1, brp[IFLA_BRPORT_COST],
            "IFLA_BRPORT_COST", NULL);

    if(brp[IFLA_BRPORT_MODE])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_MODE],
            "IFLA_BRPORT_MODE", NULL);

    if(brp[IFLA_BRPORT_GUARD])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_GUARD],
            "IFLA_BRPORT_GUARD", NULL);

    if(brp[IFLA_BRPORT_PROTECT])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_PROTECT],
            "IFLA_BRPORT_PROTECT", NULL);

    if(brp[IFLA_BRPORT_FAST_LEAVE])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_FAST_LEAVE],
            "IFLA_BRPORT_FAST_LEAVE", NULL);

#if HAVE_DECL_IFLA_BRPORT_LEARNING
    if(brp[IFLA_BRPORT_LEARNING])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_LEARNING],
            "IFLA_BRPORT_LEARNING", NULL);

    if(brp[IFLA_BRPORT_UNICAST_FLOOD])
        debug_rta_u8(lev+1, brp[IFLA_BRPORT_UNICAST_FLOOD],
            "IFLA_BRPORT_UNICAST_FLOOD", NULL);
#endif

    return;
}
Esempio n. 6
0
/*
 * debug red options
 */
void debug_tca_options_red(int lev, struct rtattr *tca, const char *name)
{
    struct rtattr *red[__TCA_RED_MAX];

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len));
    parse_nested_rtattr(red, TCA_RED_MAX, tca);

    if(red[TCA_RED_PARMS])
        debug_tca_red_parms(lev+1, red[TCA_RED_PARMS],
            "TCA_RED_PARMS");

    if(red[TCA_RED_STAB])
        debug_rta_ignore(lev+1, red[TCA_RED_STAB],
            "TCA_RED_STAB");

#if HAVE_DECL_TCA_RED_MAX_P
    if(red[TCA_RED_MAX_P])
        debug_rta_u32(lev+1, red[TCA_RED_MAX_P],
            "TCA_RED_MAX_P", NULL);
#endif
}
Esempio n. 7
0
/*
 * debug choke options
 */
void debug_tca_options_choke(int lev, struct rtattr *tca, const char *name)
{
    struct rtattr *choke[__TCA_CHOKE_MAX];

    rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len));
    parse_nested_rtattr(choke, TCA_CHOKE_MAX, tca);

    if(choke[TCA_CHOKE_PARMS])
        debug_tca_choke_parms(lev+1, choke[TCA_CHOKE_PARMS],
            "TCA_CHOKE_PARMS");

    if(choke[TCA_CHOKE_STAB])
        debug_rta_ignore(lev+1, choke[TCA_CHOKE_STAB],
            "TCA_CHOKE_STAB");

#if HAVE_DECL_TCA_GRED_MAX_P
    if(choke[TCA_CHOKE_MAX_P])
        debug_rta_u32(lev+1, choke[TCA_CHOKE_MAX_P],
            "TCA_CHOKE_MAX_P", NULL);
#endif
}
Esempio n. 8
0
File: rtmsg.c Progetto: t2mune/nield
/*
 * debug route message
 */
void debug_rtmsg(int lev, struct rtmsg *rtm, struct rtattr *rta[], int rtm_len)
{
    /* debug rtmsg */
    char flags_list[MAX_STR_SIZE] = "";

    conv_rtm_flags(rtm->rtm_flags, flags_list, sizeof(flags_list));

    rec_dbg(lev, "*********************************************************************");
    rec_dbg(lev, "[ rtmsg(%d) ]",
        NLMSG_ALIGN(sizeof(struct rtmsg)));
    rec_dbg(lev, "    rtm_family(%d): %d(%s)",
        sizeof(rtm->rtm_family), rtm->rtm_family,
        conv_af_type(rtm->rtm_family, 1));
    rec_dbg(lev, "    rtm_dst_len(%d): %d",
        sizeof(rtm->rtm_dst_len), rtm->rtm_dst_len);
    rec_dbg(lev, "    rtm_src_len(%d): %d",
        sizeof(rtm->rtm_src_len), rtm->rtm_src_len);
    rec_dbg(lev, "    rtm_tos(%d): %d",
        sizeof(rtm->rtm_tos), rtm->rtm_tos);
    rec_dbg(lev, "    rtm_table(%d): %d(%s)",
        sizeof(rtm->rtm_table), rtm->rtm_table,
        conv_rt_table(rtm->rtm_table, 1));
    rec_dbg(lev, "    rtm_protocol(%d): %d(%s)",
        sizeof(rtm->rtm_protocol), rtm->rtm_protocol,
        conv_rtprot(rtm->rtm_protocol, 1));
    rec_dbg(lev, "    rtm_scope(%d): %d(%s)",
        sizeof(rtm->rtm_scope), rtm->rtm_scope,
        conv_rt_scope(rtm->rtm_scope));
    rec_dbg(lev, "    rtm_type(%d): %d(%s)",
        sizeof(rtm->rtm_type), rtm->rtm_type,
        conv_rtn_type(rtm->rtm_type, 1));
    rec_dbg(lev, "    rtm_flags(%d): %d(%s)",
        sizeof(rtm->rtm_flags), rtm->rtm_flags, flags_list);

    /* debug route attributes */
    rec_dbg(lev, "*********************************************************************");
    rec_dbg(lev, "[ rtmsg attributes(%d) ]",
        NLMSG_ALIGN(rtm_len - NLMSG_ALIGN(sizeof(struct rtmsg))));

    if(rta[RTA_DST])
        debug_rta_af(lev+1, rta[RTA_DST],
            "RTA_DST", rtm->rtm_family);

    if(rta[RTA_SRC])
        debug_rta_af(lev+1, rta[RTA_SRC],
            "RTA_SRC", rtm->rtm_family);

    if(rta[RTA_IIF])
        debug_rta_ifindex(lev+1, rta[RTA_IIF],
            "RTA_IIF");

    if(rta[RTA_OIF])
        debug_rta_ifindex(lev+1, rta[RTA_OIF],
            "RTA_OIF");

    if(rta[RTA_GATEWAY])
        debug_rta_af(lev+1, rta[RTA_GATEWAY],
            "RTA_GATEWAY", rtm->rtm_family);

    if(rta[RTA_PRIORITY])
        debug_rta_s32(lev+1, rta[RTA_PRIORITY],
            "RTA_PRIORITY", NULL);

    if(rta[RTA_PREFSRC])
        debug_rta_af(lev+1, rta[RTA_PREFSRC],
            "RTA_PREFSRC", rtm->rtm_family);

    if(rta[RTA_METRICS])
        debug_rta_metrics(lev+1, rta[RTA_METRICS],
            "RTA_METRICS");

    if(rta[RTA_MULTIPATH])
        debug_rta_multipath(lev+1, rtm, rta[RTA_MULTIPATH],
            "RTA_MULTIPATH");

    if(rta[RTA_FLOW])
        debug_rta_u32(lev+1, rta[RTA_FLOW],
            "RTA_FLOW", NULL);

    if(rta[RTA_CACHEINFO])
        debug_rta_cacheinfo(lev+1, rta[RTA_CACHEINFO],
            "RTA_CACHEINFO");

    if(rta[RTA_TABLE])
        debug_rta_s32(lev+1, rta[RTA_TABLE],
            "RTA_TABLE", conv_rt_table);

#if HAVE_DECL_RTA_MARK
    if(rta[RTA_MARK])
        debug_rta_u32(lev+1, rta[RTA_MARK],
            "RTA_MARK", NULL);
#endif

    rec_dbg(lev, "");

    return;
}