2 * Nexthop structure definition.
3 * Copyright (C) 2013 Cumulus Networks, Inc.
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
23 #ifndef _LIB_NEXTHOP_H
24 #define _LIB_NEXTHOP_H
32 #endif /* HAVE_IPV6 */
37 NEXTHOP_TYPE_IFINDEX
= 1, /* Directly connected. */
38 NEXTHOP_TYPE_IFNAME
, /* Interface route. */
39 NEXTHOP_TYPE_IPV4
, /* IPv4 nexthop. */
40 NEXTHOP_TYPE_IPV4_IFINDEX
, /* IPv4 nexthop with ifindex. */
41 NEXTHOP_TYPE_IPV4_IFNAME
, /* IPv4 nexthop with ifname. */
42 NEXTHOP_TYPE_IPV6
, /* IPv6 nexthop. */
43 NEXTHOP_TYPE_IPV6_IFINDEX
, /* IPv6 nexthop with ifindex. */
44 NEXTHOP_TYPE_IPV6_IFNAME
, /* IPv6 nexthop with ifname. */
45 NEXTHOP_TYPE_BLACKHOLE
, /* Null0 nexthop. */
48 /* Nexthop structure. */
54 /* Interface index. */
58 enum nexthop_types_t type
;
61 #define NEXTHOP_FLAG_ACTIVE (1 << 0) /* This nexthop is alive. */
62 #define NEXTHOP_FLAG_FIB (1 << 1) /* FIB nexthop. */
63 #define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */
64 #define NEXTHOP_FLAG_ONLINK (1 << 3) /* Nexthop should be installed onlink. */
65 #define NEXTHOP_FLAG_MATCHED (1 << 4) /* Already matched vs a nexthop */
66 #define NEXTHOP_FLAG_FILTERED (1 << 5) /* rmap filtered, used by static only */
71 union g_addr rmap_src
; /* Src is set via routemap */
73 /* Nexthops obtained by recursive resolution.
75 * If the nexthop struct needs to be resolved recursively,
76 * NEXTHOP_FLAG_RECURSIVE will be set in flags and the nexthops
77 * obtained by recursive resolution will be added to `resolved'.
78 * Only one level of recursive resolution is currently supported. */
79 struct nexthop
*resolved
;
82 #define nexthop_new() \
84 struct nexthop *n = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop)); \
88 extern const char *nexthop_type_to_str (enum nexthop_types_t nh_type
);
89 extern int nexthop_same_no_recurse (struct nexthop
*next1
, struct nexthop
*next2
);
91 #endif /*_LIB_NEXTHOP_H */