File netkit-routed-0.17.patch of Package routed
--- Makefile
+++ Makefile 2001/02/13 15:12:52
@@ -1,7 +1,7 @@
# You can do "make SUB=blah" to make only a few, or edit here, or both
# You can also run make directly in the subdirs you want.
-SUB = routed ripquery
+SUB = routed ripquery routed-trace
%.build:
(cd $(patsubst %.build, %, $@) && $(MAKE))
--- configure
+++ configure 2001/02/13 15:12:52
@@ -54,7 +54,7 @@
fi
SBINDIR="$EXECPREFIX/sbin"
-MANDIR="$PREFIX/man"
+MANDIR="$PREFIX/share/man"
echo "Directories: $SBINDIR $MANDIR "
--- routed-trace/Makefile
+++ routed-trace/Makefile 2001/02/13 15:12:52
@@ -0,0 +1,17 @@
+all: routed-trace
+
+include ../MCONFIG
+include ../MRULES
+
+OBJS= trace.o
+
+routed-trace: $(OBJS)
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+install: routed-trace
+ install -o root -g root -m $(BINMODE) routed-trace $(INSTALLROOT)$(SBINDIR)
+ install -o root -g root -m $(MANMODE) routed-trace.8 $(INSTALLROOT)$(MANDIR)/man8
+
+clean:
+ rm -f $(OBJS) routed-trace
+
--- routed-trace/routed-trace.8
+++ routed-trace/routed-trace.8 2001/02/13 15:12:52
@@ -0,0 +1,44 @@
+.Dd August 26, 1998
+.Dt ROUTED-TRACE 8
+.Sh NAME
+.Nm routed-trace
+.Nd utility to switch trace logging on/off on routed
+running on remote machine
+.Sh SYNOPSIS
+.Nm routed-trace
+<on </path/to/tracefile>|off> <host1> [host2] [host3] ..
+.Sh DESCRIPTION
+.Nm Routed-trace
+is used to switch on/off trace logging on remote machine(s) running
+.Nm routed
+process. It sends UDP packet to remote
+.Nm routed
+process, running on host(s) given as argument(s), with
+RIPCMD_TRACEON or RIPCMD_TRACEOFF commands, depending on
+arguments described below.
+.Pp
+As first argument, it takes either "on </path/to/tracefile>" or "off".
+In the case of "on", remote
+.Nm routed
+process will start trace logging to "</path/to/tracefile>". If "off"
+is given, and
+.Nm routed
+has started logging previously, it will be stopped.
+Otherwise, no action will be done.
+.Pp
+Use of this tool will only have effect if the
+.Nm routed
+process running on remote machine runs with the
+.Fl r
+flag.
+.Pp
+Use of this tool is generally discouraged as its use can lead to unwanted
+compromise of the remote system.
+.Sh SEE ALSO
+.Xr routed 8 ,
+.Xr routed-query 8
+.Rs
+.%T Internet Transport Protocols
+.%R XSIS 028112
+.%Q Xerox System Integration Standard
+.Re
--- routed-trace/trace.c
+++ routed-trace/trace.c 2001/02/13 15:12:52
@@ -0,0 +1,133 @@
+/* $NetBSD: trace.c,v 1.8 1995/05/21 14:22:27 mycroft Exp $ */
+
+/*-
+ * Copyright (c) 1983, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1983, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
+#else
+char rcsid[] = "$NetBSD: trace.c,v 1.8 1995/05/21 14:22:27 mycroft Exp $";
+#endif
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <protocols/routed.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct sockaddr_in myaddr;
+char packet[MAXPACKETSIZE];
+
+int main(int argc, char **argv)
+{
+ int size, s;
+ struct sockaddr_in router;
+ register struct rip *msg = (struct rip *)packet;
+ struct hostent *hp;
+ struct servent *sp;
+
+ if (argc < 3) {
+usage:
+ printf("usage: routed-trace <cmd> <targethost1> [targethost2] ..\n");
+ printf("cmd is either \"on /path_to_tracefile\", or \"off\"\n");
+ exit(1);
+ }
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ perror("socket");
+ exit(2);
+ }
+ myaddr.sin_family = AF_INET;
+ myaddr.sin_port = htons(IPPORT_RESERVED-1);
+ if (bind(s, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
+ perror("bind");
+ exit(2);
+ }
+
+ argv++, argc--;
+ msg->rip_cmd = strcmp(*argv, "on") == 0 ?
+ RIPCMD_TRACEON : RIPCMD_TRACEOFF;
+ if (msg->rip_cmd == RIPCMD_TRACEOFF && strcmp(*argv, "off") != 0)
+ goto usage;
+ if (msg->rip_cmd == RIPCMD_TRACEON && argc == 2)
+ goto usage;
+ msg->rip_vers = RIPVERSION;
+ printf("routed-trace: sending command \"%s", *argv);
+ argv++, argc--;
+ size = sizeof (int);
+ if (msg->rip_cmd == RIPCMD_TRACEON) {
+ strcpy(msg->rip_tracefile, *argv);
+ size += strlen(*argv);
+ printf(" %s", *argv);
+ argv++, argc--;
+ }
+ printf("\"\n");
+ memset(&router, 0, sizeof (router));
+ router.sin_family = AF_INET;
+ sp = getservbyname("router", "udp");
+ if (sp == 0) {
+ printf("udp/router: service unknown\n");
+ exit(1);
+ }
+ router.sin_port = sp->s_port;
+ while (argc > 0) {
+ router.sin_family = AF_INET;
+ if (inet_aton(*argv, &router.sin_addr) == 0) {
+ hp = gethostbyname(*argv);
+ if (hp == NULL) {
+ fprintf(stderr, "routed-trace: %s: ", *argv);
+ herror((char *)NULL);
+ exit(1);
+ }
+ memcpy(&router.sin_addr, hp->h_addr, hp->h_length);
+ }
+ if (sendto(s, packet, size, 0,
+ (struct sockaddr *)&router, sizeof(router)) < 0)
+ perror(*argv);
+ printf("routed-trace: command succesfully sent to %s\n", *argv);
+ argv++, argc--;
+ }
+ exit(0);
+}
--- routed/input.c
+++ routed/input.c 2001/02/13 16:22:16
@@ -43,8 +43,11 @@
* Routing Table Management Daemon
*/
+#define _GNU_SOURCE
+
#include "defs.h"
#include <syslog.h>
+#include <sys/time.h>
struct timeval now; /* current idea of time */
struct timeval lastbcast; /* last time all/changes broadcast */
--- routed/trace.c
+++ routed/trace.c 2001/02/13 15:12:52
@@ -218,6 +218,8 @@
void bumploglevel(void)
{
+ if (!ftrace)
+ ftrace = stdout;
(void) gettimeofday(&now, NULL);
if (traceactions == 0) {