Ejemplo n.º 1
0
void
trace_if(const char *act,
	 struct interface *ifp)
{
	if (!TRACEACTIONS || ftrace == 0)
		return;

	lastlog();
	(void)fprintf(ftrace, "%-3s interface %-4s ", act, ifp->int_name);
	(void)fprintf(ftrace, "%-15s-->%-15s ",
		      naddr_ntoa(ifp->int_addr),
		      addrname(((ifp->int_if_flags & IFF_POINTOPOINT)
				? ifp->int_dstaddr
				: htonl(ifp->int_net)),
			       ifp->int_mask, 1));
	if (ifp->int_metric != 0)
		(void)fprintf(ftrace, "metric=%d ", ifp->int_metric);
	if (ifp->int_adj_inmetric != 0)
		(void)fprintf(ftrace, "adj_inmetric=%u ",
			      ifp->int_adj_inmetric);
	if (ifp->int_adj_outmetric != 0)
		(void)fprintf(ftrace, "adj_outmetric=%u ",
			      ifp->int_adj_outmetric);
	if (!IS_RIP_OUT_OFF(ifp->int_state)
	    && ifp->int_d_metric != 0)
		(void)fprintf(ftrace, "fake_default=%u ", ifp->int_d_metric);
	trace_bits(if_bits, ifp->int_if_flags, 0);
	trace_bits(is_bits, ifp->int_state, 0);
	(void)fputc('\n',ftrace);
}
Ejemplo n.º 2
0
static void
tmsg(const char *p, ...)
{
	va_list args;

	if (ftrace != NULL) {
		lastlog();
		va_start(args, p);
		vfprintf(ftrace, p, args);
		fputc('\n',ftrace);
		fflush(ftrace);
	}
}
Ejemplo n.º 3
0
void
trace_dr(const struct dr *drp)
{
	if (ftrace == NULL)
		return;

	lastlog();
	(void) fprintf(ftrace, "  %-4s %-15s %s ",
	    drp->dr_ifp != NULL ? drp->dr_ifp->int_name : "?",
	    naddr_ntoa(drp->dr_gate), ts(drp->dr_ts));
	(void) fprintf(ftrace, "%s %d %u\n", ts(drp->dr_life),
	    SIGN_PREF(drp->dr_recv_pref), drp->dr_pref);
}
Ejemplo n.º 4
0
void
trace_off(const char *p, ...)
{
	va_list args;


	if (ftrace != NULL) {
		lastlog();
		va_start(args, p);
		vfprintf(ftrace, p, args);
		fputc('\n',ftrace);
	}
	trace_close(file_trace);

	new_tracelevel = tracelevel = 0;
}
Ejemplo n.º 5
0
void
trace_khash(const struct khash *krt)
{
	if (ftrace == NULL)
		return;

	lastlog();
	(void) fprintf(ftrace, "  %-15s-->%-15s metric=%d ",
	    addrname(krt->k_dst, krt->k_mask, 0),
	    naddr_ntoa(krt->k_gate), krt->k_metric);
	if (krt->k_ifp != NULL)
		(void) fprintf(ftrace, "ifp %s ", krt->k_ifp->int_name);
	else
		(void) fprintf(ftrace, "ifp NULL ");
	(void) fprintf(ftrace, "%s ", ts(krt->k_keep));
	(void) fprintf(ftrace, "%s ", ts(krt->k_redirect_time));
	trace_bits(ks_bits, krt->k_state, _B_TRUE);
	(void) fputc('\n', ftrace);
}