diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 17:40:34 -0700 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 17:40:34 -0700 | 
| commit | fb018d251e5fc2fee0814a63c4e0a44274c98bb9 (patch) | |
| tree | 59351ede3cd497fbb05c2b6906de549f17686f55 /lib/nexthop.h | |
| parent | f188f2c424e8cf37517e68c09ca93329aa4297aa (diff) | |
nexthop-tracking.patch
quagga: nexthop-tracking.patch
Add next hop tracking support to Quagga. Complete documentation in doc/next-hop-tracking.txt.
Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop.h')
| -rw-r--r-- | lib/nexthop.h | 89 | 
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h new file mode 100644 index 0000000000..bddac6554f --- /dev/null +++ b/lib/nexthop.h @@ -0,0 +1,89 @@ +/* + * Nexthop structure definition. + * Copyright (C) 2013 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING.  If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _LIB_NEXTHOP_H +#define _LIB_NEXTHOP_H + +#include "prefix.h" + +union g_addr { +  struct in_addr ipv4; +#ifdef HAVE_IPV6 +  struct in6_addr ipv6; +#endif /* HAVE_IPV6 */ +}; + +enum nexthop_types_t +{ +  NEXTHOP_TYPE_IFINDEX = 1,      /* Directly connected.  */ +  NEXTHOP_TYPE_IFNAME,           /* Interface route.  */ +  NEXTHOP_TYPE_IPV4,             /* IPv4 nexthop.  */ +  NEXTHOP_TYPE_IPV4_IFINDEX,     /* IPv4 nexthop with ifindex.  */ +  NEXTHOP_TYPE_IPV4_IFNAME,      /* IPv4 nexthop with ifname.  */ +  NEXTHOP_TYPE_IPV6,             /* IPv6 nexthop.  */ +  NEXTHOP_TYPE_IPV6_IFINDEX,     /* IPv6 nexthop with ifindex.  */ +  NEXTHOP_TYPE_IPV6_IFNAME,      /* IPv6 nexthop with ifname.  */ +  NEXTHOP_TYPE_BLACKHOLE,        /* Null0 nexthop.  */ +}; + +/* Nexthop structure. */ +struct nexthop +{ +  struct nexthop *next; +  struct nexthop *prev; + +  /* Interface index. */ +  char *ifname; +  unsigned int ifindex; + +  enum nexthop_types_t type; + +  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. */ +#define NEXTHOP_FLAG_ONLINK     (1 << 3) /* Nexthop should be installed onlink. */ +#define NEXTHOP_FLAG_MATCHED    (1 << 4) /* Already matched vs a nexthop */ + +  /* Nexthop address */ +  union g_addr gate; +  union g_addr src; + +  /* 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; +}; + +#define nexthop_new()                                                   \ +({                                                                      \ +  struct nexthop *n = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop)); \ +  n;                                                                    \ +}) + +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); + +#endif /*_LIB_NEXTHOP_H */  | 
