2 * Copyright (c) 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgment:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * $FreeBSD: src/sbin/routed/trace.c,v 1.5.2.1 2002/11/07 17:19:13 imp Exp $
38 #include "pathnames.h"
40 #include <sys/signal.h>
43 #if !defined(sgi) && !defined(__NetBSD__)
44 static char sccsid[] __attribute__((unused)) = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
45 #elif defined(__NetBSD__)
51 /* use *stat64 for files on large filesystems */
55 #define NRECORDS 50 /* size of circular trace buffer */
57 int tracelevel, new_tracelevel;
58 FILE *ftrace; /* output trace file */
59 static const char *sigtrace_pat = "%s";
60 static char savetracename[MAXPATHLEN+1];
61 char inittracename[MAXPATHLEN+1];
62 int file_trace; /* 1=tracing to file, not stdout */
64 static void trace_dump(void);
65 static void tmsg(const char *, ...) PATTRIB(1,2);
68 /* convert string to printable characters
71 qstring(u_char *s, int len)
73 static char buf[8*20+1];
78 for (p = buf; len != 0 && p < &buf[sizeof(buf)-1]; len--) {
81 for (s2 = s+1; s2 < &s[len]; s2++) {
89 if (c >= ' ' && c < 0x7f && c != '\\') {
111 p += sprintf(p,"%o",c);
121 /* convert IP address to a string, but not into a single buffer
129 char str[16]; /* xxx.xxx.xxx.xxx\0 */
135 s = strcpy(bufs[bufno].str, inet_ntoa(addr));
136 bufno = (bufno+1) % NUM_BUFS;
143 saddr_ntoa(struct sockaddr *sa)
145 return (sa == NULL) ? "?" : naddr_ntoa(S_ADDR(sa));
153 secs += epoch.tv_sec;
155 cftime(s, "%T", &secs);
157 memcpy(s, ctime(&secs)+11, 8);
164 /* On each event, display a time stamp.
165 * This assumes that 'now' is update once for each event, and
166 * that at least now.tv_usec changes.
168 static struct timeval lastlog_time;
173 if (lastlog_time.tv_sec != now.tv_sec
174 || lastlog_time.tv_usec != now.tv_usec) {
175 fprintf(ftrace, "-- %s --\n", ts(now.tv_sec));
182 tmsg(const char *p, ...)
186 if (ftrace != NULL) {
189 vfprintf(ftrace, p, args);
197 trace_close(int zap_stdio)
205 if (ftrace != NULL && zap_stdio) {
206 if (ftrace != stdout)
209 fd = open(_PATH_DEVNULL, O_RDWR);
210 if (isatty(STDIN_FILENO))
211 dup2(fd, STDIN_FILENO);
212 if (isatty(STDOUT_FILENO))
213 dup2(fd, STDOUT_FILENO);
214 if (isatty(STDERR_FILENO))
215 dup2(fd, STDERR_FILENO);
218 lastlog_time.tv_sec = 0;
225 if (ftrace != NULL) {
228 trace_off("tracing off: %s", strerror(ferror(ftrace)));
234 trace_off(const char *p, ...)
239 if (ftrace != NULL) {
242 vfprintf(ftrace, p, args);
245 trace_close(file_trace);
247 new_tracelevel = tracelevel = 0;
251 /* log a change in tracing
254 tracelevel_msg(const char *pat,
255 int dump) /* -1=no dump, 0=default, 1=force */
257 static const char *off_msgs[MAX_TRACELEVEL] = {
258 "Tracing actions stopped",
259 "Tracing packets stopped",
260 "Tracing packet contents stopped",
261 "Tracing kernel changes stopped",
263 static const char *on_msgs[MAX_TRACELEVEL] = {
264 "Tracing actions started",
265 "Tracing packets started",
266 "Tracing packet contents started",
267 "Tracing kernel changes started",
269 u_int old_tracelevel = tracelevel;
272 if (new_tracelevel < 0)
274 else if (new_tracelevel > MAX_TRACELEVEL)
275 new_tracelevel = MAX_TRACELEVEL;
277 if (new_tracelevel < tracelevel) {
278 if (new_tracelevel <= 0) {
279 trace_off(pat, off_msgs[0]);
281 tmsg(pat, off_msgs[tracelevel]);
283 while (--tracelevel != new_tracelevel);
285 } else if (new_tracelevel > tracelevel) {
287 tmsg(pat, on_msgs[tracelevel++]);
288 } while (tracelevel != new_tracelevel);
292 || (dump == 0 && old_tracelevel == 0 && tracelevel != 0))
298 set_tracefile(const char *filename,
300 int dump) /* -1=no dump, 0=default, 1=force */
307 /* Allow a null filename to increase the level if the trace file
308 * is already open or if coming from a trusted source, such as
309 * a signal or the command line.
311 if (filename == NULL || filename[0] == '\0') {
313 if (ftrace == NULL) {
314 if (inittracename[0] == '\0') {
315 msglog("missing trace file name");
323 } else if (!strcmp(filename,"dump/../table")) {
328 /* Allow the file specified with "-T file" to be reopened,
329 * but require all other names specified over the net to
330 * match the official path. The path can specify a directory
331 * in which the file is to be created.
333 if (strcmp(filename, inittracename)
335 && (strncmp(filename, _PATH_TRACE, sizeof(_PATH_TRACE)-1)
336 || strstr(filename,"../")
337 || 0 > stat(_PATH_TRACE, &stbuf))
340 msglog("wrong trace file \"%s\"", filename);
344 /* If the new tracefile exists, it must be a regular file.
346 if (stat(filename, &stbuf) >= 0 && !S_ISREG(stbuf.st_mode)) {
347 msglog("wrong type (%#x) of trace file \"%s\"",
348 stbuf.st_mode, filename);
356 n_ftrace = fopen(fn, "a");
357 if (n_ftrace == NULL) {
358 msglog("failed to open trace file \"%s\" %s",
359 fn, strerror(errno));
360 if (fn == inittracename)
361 inittracename[0] = '\0';
365 tmsg("switch to trace file %s", fn);
367 trace_close(file_trace = 1);
369 if (fn != savetracename)
370 strncpy(savetracename, fn, sizeof(savetracename)-1);
375 dup2(fileno(ftrace), STDOUT_FILENO);
376 dup2(fileno(ftrace), STDERR_FILENO);
379 if (new_tracelevel == 0 || filename == NULL)
381 tracelevel_msg(pat, dump != 0 ? dump : (filename != NULL));
387 sigtrace_on(int s UNUSED)
390 sigtrace_pat = "SIGUSR1: %s";
396 sigtrace_off(int s UNUSED)
399 sigtrace_pat = "SIGUSR2: %s";
403 /* Set tracing after a signal.
408 if (new_tracelevel == tracelevel)
411 /* If tracing entirely off, and there was no tracefile specified
412 * on the command line, then leave it off.
414 if (new_tracelevel > tracelevel && ftrace == NULL) {
415 if (savetracename[0] != '\0') {
416 set_tracefile(savetracename,sigtrace_pat,0);
417 } else if (inittracename[0] != '\0') {
418 set_tracefile(inittracename,sigtrace_pat,0);
424 tracelevel_msg(sigtrace_pat, 0);
429 /* display an address
432 addrname(naddr addr, /* in network byte order */
434 int force) /* 0=show mask if nonstandard, */
435 { /* 1=always show mask, 2=never */
445 s = strcpy(bufs[bufno].str, naddr_ntoa(addr));
446 bufno = (bufno+1) % NUM_BUFS;
448 if (force == 1 || (force == 0 && mask != std_mask(addr))) {
451 dmask = mask & -mask;
452 if (mask + dmask == 0) {
453 for (i = 0; i != 32 && ((1<<i) & mask) == 0; i++)
455 sprintf(sp, "/%d", 32-i);
458 sprintf(sp, " (mask %#x)", (u_int)mask);
467 /* display a bit-field
472 const char *bits_name;
475 static struct bits if_bits[] = {
476 { IFF_LOOPBACK, 0, "LOOPBACK" },
477 { IFF_POINTOPOINT, 0, "PT-TO-PT" },
481 static struct bits is_bits[] = {
482 { IS_ALIAS, 0, "ALIAS" },
483 { IS_SUBNET, 0, "" },
484 { IS_REMOTE, (IS_NO_RDISC
485 | IS_BCAST_RDISC), "REMOTE" },
486 { IS_PASSIVE, (IS_NO_RDISC
490 | IS_NO_AG), "PASSIVE" },
491 { IS_EXTERNAL, 0, "EXTERNAL" },
492 { IS_CHECKED, 0, "" },
493 { IS_ALL_HOSTS, 0, "" },
494 { IS_ALL_ROUTERS, 0, "" },
495 { IS_DISTRUST, 0, "DISTRUST" },
496 { IS_BROKE, IS_SICK, "BROKEN" },
497 { IS_SICK, 0, "SICK" },
498 { IS_DUP, 0, "DUPLICATE" },
499 { IS_REDIRECT_OK, 0, "REDIRECT_OK" },
500 { IS_NEED_NET_SYN, 0, "" },
501 { IS_NO_AG, IS_NO_SUPER_AG, "NO_AG" },
502 { IS_NO_SUPER_AG, 0, "NO_SUPER_AG" },
506 | IS_NO_RIPV2_OUT), 0, "NO_RIP" },
508 | IS_NO_RIPV1_OUT), 0, "RIPV2" },
509 { IS_NO_RIPV1_IN, 0, "NO_RIPV1_IN" },
510 { IS_NO_RIPV2_IN, 0, "NO_RIPV2_IN" },
511 { IS_NO_RIPV1_OUT, 0, "NO_RIPV1_OUT" },
512 { IS_NO_RIPV2_OUT, 0, "NO_RIPV2_OUT" },
515 | IS_NO_ADV_OUT), IS_BCAST_RDISC, "NO_RDISC" },
516 { IS_NO_SOL_OUT, 0, "NO_SOLICIT" },
517 { IS_SOL_OUT, 0, "SEND_SOLICIT" },
518 { IS_NO_ADV_OUT, IS_BCAST_RDISC, "NO_RDISC_ADV" },
519 { IS_ADV_OUT, 0, "RDISC_ADV" },
520 { IS_BCAST_RDISC, 0, "BCAST_RDISC" },
521 { IS_PM_RDISC, 0, "" },
525 static struct bits rs_bits[] = {
527 { RS_NET_INT, RS_NET_SYN, "NET_INT" },
528 { RS_NET_SYN, 0, "NET_SYN" },
529 { RS_SUBNET, 0, "" },
530 { RS_LOCAL, 0, "LOCAL" },
531 { RS_MHOME, 0, "MHOME" },
532 { RS_STATIC, 0, "STATIC" },
533 { RS_RDISC, 0, "RDISC" },
539 trace_bits(const struct bits *tbl,
554 && (b = tbl->bits_mask) != 0) {
555 if ((b & field) == b) {
556 if (tbl->bits_name[0] != '\0') {
559 fprintf(ftrace, "%s", tbl->bits_name);
562 if (0 == (field &= ~(b | tbl->bits_clear)))
567 if (field != 0 && tbl->bits_name != NULL) {
570 fprintf(ftrace, tbl->bits_name, field);
574 if (c != '<' || force)
584 static char buf[3*4+3+1+2+3 /* "xxx.xxx.xxx.xxx/xx-->" */
585 +3*4+3+1]; /* "xxx.xxx.xxx.xxx" */
588 i = sprintf(buf, "%-16s-->", addrname(dst, mask, 0));
589 sprintf(&buf[i], "%-*s", 15+20-MAX(20,i), naddr_ntoa(gate));
595 print_rts(struct rt_spare *rts,
596 int force_metric, /* -1=suppress, 0=default */
597 int force_ifp, /* -1=suppress, 0=default */
598 int force_router, /* -1=suppress, 0=default, 1=display */
599 int force_tag, /* -1=suppress, 0=default, 1=display */
600 int force_time) /* 0=suppress, 1=display */
605 if (force_metric >= 0)
606 fprintf(ftrace, "metric=%-2d ", rts->rts_metric);
608 fprintf(ftrace, "%s ", (rts->rts_ifp == 0 ?
609 "if?" : rts->rts_ifp->int_name));
611 || (force_router == 0 && rts->rts_router != rts->rts_gate))
612 fprintf(ftrace, "router=%s ", naddr_ntoa(rts->rts_router));
614 fprintf(ftrace, "%s ", ts(rts->rts_time));
616 || (force_tag == 0 && rts->rts_tag != 0))
617 fprintf(ftrace, "tag=%#x ", ntohs(rts->rts_tag));
618 if (rts->rts_de_ag != 0) {
619 for (i = 1; (u_int)(1 << i) <= rts->rts_de_ag; i++)
621 fprintf(ftrace, "de_ag=%d ", i);
628 trace_if(const char *act,
629 struct interface *ifp)
631 if (!TRACEACTIONS || ftrace == NULL)
635 fprintf(ftrace, "%-3s interface %-4s ", act, ifp->int_name);
636 fprintf(ftrace, "%-15s-->%-15s ",
637 naddr_ntoa(ifp->int_addr),
638 addrname(((ifp->int_if_flags & IFF_POINTOPOINT)
639 ? ifp->int_dstaddr : htonl(ifp->int_net)),
641 if (ifp->int_metric != 0)
642 fprintf(ftrace, "metric=%d ", ifp->int_metric);
643 if (!IS_RIP_OUT_OFF(ifp->int_state)
644 && ifp->int_d_metric != 0)
645 fprintf(ftrace, "fake_default=%d ", ifp->int_d_metric);
646 trace_bits(if_bits, ifp->int_if_flags, 0);
647 trace_bits(is_bits, ifp->int_state, 0);
653 trace_upslot(struct rt_entry *rt,
654 struct rt_spare *rts,
655 struct rt_spare *new)
657 if (!TRACEACTIONS || ftrace == NULL)
660 if (rts->rts_gate == new->rts_gate
661 && rts->rts_router == new->rts_router
662 && rts->rts_metric == new->rts_metric
663 && rts->rts_tag == new->rts_tag
664 && rts->rts_de_ag == new->rts_de_ag)
668 if (new->rts_gate == 0) {
669 fprintf(ftrace, "Del #%d %-35s ",
670 (int)(rts - rt->rt_spares),
671 rtname(rt->rt_dst, rt->rt_mask, rts->rts_gate));
672 print_rts(rts, 0,0,0,0,
673 (rts != rt->rt_spares
674 || AGE_RT(rt->rt_state,new->rts_ifp)));
676 } else if (rts->rts_gate != RIP_DEFAULT) {
677 fprintf(ftrace, "Chg #%d %-35s ",
678 (int)(rts - rt->rt_spares),
679 rtname(rt->rt_dst, rt->rt_mask, rts->rts_gate));
681 rts->rts_gate != new->rts_gate,
682 rts->rts_tag != new->rts_tag,
683 rts != rt->rt_spares || AGE_RT(rt->rt_state,
686 fprintf(ftrace, "\n %19s%-16s ", "",
687 (new->rts_gate != rts->rts_gate
688 ? naddr_ntoa(new->rts_gate) : ""));
690 -(new->rts_metric == rts->rts_metric),
691 -(new->rts_ifp == rts->rts_ifp),
693 rts->rts_tag != new->rts_tag,
694 (new->rts_time != rts->rts_time
695 && (rts != rt->rt_spares
696 || AGE_RT(rt->rt_state, new->rts_ifp))));
699 fprintf(ftrace, "Add #%d %-35s ",
700 (int)(rts - rt->rt_spares),
701 rtname(rt->rt_dst, rt->rt_mask, new->rts_gate));
702 print_rts(new, 0,0,0,0,
703 (rts != rt->rt_spares
704 || AGE_RT(rt->rt_state,new->rts_ifp)));
710 /* miscellaneous message checked by the caller
713 trace_misc(const char *p, ...)
722 vfprintf(ftrace, p, args);
727 /* display a message if tracing actions
730 trace_act(const char *p, ...)
734 if (!TRACEACTIONS || ftrace == NULL)
739 vfprintf(ftrace, p, args);
744 /* display a message if tracing packets
747 trace_pkt(const char *p, ...)
751 if (!TRACEPACKETS || ftrace == NULL)
756 vfprintf(ftrace, p, args);
762 trace_change(struct rt_entry *rt,
764 struct rt_spare *new,
770 if (rt->rt_metric == new->rts_metric
771 && rt->rt_gate == new->rts_gate
772 && rt->rt_router == new->rts_router
773 && rt->rt_state == state
774 && rt->rt_tag == new->rts_tag
775 && rt->rt_de_ag == new->rts_de_ag)
779 fprintf(ftrace, "%s %-35s ",
780 label, rtname(rt->rt_dst, rt->rt_mask, rt->rt_gate));
781 print_rts(rt->rt_spares,
782 0,0,0,0, AGE_RT(rt->rt_state, rt->rt_ifp));
783 trace_bits(rs_bits, rt->rt_state, rt->rt_state != state);
785 fprintf(ftrace, "\n%*s %19s%-16s ",
786 (int)strlen(label), "", "",
787 (rt->rt_gate != new->rts_gate
788 ? naddr_ntoa(new->rts_gate) : ""));
790 -(new->rts_metric == rt->rt_metric),
791 -(new->rts_ifp == rt->rt_ifp),
793 rt->rt_tag != new->rts_tag,
794 (rt->rt_time != new->rts_time
795 && AGE_RT(rt->rt_state,new->rts_ifp)));
796 if (rt->rt_state != state)
797 trace_bits(rs_bits, state, 1);
803 trace_add_del(const char * action, struct rt_entry *rt)
809 fprintf(ftrace, "%s %-35s ",
810 action, rtname(rt->rt_dst, rt->rt_mask, rt->rt_gate));
811 print_rts(rt->rt_spares, 0,0,0,0,AGE_RT(rt->rt_state,rt->rt_ifp));
812 trace_bits(rs_bits, rt->rt_state, 0);
819 walk_trace(struct radix_node *rn,
820 struct walkarg *w UNUSED)
822 #define RT ((struct rt_entry *)rn)
823 struct rt_spare *rts;
826 fprintf(ftrace, " %-35s ",
827 rtname(RT->rt_dst, RT->rt_mask, RT->rt_gate));
828 print_rts(&RT->rt_spares[0], 0,0,0,0, AGE_RT(RT->rt_state, RT->rt_ifp));
829 trace_bits(rs_bits, RT->rt_state, 0);
830 if (RT->rt_poison_time >= now_garbage
831 && RT->rt_poison_metric < RT->rt_metric)
832 fprintf(ftrace, "pm=%d@%s",
833 RT->rt_poison_metric, ts(RT->rt_poison_time));
835 rts = &RT->rt_spares[1];
836 for (i = 1; i < NUM_SPARES; i++, rts++) {
837 if (rts->rts_gate != RIP_DEFAULT) {
838 fprintf(ftrace,"\n #%d%15s%-16s ",
839 i, "", naddr_ntoa(rts->rts_gate));
840 print_rts(rts, 0,0,0,0,1);
852 struct interface *ifp;
858 fputs("current daemon state:\n", ftrace);
859 for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next)
861 rn_walktree(rhead, walk_trace, 0);
866 trace_rip(const char *dir1, const char *dir2,
867 struct sockaddr_in *who,
868 struct interface *ifp,
870 int size) /* total size of message */
872 struct netinfo *n, *lim;
873 # define NA ((struct netauth*)n)
876 if (!TRACEPACKETS || ftrace == NULL)
880 if (msg->rip_cmd >= RIPCMD_MAX
881 || msg->rip_vers == 0) {
882 fprintf(ftrace, "%s bad RIPv%d cmd=%d %s"
884 dir1, msg->rip_vers, msg->rip_cmd, dir2,
885 naddr_ntoa(who->sin_addr.s_addr),
886 ntohs(who->sin_port),
891 fprintf(ftrace, "%s RIPv%d %s %s %s.%d%s%s\n",
892 dir1, msg->rip_vers, ripcmds[msg->rip_cmd], dir2,
893 naddr_ntoa(who->sin_addr.s_addr), ntohs(who->sin_port),
894 ifp ? " via " : "", ifp ? ifp->int_name : "");
899 switch (msg->rip_cmd) {
901 case RIPCMD_RESPONSE:
903 lim = (struct netinfo *)((char*)msg + size);
904 for (; n < lim; n++) {
906 && n->n_family == RIP_AF_UNSPEC
907 && ntohl(n->n_metric) == HOPCNT_INFINITY
908 && msg->rip_cmd == RIPCMD_REQUEST
911 && (n+1)->n_family == RIP_AF_AUTH))) {
912 fputs("\tQUERY ", ftrace);
914 fprintf(ftrace, "%s ",
915 naddr_ntoa(n->n_dst));
917 fprintf(ftrace, "mask=%#x ",
918 (u_int)ntohl(n->n_mask));
920 fprintf(ftrace, "nhop=%s ",
921 naddr_ntoa(n->n_nhop));
923 fprintf(ftrace, "tag=%#x ",
929 if (n->n_family == RIP_AF_AUTH) {
930 if (NA->a_type == RIP_AUTH_PW
931 && n == msg->rip_nets) {
932 fprintf(ftrace, "\tPassword"
935 qstring(NA->au.au_pw,
940 if (NA->a_type == RIP_AUTH_MD5
941 && n == msg->rip_nets) {
944 " pkt_len=%d KeyID=%u"
948 ntohs(NA->au.a_md5.md5_pkt_len),
949 NA->au.a_md5.md5_keyid,
950 NA->au.a_md5.md5_auth_len,
951 (int)ntohl(NA->au.a_md5.md5_seqno),
952 (int)ntohs(NA->au.a_md5.rsvd[0]),
953 (int)ntohs(NA->au.a_md5.rsvd[1]));
957 "\tAuthentication type %d: ",
960 i < (int)sizeof(NA->au.au_pw);
962 fprintf(ftrace, "%02x ",
969 if (n->n_family != RIP_AF_INET) {
971 "\t(af %d) %-18s mask=%#x ",
973 naddr_ntoa(n->n_dst),
974 (u_int)ntohl(n->n_mask));
975 } else if (msg->rip_vers == RIPv1) {
976 fprintf(ftrace, "\t%-18s ",
977 addrname(n->n_dst, ntohl(n->n_mask),
978 n->n_mask==0 ? 2 : 1));
980 fprintf(ftrace, "\t%-18s ",
981 addrname(n->n_dst, ntohl(n->n_mask),
982 n->n_mask==0 ? 2 : 0));
984 fprintf(ftrace, "metric=%-2d ",
985 (u_int)ntohl(n->n_metric));
987 fprintf(ftrace, " nhop=%s ",
988 naddr_ntoa(n->n_nhop));
990 fprintf(ftrace, "tag=%#x", ntohs(n->n_tag));
993 if (size != (char *)n - (char *)msg)
994 fprintf(ftrace, "truncated record, len %d\n", size);
998 fprintf(ftrace, "\tfile=\"%.*s\"\n", size-4,
1002 case RIPCMD_TRACEOFF: