summaryrefslogtreecommitdiff
path: root/sbin/routed/defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/routed/defs.h')
-rw-r--r--sbin/routed/defs.h117
1 files changed, 27 insertions, 90 deletions
diff --git a/sbin/routed/defs.h b/sbin/routed/defs.h
index 2f0a9c2882c..f5cc6ef709b 100644
--- a/sbin/routed/defs.h
+++ b/sbin/routed/defs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: defs.h,v 1.5 1997/07/30 22:24:40 mickey Exp $ */
+/* $OpenBSD: defs.h,v 1.6 1997/07/30 23:28:40 deraadt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -70,7 +70,6 @@
#include <stdarg.h>
#include <syslog.h>
#include <time.h>
-#include <sys/time.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -101,8 +100,7 @@
*/
/* #define MCAST_PPP_BUG */
-#define DAY (24*60*60)
-#define NEVER DAY /* a long time */
+#define NEVER (24*60*60) /* a long time */
#define EPOCH NEVER /* bias time by this to avoid <0 */
/* Scan the kernel regularly to see if any interfaces have appeared or been
@@ -114,13 +112,6 @@
#define LIM_SEC(s,l) ((s).tv_sec = MIN((s).tv_sec, (l)))
-/* Metric used for fake default routes. It ought to be 15, but when
- * processing advertised routes, previous versions of `routed` added
- * to the received metric and discarded the route if the total was 16
- * or larger.
- */
-#define FAKE_METRIC (HOPCNT_INFINITY-2)
-
/* Router Discovery parameters */
#ifndef sgi
@@ -141,19 +132,15 @@
#define MAX_SOLICITATIONS 3
-/* Bloated packet size for systems that simply add authentication to
- * full-sized packets
- */
-#define OVER_MAXPACKETSIZE (MAXPACKETSIZE+sizeof(struct netinfo)*2)
/* typical packet buffers */
union pkt_buf {
- char packet[OVER_MAXPACKETSIZE*2];
+ char packet[MAXPACKETSIZE+1];
struct rip rip;
};
-/* No more routes than this, to protect ourself in case something goes
- * whacko and starts broadcasting zillions of bogus routes.
+/* no more routes than this, to protect ourself in case something goes
+ * whacko and starts broadcast zillions of bogus routes.
*/
#define MAX_ROUTES (128*1024)
extern int total_routes;
@@ -221,7 +208,7 @@ struct rt_entry {
* - or the current route is equal but stale
* - or it is a host route advertised by a system for itself
*/
-#define BETTER_LINK(rt,A,B) ((A)->rts_metric < HOPCNT_INFINITY \
+#define BETTER_LINK(rt,A,B) ((A)->rts_metric < HOPCNT_INFINITY \
&& now_stale <= (A)->rts_time \
&& ((A)->rts_metric < (B)->rts_metric \
|| ((A)->rts_gate == (A)->rts_router \
@@ -237,11 +224,7 @@ struct rt_entry {
* handles "logical" or "IS_REMOTE" interfaces (remote gateways).
*/
struct interface {
- struct interface *int_next, **int_prev;
- struct interface *int_ahash, **int_ahash_prev;
- struct interface *int_bhash, **int_bhash_prev;
- struct interface *int_rlink, **int_rlink_prev;
- struct interface *int_nhash, **int_nhash_prev;
+ struct interface *int_next, *int_prev;
char int_name[IFNAMSIZ+15+1]; /* big enough for IS_REMOTE */
u_short int_index;
naddr int_addr; /* address on this host (net order) */
@@ -257,7 +240,6 @@ struct interface {
int int_if_flags; /* some bits copied from kernel */
u_int int_state;
time_t int_act_time; /* last thought healthy */
- time_t int_query_time;
u_short int_transitions; /* times gone up-down */
char int_metric;
char int_d_metric; /* for faked default route */
@@ -271,13 +253,7 @@ struct interface {
#endif
time_t ts; /* timestamp on network stats */
} int_data;
-# define MAX_AUTH_KEYS 5
- struct auth { /* authentication info */
- u_char type;
- u_char key[RIP_AUTH_PW_LEN];
- u_char keyid;
- time_t start, end;
- } int_auth[MAX_AUTH_KEYS];
+ char int_passwd[RIP_AUTH_PW_LEN]; /* RIPv2 password */
int int_rdisc_pref; /* advertised rdisc preference */
int int_rdisc_int; /* MaxAdvertiseInterval */
int int_rdisc_cnt;
@@ -293,11 +269,11 @@ struct interface {
#define IS_CHECKED 0x0000020 /* still exists */
#define IS_ALL_HOSTS 0x0000040 /* in INADDR_ALLHOSTS_GROUP */
#define IS_ALL_ROUTERS 0x0000080 /* in INADDR_ALLROUTERS_GROUP */
-#define IS_DISTRUST 0x0000100 /* ignore untrusted routers */
-#define IS_REDIRECT_OK 0x0000200 /* accept ICMP redirects */
-#define IS_BROKE 0x0000400 /* seems to be broken */
-#define IS_SICK 0x0000800 /* seems to be broken */
-#define IS_DUP 0x0001000 /* has a duplicate address */
+#define IS_RIP_QUERIED 0x0000100 /* query broadcast */
+#define IS_BROKE 0x0000200 /* seems to be broken */
+#define IS_SICK 0x0000400 /* seems to be broken */
+#define IS_DUP 0x0000800 /* has a duplicate address */
+#define IS_ACTIVE 0x0001000 /* heard from it at least once */
#define IS_NEED_NET_SYN 0x0002000 /* need RS_NET_SYN route */
#define IS_NO_AG 0x0004000 /* do not aggregate subnets */
#define IS_NO_SUPER_AG 0x0008000 /* do not aggregate networks */
@@ -369,14 +345,14 @@ struct ag_info {
extern struct parm {
struct parm *parm_next;
char parm_name[IFNAMSIZ+1];
- naddr parm_net;
+ naddr parm_addr_h;
naddr parm_mask;
char parm_d_metric;
u_int parm_int_state;
int parm_rdisc_pref;
int parm_rdisc_int;
- struct auth parm_auth[MAX_AUTH_KEYS];
+ char parm_passwd[RIP_AUTH_PW_LEN+1];
} *parms;
/* authority for internal networks */
@@ -387,23 +363,7 @@ extern struct intnet {
char intnet_metric;
} *intnets;
-/* trusted routers */
-extern struct tgate {
- struct tgate *tgate_next;
- naddr tgate_addr;
-} *tgates;
-enum output_type {OUT_QUERY, OUT_UNICAST, OUT_BROADCAST, OUT_MULTICAST,
- NO_OUT_MULTICAST, NO_OUT_RIPV2};
-
-/* common output buffers */
-extern struct ws_buf {
- struct rip *buf;
- struct netinfo *n;
- struct netinfo *base;
- struct netinfo *lim;
- enum output_type type;
-} v12buf, v2buf;
extern pid_t mypid;
extern naddr myaddr; /* main address of this system */
@@ -426,8 +386,7 @@ extern int mhome; /* 1=want multi-homed host route */
extern int advertise_mhome; /* 1=must continue adverising it */
extern int auth_ok; /* 1=ignore auth if we do not care */
-extern struct timeval clk; /* system clock's idea of time */
-extern struct timeval epoch; /* system clock when started */
+extern struct timeval epoch; /* when started */
extern struct timeval now; /* current idea of time */
extern time_t now_stale;
extern time_t now_expire;
@@ -445,21 +404,19 @@ extern naddr loopaddr; /* our address on loopback */
extern int tot_interfaces; /* # of remote and local interfaces */
extern int rip_interfaces; /* # of interfaces doing RIP */
extern struct interface *ifnet; /* all interfaces */
-extern struct interface *remote_if; /* remote interfaces */
extern int have_ripv1_out; /* have a RIPv1 interface */
extern int have_ripv1_in;
extern int need_flash; /* flash update needed */
extern struct timeval need_kern; /* need to update kernel table */
extern int update_seqno; /* a route has changed */
-extern int tracelevel, new_tracelevel;
+extern u_int tracelevel, new_tracelevel;
#define MAX_TRACELEVEL 4
#define TRACEKERNEL (tracelevel >= 4) /* log kernel changes */
#define TRACECONTENTS (tracelevel >= 3) /* display packet contents */
#define TRACEPACKETS (tracelevel >= 2) /* note packets */
#define TRACEACTIONS (tracelevel != 0)
extern FILE *ftrace; /* output trace file */
-extern char inittracename[MAXPATHLEN+1];
extern struct radix_node_head *rhead;
@@ -474,25 +431,16 @@ extern void fix_select(void);
extern void rip_off(void);
extern void rip_on(struct interface *);
-extern void bufinit(void);
-extern int output(enum output_type, struct sockaddr_in *,
- struct interface *, struct rip *, int);
-extern void clr_ws_buf(struct ws_buf *, struct auth *);
+enum output_type {OUT_QUERY, OUT_UNICAST, OUT_BROADCAST, OUT_MULTICAST,
+ NO_OUT_MULTICAST, NO_OUT_RIPV2};
+extern int output(enum output_type, struct sockaddr_in *,
+ struct interface *, struct rip *, int);
extern void rip_query(void);
extern void rip_bcast(int);
extern void supply(struct sockaddr_in *, struct interface *,
- enum output_type, int, int, int);
+ enum output_type, int, int);
extern void msglog(char *, ...);
-struct msg_limit {
- time_t reuse;
- struct msg_sub {
- naddr addr;
- time_t until;
-# define MSG_SUBJECT_N 8
- } subs[MSG_SUBJECT_N];
-};
-extern void msglim(struct msg_limit *, naddr, char *, ...);
#define LOGERR(msg) msglog(msg ": %s", strerror(errno))
extern void logbad(int, char *, ...);
#define BADERR(dump,msg) logbad(dump,msg ": %s", strerror(errno))
@@ -510,16 +458,15 @@ extern void intvl_random(struct timeval *, u_long, u_long);
extern int getnet(char *, naddr *, naddr *);
extern int gethost(char *, naddr *);
extern void gwkludge(void);
-extern char *parse_parms(char *, int);
+extern char *parse_parms(char *);
extern char *check_parms(struct parm *);
extern void get_parms(struct interface *);
extern void lastlog(void);
-extern void set_tracefile(char *, char *, int);
-extern void tracelevel_msg(char *, int);
+extern void trace_on(char *, int);
extern void trace_off(char*, ...);
-extern void set_tracelevel(void);
extern void trace_flush(void);
+extern void set_tracelevel(void);
extern void trace_kernel(char *, ...);
extern void trace_act(char *, ...);
extern void trace_pkt(char *, ...);
@@ -533,7 +480,6 @@ extern void trace_upslot(struct rt_entry *, struct rt_spare *,
extern void trace_rip(char*, char*, struct sockaddr_in *,
struct interface *, struct rip *, int);
extern char *addrname(naddr, naddr, int);
-extern char *rtname(naddr, naddr, naddr);
extern void rdisc_age(naddr);
extern void set_rdisc_mg(struct interface *, int);
@@ -568,7 +514,6 @@ extern void rtadd(naddr, naddr, naddr, naddr,
extern void rtchange(struct rt_entry *, u_int, naddr,naddr, int, u_short,
struct interface *ifp, time_t, char *);
extern void rtdelete(struct rt_entry *);
-extern void rts_delete(struct rt_entry *, struct rt_spare *);
extern void rtbad_sub(struct rt_entry *);
extern void rtswitch(struct rt_entry *, struct rt_spare *);
extern void rtbad(struct rt_entry *);
@@ -590,21 +535,13 @@ extern naddr ripv1_mask_net(naddr, struct interface *);
extern naddr ripv1_mask_host(naddr,struct interface *);
#define on_net(a,net,mask) (((ntohl(a) ^ (net)) & (mask)) == 0)
extern int check_dst(naddr);
-extern struct interface *check_dup(naddr, naddr, naddr, int);
-extern int check_remote(struct interface *);
-extern int addrouteforif(register struct interface *);
+extern void addrouteforif(register struct interface *);
extern void ifinit(void);
extern int walk_bad(struct radix_node *, void *);
extern int if_ok(struct interface *, char *);
extern void if_sick(struct interface *);
extern void if_bad(struct interface *);
-extern void if_link(struct interface *);
extern struct interface *ifwithaddr(naddr, int, int);
extern struct interface *ifwithname(char *, naddr);
-extern struct interface *ifwithindex(u_short, int);
+extern struct interface *ifwithindex(u_short);
extern struct interface *iflookup(naddr);
-
-extern struct auth *find_auth(struct interface *);
-extern void end_md5_auth(struct ws_buf *, struct auth *);
-
-#define MD5_DIGEST_LEN 16