From 7e7571829512b08641effefc9f112dc264a79e78 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Fri, 25 Dec 2020 17:42:11 -0800 Subject: [PATCH] sbin/routed: Remove unused code for sgi and NetBSD. MFC after: 2 weeks --- sbin/routed/defs.h | 41 ----------------------------------------- sbin/routed/if.c | 20 -------------------- sbin/routed/input.c | 7 ------- sbin/routed/main.c | 20 -------------------- sbin/routed/output.c | 7 ------- sbin/routed/parms.c | 7 ------- sbin/routed/pathnames.h | 4 ---- sbin/routed/radix.c | 7 ------- sbin/routed/rdisc.c | 7 ------- sbin/routed/table.c | 7 ------- sbin/routed/trace.c | 15 --------------- 11 files changed, 142 deletions(-) diff --git a/sbin/routed/defs.h b/sbin/routed/defs.h index 5ce7b5be3b16..9b0218163d3b 100644 --- a/sbin/routed/defs.h +++ b/sbin/routed/defs.h @@ -33,9 +33,6 @@ * $FreeBSD$ */ -#ifdef sgi -#ident "$FreeBSD$" -#endif /* Definitions for RIPv2 routing process. * @@ -69,10 +66,6 @@ #include #include #include -#ifdef sgi -#include -#include -#endif #include #include #include @@ -84,14 +77,9 @@ #include #include #include -#ifdef sgi -#define _USER_ROUTE_TREE -#include -#else #include "radix.h" #define UNUSED __attribute__((unused)) #define PATTRIB(f,l) __attribute__((format (printf,f,l))) -#endif #include #include #include @@ -113,17 +101,9 @@ * So define it here so it can be changed for the target system. * It should be defined somewhere netinet/in.h, but it is not. */ -#ifdef sgi -#define naddr u_int32_t -#elif defined (__NetBSD__) -#define naddr u_int32_t -#define _HAVE_SA_LEN -#define _HAVE_SIN_LEN -#else #define naddr u_long #define _HAVE_SA_LEN #define _HAVE_SIN_LEN -#endif #define DAY (24*60*60) #define NEVER DAY /* a long time */ @@ -147,9 +127,7 @@ /* Router Discovery parameters */ -#ifndef sgi #define INADDR_ALLROUTERS_GROUP 0xe0000002 /* 224.0.0.2 */ -#endif #define MaxMaxAdvertiseInterval 1800 #define MinMaxAdvertiseInterval 4 #define DefMaxAdvertiseInterval 600 @@ -295,9 +273,6 @@ struct interface { u_int ierrors; u_int opackets; u_int oerrors; -#ifdef sgi - u_int odrops; -#endif time_t ts; /* timestamp on network stats */ } int_data; # define MAX_AUTH_KEYS 5 @@ -502,10 +477,6 @@ extern char inittracename[PATH_MAX]; extern struct radix_node_head *rhead; -#ifdef sgi -/* Fix conflicts */ -#define dup2(x,y) BSDdup2(x,y) -#endif /* sgi */ void fix_sock(int, const char *); void fix_select(void); @@ -635,16 +606,4 @@ struct interface *iflookup(naddr); struct auth *find_auth(struct interface *); void end_md5_auth(struct ws_buf *, struct auth *); -#if defined(__FreeBSD__) || defined(__NetBSD__) #include -#else -#define MD5_DIGEST_LEN 16 -typedef struct { - u_int32_t state[4]; /* state (ABCD) */ - u_int32_t count[2]; /* # of bits, modulo 2^64 (LSB 1st) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; -void MD5Init(MD5_CTX*); -void MD5Update(MD5_CTX*, u_char*, u_int); -void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*); -#endif diff --git a/sbin/routed/if.c b/sbin/routed/if.c index af02b9e87391..da451e69e4d8 100644 --- a/sbin/routed/if.c +++ b/sbin/routed/if.c @@ -36,14 +36,7 @@ #include "defs.h" #include "pathnames.h" -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.27 $"); -#ident "$Revision: 2.27 $" -#endif struct ifhead ifnet = LIST_HEAD_INITIALIZER(ifnet); /* all interfaces */ struct ifhead remote_if = LIST_HEAD_INITIALIZER(remote_if); /* remote interfaces */ @@ -735,9 +728,6 @@ ifinit(void) ifs0.int_data.ierrors = ifm->ifm_data.ifi_ierrors; ifs0.int_data.opackets = ifm->ifm_data.ifi_opackets; ifs0.int_data.oerrors = ifm->ifm_data.ifi_oerrors; -#ifdef sgi - ifs0.int_data.odrops = ifm->ifm_data.ifi_odrops; -#endif sdl = (struct sockaddr_dl *)(ifm + 1); sdl->sdl_data[sdl->sdl_nlen] = 0; strncpy(ifs0.int_name, sdl->sdl_data, @@ -977,16 +967,6 @@ ifinit(void) ierr = ifs.int_data.ierrors - ifp->int_data.ierrors; out = ifs.int_data.opackets - ifp->int_data.opackets; oerr = ifs.int_data.oerrors - ifp->int_data.oerrors; -#ifdef sgi - /* Through at least IRIX 6.2, PPP and SLIP - * count packets dropped by the filters. - * But FDDI rings stuck non-operational count - * dropped packets as they wait for improvement. - */ - if (!(ifp->int_if_flags & IFF_POINTOPOINT)) - oerr += (ifs.int_data.odrops - - ifp->int_data.odrops); -#endif /* If the interface just awoke, restart the counters. */ if (ifp->int_data.ts == 0) { diff --git a/sbin/routed/input.c b/sbin/routed/input.c index 116d15ca7437..ef1c025e8f81 100644 --- a/sbin/routed/input.c +++ b/sbin/routed/input.c @@ -33,14 +33,7 @@ #include "defs.h" -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.26 $"); -#ident "$Revision: 2.26 $" -#endif static void input(struct sockaddr_in *, struct interface *, struct interface *, struct rip *, int); diff --git a/sbin/routed/main.c b/sbin/routed/main.c index c4f9e56065e6..d3b6a4484689 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -33,9 +33,6 @@ #include "defs.h" #include "pathnames.h" -#ifdef sgi -#include "math.h" -#endif #include #include #include @@ -43,15 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993 " "The Regents of the University of California." " All rights reserved."); -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#include -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.31 $"); -#ident "$Revision: 2.31 $" -#endif pid_t mypid; @@ -292,18 +281,9 @@ main(int argc, signal(SIGUSR2, sigtrace_off); /* get into the background */ -#ifdef sgi - if (0 > _daemonize(background ? 0 : (_DF_NOCHDIR|_DF_NOFORK), - STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO)) - BADERR(0, "_daemonize()"); -#else if (background && daemon(0, 1) < 0) BADERR(0,"daemon()"); -#endif -#if defined(__NetBSD__) - pidfile(0); -#endif mypid = getpid(); /* prepare socket connected to the kernel. diff --git a/sbin/routed/output.c b/sbin/routed/output.c index 7d5b1e4131a6..af4085ac02da 100644 --- a/sbin/routed/output.c +++ b/sbin/routed/output.c @@ -33,14 +33,7 @@ #include "defs.h" -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.27 $"); -#ident "$Revision: 2.27 $" -#endif u_int update_seqno; diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c index ef501b043244..16665b18407f 100644 --- a/sbin/routed/parms.c +++ b/sbin/routed/parms.c @@ -35,14 +35,7 @@ #include "pathnames.h" #include -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.26 $"); -#ident "$Revision: 2.26 $" -#endif static struct parm *parms; diff --git a/sbin/routed/pathnames.h b/sbin/routed/pathnames.h index fff6de671cfa..5a31fa7e86bc 100644 --- a/sbin/routed/pathnames.h +++ b/sbin/routed/pathnames.h @@ -47,8 +47,4 @@ * Leave this undefined, and only the trace file originally specified * when routed was started, if any, will be appended to. */ -#ifndef __NetBSD__ #define _PATH_TRACE "/etc/routed.trace" -#else -#undef _PATH_TRACE -#endif diff --git a/sbin/routed/radix.c b/sbin/routed/radix.c index 0f3ef39ec213..2372b8c68581 100644 --- a/sbin/routed/radix.c +++ b/sbin/routed/radix.c @@ -39,14 +39,7 @@ #include "defs.h" -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.23 $"); -#ident "$Revision: 2.23 $" -#endif #define log(x, msg) syslog(x, msg) #define panic(s) {log(LOG_ERR,s); exit(1);} diff --git a/sbin/routed/rdisc.c b/sbin/routed/rdisc.c index b8b02d7b9e1a..3494f061b64b 100644 --- a/sbin/routed/rdisc.c +++ b/sbin/routed/rdisc.c @@ -36,14 +36,7 @@ #include #include -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.27 $"); -#ident "$Revision: 2.27 $" -#endif /* router advertisement ICMP packet */ struct icmp_ad { diff --git a/sbin/routed/table.c b/sbin/routed/table.c index 04b2f79f5e08..648a1d1a6b25 100644 --- a/sbin/routed/table.c +++ b/sbin/routed/table.c @@ -33,14 +33,7 @@ #include "defs.h" -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.27 $"); -#ident "$Revision: 2.27 $" -#endif static struct rt_spare *rts_better(struct rt_entry *); static struct rt_spare rts_empty = {0,0,0,HOPCNT_INFINITY,0,0,0}; diff --git a/sbin/routed/trace.c b/sbin/routed/trace.c index 5fe4a97c2146..98c29218fb89 100644 --- a/sbin/routed/trace.c +++ b/sbin/routed/trace.c @@ -38,20 +38,9 @@ #include #include -#ifdef __NetBSD__ -__RCSID("$NetBSD$"); -#elif defined(__FreeBSD__) __RCSID("$FreeBSD$"); -#else -__RCSID("$Revision: 2.27 $"); -#ident "$Revision: 2.27 $" -#endif -#ifdef sgi -/* use *stat64 for files on large file systems */ -#define stat stat64 -#endif int tracelevel, new_tracelevel; FILE *ftrace; /* output trace file */ @@ -150,12 +139,8 @@ ts(time_t secs) { static char s[20]; secs += epoch.tv_sec; -#ifdef sgi - (void)cftime(s, "%T", &secs); -#else memcpy(s, ctime(&secs)+11, 8); s[8] = '\0'; -#endif return s; }