2 * Routing Information Base header
3 * Copyright (C) 1997 Kunihiro Ishiguro
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 #define DISTANCE_INFINITY 255
28 /* Routing information base. */
35 /* Type fo this route. */
38 /* Which routing table */
44 /* Flags of this route. This flag's definition is in lib/zebra.h
57 /* Nexthop information. */
59 u_char nexthop_active_num;
60 u_char nexthop_fib_num;
62 struct nexthop *nexthop;
65 /* Static route information. */
68 /* For linked list. */
69 struct static_ipv4 *prev;
70 struct static_ipv4 *next;
72 /* Administrative distance. */
75 /* Flag for this static route's type. */
77 #define STATIC_IPV4_GATEWAY 1
78 #define STATIC_IPV4_IFNAME 2
89 /* Static route information. */
92 /* For linked list. */
93 struct static_ipv6 *prev;
94 struct static_ipv6 *next;
96 /* Administrative distance. */
99 /* Flag for this static route's type. */
101 #define STATIC_IPV6_GATEWAY 1
102 #define STATIC_IPV6_GATEWAY_IFNAME 2
103 #define STATIC_IPV6_IFNAME 3
106 struct in6_addr ipv6;
109 #endif /* HAVE_IPV6 */
111 /* Nexthop structure. */
114 struct nexthop *next;
115 struct nexthop *prev;
118 #define NEXTHOP_TYPE_IFINDEX 1 /* Directly connected. */
119 #define NEXTHOP_TYPE_IFNAME 2 /* Interface route. */
120 #define NEXTHOP_TYPE_IPV4 3 /* IPv4 nexthop. */
121 #define NEXTHOP_TYPE_IPV4_IFINDEX 4 /* IPv4 nexthop with ifindex. */
122 #define NEXTHOP_TYPE_IPV4_IFNAME 5 /* IPv4 nexthop with ifname. */
123 #define NEXTHOP_TYPE_IPV6 6 /* IPv6 nexthop. */
124 #define NEXTHOP_TYPE_IPV6_IFINDEX 7 /* IPv6 nexthop with ifindex. */
125 #define NEXTHOP_TYPE_IPV6_IFNAME 8 /* IPv6 nexthop with ifname. */
128 #define NEXTHOP_FLAG_ACTIVE (1 << 0) /* This nexthop is alive. */
129 #define NEXTHOP_FLAG_FIB (1 << 1) /* FIB nexthop. */
130 #define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */
132 /* Interface index. */
133 unsigned int ifindex;
136 /* Nexthop address or interface name. */
141 struct in6_addr ipv6;
142 #endif /* HAVE_IPV6*/
145 /* Recursive lookup nexthop. */
147 unsigned int rifindex;
152 struct in6_addr ipv6;
153 #endif /* HAVE_IPV6 */
156 struct nexthop *indirect;
159 struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int);
160 struct nexthop *nexthop_ifname_add (struct rib *, char *);
161 struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *);
163 struct nexthop *nexthop_ipv6_add (struct rib *, struct in6_addr *);
164 #endif /* HAVE_IPV6 */
167 rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
168 struct in_addr *gate, unsigned int ifindex, int table,
172 rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *);
175 rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
176 struct in_addr *gate, unsigned int ifindex, int table);
179 rib_match_ipv4 (struct in_addr);
182 rib_lookup_ipv4 (struct prefix_ipv4 *);
185 void rib_sweep_route ();
189 extern struct route_table *rib_table_ipv4;
193 rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
194 struct in6_addr *gate, unsigned int ifindex, int table);
197 rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
198 struct in6_addr *gate, unsigned int ifindex, int table);
200 struct rib *rib_lookup_ipv6 (struct in6_addr *);
202 struct rib *rib_match_ipv6 (struct in6_addr *);
204 extern struct route_table *rib_table_ipv6;
205 #endif /* HAVE_IPV6 */
207 #endif /*_ZEBRA_RIB_H */