Exemplo n.º 1
0
static int result_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
{
	struct flnl_result *res = (struct flnl_result *) obj;
	char buf[128];
	int line = 1;

	dp_dump(p, "table %s prefixlen %u next-hop-selector %u\n",
		rtnl_route_table2str(res->fr_table_id, buf, sizeof(buf)),
		res->fr_prefixlen, res->fr_nh_sel);
	dp_dump_line(p, line++, "type %s ",
		     nl_rtntype2str(res->fr_type, buf, sizeof(buf)));
	dp_dump(p, "scope %s error %s (%d)\n",
		rtnl_scope2str(res->fr_scope, buf, sizeof(buf)),
		strerror(-res->fr_error), res->fr_error);

	return line;
}
static int vlan_dump_full(struct rtnl_link *link, struct nl_dump_params *p,
			  int line)
{
	struct vlan_info *vi = link->l_info;
	int i, printed;
	char buf[64];

	rtnl_link_vlan_flags2str(vi->vi_flags, buf, sizeof(buf));
	dp_dump_line(p, line++, "    vlan-info id %d <%s>\n",
		vi->vi_vlan_id, buf);

	if (vi->vi_mask & VLAN_HAS_INGRESS_QOS) {
		dp_dump_line(p, line++,
		"      ingress vlan prio -> qos/socket prio mapping:\n");
		for (i = 0, printed = 0; i <= VLAN_PRIO_MAX; i++) {
			if (vi->vi_ingress_qos[i]) {
				if (printed == 0) {
					dp_new_line(p, line);
					dp_dump(p, "      ");
				}
				dp_dump(p, "%x -> %#08x, ",
					i, vi->vi_ingress_qos[i]);
				if (printed++ == 3) {
					dp_dump(p, "\n");
					printed = 0;
				}
			}
		}

		if (printed > 0 && printed != 4)
			dp_dump(p, "\n");
	}

	if (vi->vi_mask & VLAN_HAS_EGRESS_QOS) {
		dp_dump_line(p, line++,
		"      egress qos/socket prio -> vlan prio mapping:\n");
		for (i = 0, printed = 0; i < vi->vi_negress; i++) {
			if (printed == 0) {
				dp_new_line(p, line);
				dp_dump(p, "      ");
			}
			dp_dump(p, "%#08x -> %x, ",
				vi->vi_egress_qos[i].vm_from,
				vi->vi_egress_qos[i].vm_to);
			if (printed++ == 3) {
				dp_dump(p, "\n");
				printed = 0;
			}
		}

		if (printed > 0 && printed != 4)
			dp_dump(p, "\n");
	}

	return line;
}
static int qdisc_dump_full(struct nl_object *arg, struct nl_dump_params *p)
{
	struct rtnl_qdisc *qdisc = (struct rtnl_qdisc *) arg;
	struct rtnl_qdisc_ops *qops;

	int line = qdisc_dump_brief(arg, p);

	line = tca_dump_full((struct rtnl_tca *) qdisc, p, line);
	dp_dump(p, "refcnt %u ", qdisc->q_info);

	qops = rtnl_qdisc_lookup_ops(qdisc);
	if (qops && qops->qo_dump[NL_DUMP_FULL])
		line = qops->qo_dump[NL_DUMP_FULL](qdisc, p, line);

	dp_dump(p, "\n");
	return line;
}
static int vlan_dump_brief(struct rtnl_link *link, struct nl_dump_params *p,
			   int line)
{
	struct vlan_info *vi = link->l_info;

	dp_dump(p, "vlan-id %d", vi->vi_vlan_id);

	return line;
}
Exemplo n.º 5
0
static int pfifo_dump_brief(struct rtnl_qdisc *qdisc,
			    struct nl_dump_params *p, int line)
{
	struct rtnl_fifo *fifo = fifo_qdisc(qdisc);

	if (fifo)
		dp_dump(p, " limit %u packets", fifo->qf_limit);

	return line;
}
Exemplo n.º 6
0
Arquivo: rule.c Projeto: DINKIN/tuo
static int rule_dump_full(struct nl_object *obj, struct nl_dump_params *p)
{
	struct rtnl_rule *rule = (struct rtnl_rule *) obj;
	char buf[128];
	int line;

	line = rule_dump_brief(obj, p);

	dp_dump_line(p, line++, "  family %s",
		     nl_af2str(rule->r_family, buf, sizeof(buf)));

	if (rule->ce_mask & RULE_ATTR_SRCMAP)
		dp_dump(p, " srcmap %s",
			nl_addr2str(rule->r_srcmap, buf, sizeof(buf)));

	dp_dump(p, "\n");

	return line;
}
static int sfq_dump_full(struct rtnl_qdisc *qdisc, struct nl_dump_params *p,
			 int line)
{
	struct rtnl_sfq *sfq = sfq_qdisc(qdisc);

	if (sfq)
		dp_dump(p, "limit %u divisor %u",
			sfq->qs_limit, sfq->qs_divisor);

	return line;
}
static int sfq_dump_brief(struct rtnl_qdisc *qdisc, struct nl_dump_params *p,
			  int line)
{
	struct rtnl_sfq *sfq = sfq_qdisc(qdisc);

	if (sfq)
		dp_dump(p, " quantum %u perturb %us",
			sfq->qs_quantum,
			nl_ticks2us(sfq->qs_perturb * nl_get_hz()));

	return line;
}
Exemplo n.º 9
0
static int addr_dump_full(struct nl_object *obj, struct nl_dump_params *p)
{
	struct rtnl_addr *addr = (struct rtnl_addr *) obj;
	int line = addr_dump_brief(obj, p);
	char buf[128];

	if (addr->a_mask & (ADDR_ATTR_LABEL | ADDR_ATTR_BROADCAST |
			    ADDR_ATTR_ANYCAST | ADDR_ATTR_MULTICAST)) {
		dp_dump_line(p, line++, "  ");

		if (addr->a_mask & ADDR_ATTR_LABEL)
			dp_dump(p, " label %s", addr->a_label);

		if (addr->a_mask & ADDR_ATTR_BROADCAST)
			dp_dump(p, " broadcast %s",
				nl_addr2str(addr->a_bcast, buf, sizeof(buf)));

		if (addr->a_mask & ADDR_ATTR_ANYCAST)
			dp_dump(p, " anycast %s",
				nl_addr2str(addr->a_anycast, buf,
					      sizeof(buf)));

		if (addr->a_mask & ADDR_ATTR_MULTICAST)
			dp_dump(p, " multicast %s",
				nl_addr2str(addr->a_multicast, buf,
					      sizeof(buf)));

		dp_dump(p, "\n");
	}

	if (addr->a_mask & ADDR_ATTR_CACHEINFO) {
		struct rtnl_addr_cacheinfo *ci = &addr->a_cacheinfo;

		dp_dump_line(p, line++, "   valid-lifetime %s",
			     ci->aci_valid == 0xFFFFFFFFU ? "forever" :
			     nl_msec2str(ci->aci_valid * 1000,
					   buf, sizeof(buf)));

		dp_dump(p, " preferred-lifetime %s\n",
			ci->aci_prefered == 0xFFFFFFFFU ? "forever" :
			nl_msec2str(ci->aci_prefered * 1000,
				      buf, sizeof(buf)));

		dp_dump_line(p, line++, "   created boot-time+%s ",
			     nl_msec2str(addr->a_cacheinfo.aci_cstamp * 10,
					   buf, sizeof(buf)));
		    
		dp_dump(p, "last-updated boot-time+%s\n",
			nl_msec2str(addr->a_cacheinfo.aci_tstamp * 10,
				      buf, sizeof(buf)));
	}

	return line;
}
Exemplo n.º 10
0
static void dps_dump(struct dce4 *dce)
{
	unsigned i;

	for (i = 0; i < dce->ddev.crtcs_n; ++i) {
		if ((dce->dps_used & BIT(i)) == 0) {
			dev_info(dce->ddev.dev, "dce4: dp%u not used\n", i);
			continue;
		}
		dev_info(dce->ddev.dev, "dce4: dp%u used\n", i);
		dp_dump(dce, i);
	}
}
static int qdisc_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
{
	struct rtnl_qdisc *qdisc = (struct rtnl_qdisc *) obj;
	struct rtnl_qdisc_ops *qops;

	int line = tca_dump_brief((struct rtnl_tca *) qdisc, "qdisc", p, 0);

	qops = rtnl_qdisc_lookup_ops(qdisc);
	if (qops && qops->qo_dump[NL_DUMP_BRIEF])
		line = qops->qo_dump[NL_DUMP_BRIEF](qdisc, p, line);

	dp_dump(p, "\n");

	return line;
}
Exemplo n.º 12
0
static int bfifo_dump_brief(struct rtnl_qdisc *qdisc,
			    struct nl_dump_params *p, int line)
{
	struct rtnl_fifo *fifo = fifo_qdisc(qdisc);

	if (fifo) {
		char *unit;
		double r;

		r = nl_cancel_down_bytes(fifo->qf_limit, &unit);
		dp_dump(p, " limit %.1f%s", r, unit);
	}

	return line;
}
static int qdisc_dump_stats(struct nl_object *arg, struct nl_dump_params *p)
{
	struct rtnl_qdisc *qdisc = (struct rtnl_qdisc *) arg;
	struct rtnl_qdisc_ops *qops;

	int line = qdisc_dump_full(arg, p);
	line = tca_dump_stats((struct rtnl_tca *) qdisc, p, line );
	dp_dump(p, "\n");

	qops = rtnl_qdisc_lookup_ops(qdisc);
	if (qops && qops->qo_dump[NL_DUMP_STATS])
		line = qops->qo_dump[NL_DUMP_STATS](qdisc, p, line);

	return line;
}
Exemplo n.º 14
0
static int addr_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
{
	struct rtnl_addr *addr = (struct rtnl_addr *) obj;
	struct nl_cache *link_cache;
	char buf[128];

	link_cache = nl_cache_mngt_require("route/link");

	if (addr->a_mask & ADDR_ATTR_LOCAL)
		dp_dump(p, "%s",
			nl_addr2str(addr->a_local, buf, sizeof(buf)));
	else
		dp_dump(p, "none");

	if (addr->a_mask & ADDR_ATTR_PEER)
		dp_dump(p, " peer %s",
			nl_addr2str(addr->a_peer, buf, sizeof(buf)));

	dp_dump(p, " %s ", nl_af2str(addr->a_family, buf, sizeof(buf)));

	if (link_cache)
		dp_dump(p, "dev %s ",
			rtnl_link_i2name(link_cache, addr->a_ifindex,
					 buf, sizeof(buf)));
	else
		dp_dump(p, "dev %d ", addr->a_ifindex);

	dp_dump(p, "scope %s",
		rtnl_scope2str(addr->a_scope, buf, sizeof(buf)));

	rtnl_addr_flags2str(addr->a_flags, buf, sizeof(buf));
	if (buf[0])
		dp_dump(p, " <%s>", buf);

	dp_dump(p, "\n");

	return 1;
}
Exemplo n.º 15
0
static int tbf_dump_brief(struct rtnl_qdisc *qdisc, struct nl_dump_params *p,
                          int line)
{
    double r, rbit, lim;
    char *ru, *rubit, *limu;
    struct rtnl_tbf *tbf = tbf_qdisc(qdisc);

    if (!tbf)
        goto ignore;

    r = nl_cancel_down_bytes(tbf->qt_rate.rs_rate, &ru);
    rbit = nl_cancel_down_bits(tbf->qt_rate.rs_rate*8, &rubit);
    lim = nl_cancel_down_bytes(tbf->qt_limit, &limu);

    dp_dump(p, " rate %.2f%s/s (%.0f%s) limit %.2f%s",
            r, ru, rbit, rubit, lim, limu);

ignore:
    return line;
}
Exemplo n.º 16
0
static int tbf_dump_full(struct rtnl_qdisc *qdisc, struct nl_dump_params *p,
                         int line)
{
    struct rtnl_tbf *tbf = tbf_qdisc(qdisc);

    if (!tbf)
        goto ignore;

    if (1) {
        char *bu, *cu;
        double bs = nl_cancel_down_bytes(tbf->qt_rate_bucket, &bu);
        double cl = nl_cancel_down_bytes(1 << tbf->qt_rate.rs_cell_log,
                                         &cu);

        dp_dump(p, "mpu %u rate-bucket-size %1.f%s "
                "rate-cell-size %.1f%s\n",
                tbf->qt_mpu, bs, bu, cl, cu);

    }

    if (tbf->qt_mask & TBF_ATTR_PEAKRATE) {
        char *pru, *prbu, *bsu, *clu;
        double pr, prb, bs, cl;

        pr = nl_cancel_down_bytes(tbf->qt_peakrate.rs_rate, &pru);
        prb = nl_cancel_down_bits(tbf->qt_peakrate.rs_rate * 8, &prbu);
        bs = nl_cancel_down_bits(tbf->qt_peakrate_bucket, &bsu);
        cl = nl_cancel_down_bits(1 << tbf->qt_peakrate.rs_cell_log,
                                 &clu);

        dp_dump_line(p, line++, "    peak-rate %.2f%s/s (%.0f%s) "
                     "bucket-size %.1f%s cell-size %.1f%s",
                     "latency %.1f%s",
                     pr, pru, prb, prbu, bs, bsu, cl, clu);
    }

ignore:
    return line;
}
Exemplo n.º 17
0
Arquivo: rule.c Projeto: DINKIN/tuo
static int rule_dump_brief(struct nl_object *o, struct nl_dump_params *p)
{
	struct rtnl_rule *r = (struct rtnl_rule *) o;
	char buf[128];

	if (r->ce_mask & RULE_ATTR_PRIO)
		dp_dump(p, "%d:\t", r->r_prio);
	else
		dp_dump(p, "0:\t");

	if (r->ce_mask & RULE_ATTR_SRC)
		dp_dump(p, "from %s ",
			nl_addr2str(r->r_src, buf, sizeof(buf)));
	else if (r->ce_mask & RULE_ATTR_SRC_LEN && r->r_src_len)
		dp_dump(p, "from 0/%d ", r->r_src_len);

	if (r->ce_mask & RULE_ATTR_DST)
		dp_dump(p, "to %s ",
			nl_addr2str(r->r_dst, buf, sizeof(buf)));
	else if (r->ce_mask & RULE_ATTR_DST_LEN && r->r_dst_len)
		dp_dump(p, "to 0/%d ", r->r_dst_len);

	if (r->ce_mask & RULE_ATTR_DSFIELD && r->r_dsfield)
		dp_dump(p, "tos %d ", r->r_dsfield);

	if (r->ce_mask & RULE_ATTR_MARK)
		dp_dump(p, "mark %" PRIx64 , r->r_mark);

	if (r->ce_mask & RULE_ATTR_IIF)
		dp_dump(p, "iif %s ", r->r_iif);

	if (r->ce_mask & RULE_ATTR_TABLE)
		dp_dump(p, "lookup %s ",
			rtnl_route_table2str(r->r_table, buf, sizeof(buf)));

	if (r->ce_mask & RULE_ATTR_REALMS)
		dp_dump(p, "realms %s ",
			rtnl_realms2str(r->r_realms, buf, sizeof(buf)));

	dp_dump(p, "action %s\n",
		nl_rtntype2str(r->r_type, buf, sizeof(buf)));

	return 1;
}