1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 28 /* All Rights Reserved */ 29 30 /* 31 * Portions of this source code were derived from Berkeley 4.3 BSD 32 * under license from the Regents of the University of California. 33 */ 34 35 #ifndef _IN_RIPNGD_DEFS_H 36 #define _IN_RIPNGD_DEFS_H 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 #include <sys/types.h> 43 #include <sys/socket.h> 44 #include <sys/sockio.h> 45 #include <sys/stream.h> 46 #include <sys/time.h> 47 #include <sys/stat.h> 48 #include <fcntl.h> 49 50 #include <netinet/in.h> 51 #include <netinet/ip6.h> 52 #include <netinet/udp.h> 53 #include <net/if.h> 54 #include <net/route.h> 55 #include <protocols/ripngd.h> 56 57 #include <stdio.h> 58 #include <stdlib.h> 59 #include <syslog.h> 60 #include <netdb.h> 61 62 #include <signal.h> 63 #include <stropts.h> 64 #include <arpa/inet.h> 65 66 #include <strings.h> 67 #include <unistd.h> 68 #include <errno.h> 69 #include <malloc.h> 70 #include <limits.h> 71 72 #include "table.h" 73 #include "trace.h" 74 #include "interface.h" 75 76 #define PATH_PID "/var/run/in.ripngd.pid" 77 78 /* 79 * Timer values (in seconds) used in managing the routing table. 80 * Every update forces an entry's timer to be reset. After 81 * EXPIRE_TIME without updates, the entry is marked invalid, 82 * but held onto until GARBAGE_TIME so that others may 83 * see it "be deleted". 84 */ 85 #define EXPIRE_TIME 180 /* time to mark entry invalid */ 86 #define GARBAGE_TIME 300 /* time to garbage collect */ 87 #define MIN_SUPPLY_TIME 15 /* min. time to supply tables */ 88 #define MAX_SUPPLY_TIME 45 /* max. time to supply tables */ 89 #define MIN_WAIT_TIME 1 /* min. interval to multicast changes */ 90 #define MAX_WAIT_TIME 5 /* max. time to delay changes */ 91 92 /* 93 * Return a random number from a an range inclusive of the endpoints 94 */ 95 #define GET_RANDOM(LOW, HIGH) (random() % ((HIGH) - (LOW) + 1) + (LOW)) 96 97 /* 98 * When we find any interfaces marked down we rescan the 99 * kernel every CHECK_INTERVAL seconds to see if they've 100 * come up. 101 */ 102 #define CHECK_INTERVAL 60 103 #define START_POLL_SIZE 5 104 105 #define min(a, b) ((a) > (b) ? (b) : (a)) 106 107 /* 108 * The maximum receive buffer size is controlled via Solaris' NDD udp_max_buf 109 * tunable. 110 */ 111 #define RCVBUFSIZ 65536 112 113 #define TIME_TO_MSECS(tval) ((tval).tv_sec * 1000 + (tval).tv_usec / 1000) 114 115 #define HOPCNT_INFINITY 16 /* RFC 2080, section 2.1 */ 116 #define HOPCNT_NEXTHOP 255 /* RFC 2080, section 2.1.1 */ 117 118 /* 119 * XXX Some of these are defined in <inet/ip6.h> under _KERNEL (but should be 120 * defined in <netinet/ip6.h> for completeness). 121 */ 122 #define IPV6_MAX_HOPS 255 /* Max IPv6 hops */ 123 #define IPV6_MAX_PACKET 65535 /* maximum IPv6 packet size */ 124 #define IPV6_MIN_MTU 1280 /* Minimum IPv6 MTU */ 125 126 extern struct sockaddr_in6 allrouters; 127 extern struct in6_addr allrouters_in6; 128 extern char *control; 129 extern boolean_t dopoison; 130 extern struct interface *ifnet; 131 extern boolean_t install; 132 extern int iocsoc; 133 extern struct timeval lastfullupdate; 134 extern struct timeval lastmcast; 135 extern int max_poll_ifs; 136 extern struct rip6 *msg; 137 extern boolean_t needupdate; 138 extern struct timeval nextmcast; 139 extern struct timeval now; 140 extern char *packet; 141 extern struct pollfd *poll_ifs; 142 extern int poll_ifs_num; 143 extern int rip6_port; 144 extern int supplyinterval; 145 extern boolean_t supplier; 146 147 extern void dynamic_update(struct interface *); 148 extern void in_data(struct interface *); 149 extern void initifs(void); 150 extern void sendpacket(struct sockaddr_in6 *, struct interface *, 151 int, int); 152 extern void setup_rtsock(void); 153 extern void solicitall(struct sockaddr_in6 *); 154 extern void supply(struct sockaddr_in6 *, struct interface *, 155 int, boolean_t); 156 extern void supplyall(struct sockaddr_in6 *, int, 157 struct interface *, boolean_t); 158 extern void term(void); 159 extern void timer(void); 160 extern void timevaladd(struct timeval *, struct timeval *); 161 162 #ifdef __cplusplus 163 } 164 #endif 165 166 #endif /* _IN_RIPNGD_DEFS_H */ 167