summaryrefslogtreecommitdiff
path: root/lib/nexthop.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nexthop.h')
-rw-r--r--lib/nexthop.h108
1 files changed, 53 insertions, 55 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h
index e66e0eee20..627ca85415 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -31,40 +31,37 @@
#define NEXTHOP_STRLEN (INET6_ADDRSTRLEN + 30)
union g_addr {
- struct in_addr ipv4;
- struct in6_addr ipv6;
+ struct in_addr ipv4;
+ struct in6_addr ipv6;
};
-enum nexthop_types_t
-{
- NEXTHOP_TYPE_IFINDEX = 1, /* Directly connected. */
- NEXTHOP_TYPE_IPV4, /* IPv4 nexthop. */
- NEXTHOP_TYPE_IPV4_IFINDEX, /* IPv4 nexthop with ifindex. */
- NEXTHOP_TYPE_IPV6, /* IPv6 nexthop. */
- NEXTHOP_TYPE_IPV6_IFINDEX, /* IPv6 nexthop with ifindex. */
- NEXTHOP_TYPE_BLACKHOLE, /* Null0 nexthop. */
+enum nexthop_types_t {
+ NEXTHOP_TYPE_IFINDEX = 1, /* Directly connected. */
+ NEXTHOP_TYPE_IPV4, /* IPv4 nexthop. */
+ NEXTHOP_TYPE_IPV4_IFINDEX, /* IPv4 nexthop with ifindex. */
+ NEXTHOP_TYPE_IPV6, /* IPv6 nexthop. */
+ NEXTHOP_TYPE_IPV6_IFINDEX, /* IPv6 nexthop with ifindex. */
+ NEXTHOP_TYPE_BLACKHOLE, /* Null0 nexthop. */
};
/* Nexthop label structure. */
-struct nexthop_label
-{
- u_int8_t num_labels;
- u_int8_t reserved[3];
- mpls_label_t label[0]; /* 1 or more labels. */
+struct nexthop_label {
+ u_int8_t num_labels;
+ u_int8_t reserved[3];
+ mpls_label_t label[0]; /* 1 or more labels. */
};
/* Nexthop structure. */
-struct nexthop
-{
- struct nexthop *next;
- struct nexthop *prev;
+struct nexthop {
+ struct nexthop *next;
+ struct nexthop *prev;
- /* Interface index. */
- ifindex_t ifindex;
+ /* Interface index. */
+ ifindex_t ifindex;
- enum nexthop_types_t type;
+ enum nexthop_types_t type;
- u_char flags;
+ u_char flags;
#define NEXTHOP_FLAG_ACTIVE (1 << 0) /* This nexthop is alive. */
#define NEXTHOP_FLAG_FIB (1 << 1) /* FIB nexthop. */
#define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */
@@ -72,51 +69,52 @@ struct nexthop
#define NEXTHOP_FLAG_MATCHED (1 << 4) /* Already matched vs a nexthop */
#define NEXTHOP_FLAG_FILTERED (1 << 5) /* rmap filtered, used by static only */
- /* Nexthop address */
- union g_addr gate;
- union g_addr src;
- union g_addr rmap_src; /* Src is set via routemap */
+ /* Nexthop address */
+ union g_addr gate;
+ union g_addr src;
+ union g_addr rmap_src; /* Src is set via routemap */
- /* Nexthops obtained by recursive resolution.
- *
- * If the nexthop struct needs to be resolved recursively,
- * NEXTHOP_FLAG_RECURSIVE will be set in flags and the nexthops
- * obtained by recursive resolution will be added to `resolved'.
- * Only one level of recursive resolution is currently supported. */
- struct nexthop *resolved;
+ /* Nexthops obtained by recursive resolution.
+ *
+ * If the nexthop struct needs to be resolved recursively,
+ * NEXTHOP_FLAG_RECURSIVE will be set in flags and the nexthops
+ * obtained by recursive resolution will be added to `resolved'.
+ * Only one level of recursive resolution is currently supported. */
+ struct nexthop *resolved;
- /* Type of label(s), if any */
- enum lsp_types_t nh_label_type;
+ /* Type of label(s), if any */
+ enum lsp_types_t nh_label_type;
- /* Label(s) associated with this nexthop. */
- struct nexthop_label *nh_label;
+ /* Label(s) associated with this nexthop. */
+ struct nexthop_label *nh_label;
};
extern int zebra_rnh_ip_default_route;
extern int zebra_rnh_ipv6_default_route;
-static inline int
-nh_resolve_via_default(int family)
+static inline int nh_resolve_via_default(int family)
{
- if (((family == AF_INET) && zebra_rnh_ip_default_route) ||
- ((family == AF_INET6) && zebra_rnh_ipv6_default_route))
- return 1;
- else
- return 0;
+ if (((family == AF_INET) && zebra_rnh_ip_default_route)
+ || ((family == AF_INET6) && zebra_rnh_ipv6_default_route))
+ return 1;
+ else
+ return 0;
}
-struct nexthop *nexthop_new (void);
-void nexthop_add (struct nexthop **target, struct nexthop *nexthop);
+struct nexthop *nexthop_new(void);
+void nexthop_add(struct nexthop **target, struct nexthop *nexthop);
-void copy_nexthops (struct nexthop **tnh, struct nexthop *nh);
-void nexthop_free (struct nexthop *nexthop);
-void nexthops_free (struct nexthop *nexthop);
+void copy_nexthops(struct nexthop **tnh, struct nexthop *nh);
+void nexthop_free(struct nexthop *nexthop);
+void nexthops_free(struct nexthop *nexthop);
-void nexthop_add_labels (struct nexthop *, enum lsp_types_t, u_int8_t, mpls_label_t *);
-void nexthop_del_labels (struct nexthop *);
+void nexthop_add_labels(struct nexthop *, enum lsp_types_t, u_int8_t,
+ mpls_label_t *);
+void nexthop_del_labels(struct nexthop *);
-extern const char *nexthop_type_to_str (enum nexthop_types_t nh_type);
-extern int nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2);
+extern const char *nexthop_type_to_str(enum nexthop_types_t nh_type);
+extern int nexthop_same_no_recurse(struct nexthop *next1,
+ struct nexthop *next2);
-extern const char * nexthop2str (struct nexthop *nexthop, char *str, int size);
+extern const char *nexthop2str(struct nexthop *nexthop, char *str, int size);
#endif /*_LIB_NEXTHOP_H */