]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_rnh.h
zebra: add packet length into pbr support
[mirror_frr.git] / zebra / zebra_rnh.h
CommitLineData
fb018d25
DS
1/*
2 * Zebra next hop tracking header
3 * Copyright (C) 2013 Cumulus Networks, Inc.
4 *
5 * This file is part of GNU Zebra.
6 *
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
10 * later version.
11 *
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.
16 *
896014f4
DL
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fb018d25
DS
20 */
21
22#ifndef _ZEBRA_RNH_H
23#define _ZEBRA_RNH_H
24
25#include "prefix.h"
26#include "vty.h"
27
28/* Nexthop structure. */
d62a17ae 29struct rnh {
d7c0a89a 30 uint8_t flags;
078430f6 31
fc9a856f 32#define ZEBRA_NHT_CONNECTED 0x1
70c0f184 33#define ZEBRA_NHT_DELETED 0x2
078430f6
DS
34#define ZEBRA_NHT_EXACT_MATCH 0x4
35
d62a17ae 36 /* VRF identifier. */
37 vrf_id_t vrf_id;
d82ae0de 38
d62a17ae 39 struct route_entry *state;
40 struct prefix resolved_route;
41 struct list *client_list;
996c9314
LB
42 struct list
43 *zebra_static_route_list; /* static routes dependent on this NH
44 */
731a75fe
RW
45 struct list
46 *zebra_pseudowire_list; /* pseudowires dependent on this NH */
d62a17ae 47 struct route_node *node;
48 int filtered[ZEBRA_ROUTE_MAX]; /* if this has been filtered for client
9d303b37 49 */
fb018d25
DS
50};
51
d62a17ae 52typedef enum { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE } rnh_type_t;
078430f6 53
a50b580a
DS
54extern int zebra_rnh_ip_default_route;
55extern int zebra_rnh_ipv6_default_route;
56
453844ab
QY
57extern void zebra_rnh_init(void);
58
44bdf159
DS
59static inline int rnh_resolve_via_default(int family)
60{
61 if (((family == AF_INET) && zebra_rnh_ip_default_route)
62 || ((family == AF_INET6) && zebra_rnh_ipv6_default_route))
63 return 1;
64 else
65 return 0;
66}
67
b72ede27 68extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid,
078430f6 69 rnh_type_t type);
b72ede27 70extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid,
078430f6 71 rnh_type_t type);
d62a17ae 72extern void zebra_free_rnh(struct rnh *rnh);
078430f6 73extern void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type);
d62a17ae 74extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
75 rnh_type_t type, vrf_id_t vrfid);
76extern void zebra_register_rnh_static_nh(vrf_id_t, struct prefix *,
77 struct route_node *);
78extern void zebra_deregister_rnh_static_nexthops(vrf_id_t,
79 struct nexthop *nexthop,
80 struct route_node *rn);
81extern void zebra_deregister_rnh_static_nh(vrf_id_t, struct prefix *,
82 struct route_node *);
731a75fe
RW
83extern void zebra_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
84extern void zebra_deregister_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
078430f6
DS
85extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
86 rnh_type_t type);
d62a17ae 87extern void zebra_evaluate_rnh(vrf_id_t vrfid, int family, int force,
88 rnh_type_t type, struct prefix *p);
89extern void zebra_print_rnh_table(vrf_id_t vrfid, int family, struct vty *vty,
90 rnh_type_t);
fb018d25 91extern char *rnh_str(struct rnh *rnh, char *buf, int size);
fb018d25 92#endif /*_ZEBRA_RNH_H */