]>
Commit | Line | Data |
---|---|---|
28f6dde8 DS |
1 | /* |
2 | * Static Routing Information header | |
3 | * Copyright (C) 2016 Cumulus Networks | |
4 | * Donald Sharp | |
5 | * | |
6 | * This file is part of Quagga. | |
7 | * | |
8 | * Quagga is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * Quagga is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with Quagga; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
21 | * 02111-1307, USA. | |
22 | */ | |
23 | #ifndef __ZEBRA_STATIC_H__ | |
24 | #define __ZEBRA_STATIC_H__ | |
25 | ||
a22f3f5d | 26 | /* Static route label information */ |
ac4d0be5 | 27 | struct static_nh_label { |
28 | u_int8_t num_labels; | |
29 | u_int8_t reserved[3]; | |
30 | mpls_label_t label[2]; | |
a22f3f5d | 31 | }; |
32 | ||
4b2792b5 | 33 | typedef enum { |
ac4d0be5 | 34 | STATIC_IFNAME, |
35 | STATIC_IPV4_GATEWAY, | |
36 | STATIC_BLACKHOLE, | |
37 | STATIC_IPV6_GATEWAY, | |
38 | STATIC_IPV6_GATEWAY_IFNAME, | |
4b2792b5 DS |
39 | } zebra_static_types; |
40 | ||
28f6dde8 | 41 | /* Static route information. */ |
ac4d0be5 | 42 | struct static_route { |
43 | /* For linked list. */ | |
44 | struct static_route *prev; | |
45 | struct static_route *next; | |
46 | ||
47 | /* VRF identifier. */ | |
48 | vrf_id_t vrf_id; | |
49 | ||
50 | /* Administrative distance. */ | |
51 | u_char distance; | |
52 | ||
53 | /* Tag */ | |
54 | route_tag_t tag; | |
55 | ||
56 | /* Flag for this static route's type. */ | |
57 | zebra_static_types type; | |
58 | ||
59 | /* | |
60 | * Nexthop value. | |
61 | * | |
62 | * Under IPv4 addr and ifindex are | |
63 | * used independentyly. | |
64 | * STATIC_IPV4_GATEWAY uses addr | |
65 | * STATIC_IFNAME uses ifindex | |
66 | */ | |
67 | union g_addr addr; | |
68 | ifindex_t ifindex; | |
69 | ||
70 | char ifname[INTERFACE_NAMSIZ + 1]; | |
71 | ||
72 | /* bit flags */ | |
73 | u_char flags; | |
74 | /* | |
75 | see ZEBRA_FLAG_REJECT | |
76 | ZEBRA_FLAG_BLACKHOLE | |
77 | */ | |
78 | ||
79 | /* Label information */ | |
80 | struct static_nh_label snh_label; | |
28f6dde8 DS |
81 | }; |
82 | ||
ac4d0be5 | 83 | extern void static_install_route(afi_t afi, safi_t safi, struct prefix *p, |
84 | struct prefix_ipv6 *src_p, | |
85 | struct static_route *si); | |
86 | extern void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, | |
87 | struct prefix_ipv6 *src_p, | |
88 | struct static_route *si); | |
89 | ||
90 | extern int static_add_route(afi_t, safi_t safi, u_char type, struct prefix *p, | |
91 | struct prefix_ipv6 *src_p, union g_addr *gate, | |
92 | const char *ifname, u_char flags, route_tag_t tag, | |
93 | u_char distance, struct zebra_vrf *zvrf, | |
94 | struct static_nh_label *snh_label); | |
95 | ||
96 | extern int static_delete_route(afi_t, safi_t safi, u_char type, | |
97 | struct prefix *p, struct prefix_ipv6 *src_p, | |
98 | union g_addr *gate, const char *ifname, | |
99 | route_tag_t tag, u_char distance, | |
100 | struct zebra_vrf *zvrf, | |
101 | struct static_nh_label *snh_label); | |
102 | ||
103 | int zebra_static_ipv4(struct vty *vty, safi_t safi, int add_cmd, | |
104 | const char *dest_str, const char *mask_str, | |
105 | const char *gate_str, const char *flag_str, | |
106 | const char *tag_str, const char *distance_str, | |
107 | const char *vrf_id_str, const char *label_str); | |
108 | ||
109 | int static_ipv6_func(struct vty *vty, int add_cmd, const char *dest_str, | |
110 | const char *src_str, const char *gate_str, | |
111 | const char *ifname, const char *flag_str, | |
112 | const char *tag_str, const char *distance_str, | |
113 | const char *vrf_id_str, const char *label_str); | |
28f6dde8 | 114 | |
a3358cac DL |
115 | extern void static_ifindex_update(struct interface *ifp, bool up); |
116 | ||
28f6dde8 | 117 | #endif |