4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 #include <sys/types.h>
42 #include <sys/param.h>
43 #include <sys/socket.h>
44 #include <arpa/inet.h>
47 #include <sys/ioctl.h>
48 #include <sys/sockio.h>
50 #include <sys/stropts.h>
55 #include <netinet/in_systm.h>
56 #include <netinet/in.h>
57 #include <netinet/ip.h>
58 #include <netinet/ip_icmp.h>
59 #include <netinet/if_ether.h>
60 #include <netinet/ip6.h>
61 #include <netinet/icmp6.h>
62 #include <net/route.h>
64 #include <ipadm_ndpd.h>
72 #define CURHOP_UNSPECIFIED 0
73 #define PATH_NDPD_CONF "/etc/inet/ndpd.conf"
75 extern int debug
, no_loopback
;
77 extern struct in6_addr all_nodes_mcast
;
78 extern struct in6_addr all_routers_mcast
;
81 extern struct rt_msghdr
*rt_msg
;
82 extern struct sockaddr_in6
*rta_gateway
;
83 extern struct sockaddr_dl
*rta_ifp
;
87 #define D_DEFAULTS 0x0001 /* Default values in config file */
88 #define D_CONFIG 0x0002 /* Config file */
89 #define D_PHYINT 0x0004 /* phyint table */
90 #define D_PREFIX 0x0008 /* prefix table */
91 #define D_ROUTER 0x0010 /* router table */
92 #define D_STATE 0x0020 /* RS/RA state machine */
93 #define D_IFSCAN 0x0040 /* Scan of kernel interfaces */
94 #define D_TIMER 0x0080 /* Timer mechanism */
95 #define D_PARSE 0x0100 /* config file parser */
96 #define D_PKTIN 0x0200 /* Received packet */
97 #define D_PKTBAD 0x0400 /* Malformed packet */
98 #define D_PKTOUT 0x0800 /* Sent packet */
99 #define D_TMP 0x1000 /* RFC3041 mechanism */
100 #define D_DHCP 0x2000 /* RFC3315 DHCPv6 (stateful addrs) */
102 #define IF_SEPARATOR ':'
103 #define IPV6_MAX_HOPS 255
104 #define IPV6_MIN_MTU (1024+256)
105 #define IPV6_ABITS 128
106 #define TMP_TOKEN_BITS 64
107 #define TMP_TOKEN_BYTES (TMP_TOKEN_BITS / 8)
108 #define MAX_DAD_FAILURES 5
110 /* Return a random number from a an range inclusive of the endpoints */
111 #define GET_RANDOM(LOW, HIGH) (random() % ((HIGH) - (LOW) + 1) + (LOW))
113 #define TIMER_INFINITY 0xFFFFFFFFU /* Never time out */
114 #define PREFIX_INFINITY 0XFFFFFFFFU /* A "forever" prefix lifetime */
117 * Used by 2 hour rule for stateless addrconf
119 #define MIN_VALID_LIFETIME (2*60*60) /* In seconds */
122 * Control how often pi_ReachableTime gets re-randomized
124 #define MIN_REACH_RANDOM_INTERVAL (60*1000) /* 1 minute in ms */
125 #define MAX_REACH_RANDOM_INTERVAL (60*60*1000) /* 1 hour in ms */
130 #define MAXLINELEN 4096
131 #define MAXARGSPERLINE 128
133 void timer_schedule(uint_t delay
);
134 extern void logmsg(int level
, const char *fmt
, ...);
135 extern void logperror(const char *str
);
136 extern void logperror_pi(const struct phyint
*pi
, const char *str
);
137 extern void logperror_pr(const struct prefix
*pr
, const char *str
);
138 extern int parse_config(char *config_file
, boolean_t file_required
);
140 extern int poll_add(int fd
);
141 extern int poll_remove(int fd
);
143 extern char *fmt_lla(char *llabuf
, int bufsize
, uchar_t
*lla
, int llalen
);
145 extern int do_dad(char *ifname
, struct sockaddr_in6
*testaddr
);
151 #endif /* _NDPD_DEFS_H */