Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | /* Interface related header. |
3 | | * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro |
4 | | */ |
5 | | |
6 | | #ifndef _ZEBRA_IF_H |
7 | | #define _ZEBRA_IF_H |
8 | | |
9 | | #include "zebra.h" |
10 | | #include "linklist.h" |
11 | | #include "memory.h" |
12 | | #include "qobj.h" |
13 | | #include "hook.h" |
14 | | #include "admin_group.h" |
15 | | |
16 | | #ifdef __cplusplus |
17 | | extern "C" { |
18 | | #endif |
19 | | |
20 | | DECLARE_MTYPE(CONNECTED_LABEL); |
21 | | |
22 | | /* Interface link-layer type, if known. Derived from: |
23 | | * |
24 | | * net/if_arp.h on various platforms - Linux especially. |
25 | | * http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml |
26 | | * |
27 | | * Some of the more obviously defunct technologies left out. |
28 | | */ |
29 | | enum zebra_link_type { |
30 | | ZEBRA_LLT_UNKNOWN = 0, |
31 | | ZEBRA_LLT_ETHER, |
32 | | ZEBRA_LLT_EETHER, |
33 | | ZEBRA_LLT_AX25, |
34 | | ZEBRA_LLT_PRONET, |
35 | | ZEBRA_LLT_IEEE802, |
36 | | ZEBRA_LLT_ARCNET, |
37 | | ZEBRA_LLT_APPLETLK, |
38 | | ZEBRA_LLT_DLCI, |
39 | | ZEBRA_LLT_ATM, |
40 | | ZEBRA_LLT_METRICOM, |
41 | | ZEBRA_LLT_IEEE1394, |
42 | | ZEBRA_LLT_EUI64, |
43 | | ZEBRA_LLT_INFINIBAND, |
44 | | ZEBRA_LLT_SLIP, |
45 | | ZEBRA_LLT_CSLIP, |
46 | | ZEBRA_LLT_SLIP6, |
47 | | ZEBRA_LLT_CSLIP6, |
48 | | ZEBRA_LLT_RSRVD, |
49 | | ZEBRA_LLT_ADAPT, |
50 | | ZEBRA_LLT_ROSE, |
51 | | ZEBRA_LLT_X25, |
52 | | ZEBRA_LLT_PPP, |
53 | | ZEBRA_LLT_CHDLC, |
54 | | ZEBRA_LLT_LAPB, |
55 | | ZEBRA_LLT_RAWHDLC, |
56 | | ZEBRA_LLT_IPIP, |
57 | | ZEBRA_LLT_IPIP6, |
58 | | ZEBRA_LLT_FRAD, |
59 | | ZEBRA_LLT_SKIP, |
60 | | ZEBRA_LLT_LOOPBACK, |
61 | | ZEBRA_LLT_LOCALTLK, |
62 | | ZEBRA_LLT_FDDI, |
63 | | ZEBRA_LLT_SIT, |
64 | | ZEBRA_LLT_IPDDP, |
65 | | ZEBRA_LLT_IPGRE, |
66 | | ZEBRA_LLT_IP6GRE, |
67 | | ZEBRA_LLT_PIMREG, |
68 | | ZEBRA_LLT_HIPPI, |
69 | | ZEBRA_LLT_ECONET, |
70 | | ZEBRA_LLT_IRDA, |
71 | | ZEBRA_LLT_FCPP, |
72 | | ZEBRA_LLT_FCAL, |
73 | | ZEBRA_LLT_FCPL, |
74 | | ZEBRA_LLT_FCFABRIC, |
75 | | ZEBRA_LLT_IEEE802_TR, |
76 | | ZEBRA_LLT_IEEE80211, |
77 | | ZEBRA_LLT_IEEE80211_RADIOTAP, |
78 | | ZEBRA_LLT_IEEE802154, |
79 | | ZEBRA_LLT_IEEE802154_PHY, |
80 | | }; |
81 | | |
82 | | /* |
83 | | Interface name length. |
84 | | |
85 | | Linux define value in /usr/include/linux/if.h. |
86 | | #define IFNAMSIZ 16 |
87 | | |
88 | | FreeBSD define value in /usr/include/net/if.h. |
89 | | #define IFNAMSIZ 16 |
90 | | */ |
91 | | |
92 | 10 | #define INTERFACE_NAMSIZ IFNAMSIZ |
93 | 0 | #define INTERFACE_HWADDR_MAX 20 |
94 | | |
95 | | typedef signed int ifindex_t; |
96 | | |
97 | | #ifdef HAVE_PROC_NET_DEV |
98 | | struct if_stats { |
99 | | unsigned long rx_packets; /* total packets received */ |
100 | | unsigned long tx_packets; /* total packets transmitted */ |
101 | | unsigned long rx_bytes; /* total bytes received */ |
102 | | unsigned long tx_bytes; /* total bytes transmitted */ |
103 | | unsigned long rx_errors; /* bad packets received */ |
104 | | unsigned long tx_errors; /* packet transmit problems */ |
105 | | unsigned long rx_dropped; /* no space in linux buffers */ |
106 | | unsigned long tx_dropped; /* no space available in linux */ |
107 | | unsigned long rx_multicast; /* multicast packets received */ |
108 | | unsigned long rx_compressed; |
109 | | unsigned long tx_compressed; |
110 | | unsigned long collisions; |
111 | | |
112 | | /* detailed rx_errors: */ |
113 | | unsigned long rx_length_errors; |
114 | | unsigned long rx_over_errors; /* receiver ring buff overflow */ |
115 | | unsigned long rx_crc_errors; /* recved pkt with crc error */ |
116 | | unsigned long rx_frame_errors; /* recv'd frame alignment error */ |
117 | | unsigned long rx_fifo_errors; /* recv'r fifo overrun */ |
118 | | unsigned long rx_missed_errors; /* receiver missed packet */ |
119 | | /* detailed tx_errors */ |
120 | | unsigned long tx_aborted_errors; |
121 | | unsigned long tx_carrier_errors; |
122 | | unsigned long tx_fifo_errors; |
123 | | unsigned long tx_heartbeat_errors; |
124 | | unsigned long tx_window_errors; |
125 | | }; |
126 | | #endif /* HAVE_PROC_NET_DEV */ |
127 | | |
128 | | /* Here are "non-official" architectural constants. */ |
129 | 0 | #define TE_EXT_MASK 0x00FFFFFF |
130 | 0 | #define TE_EXT_ANORMAL 0x80000000 |
131 | 0 | #define LOSS_PRECISION 0.000003 |
132 | | /* TE_MEGA_BIT and TE_BYTE are utilized to convert TE bandwidth */ |
133 | 0 | #define TE_MEGA_BIT 1000000 |
134 | 0 | #define TE_BYTE 8 |
135 | | /* Default TE bandwidth when no value in config. |
136 | | * The value is in Mbps (will be multiplied by TE_BYTE) |
137 | | */ |
138 | 0 | #define DEFAULT_BANDWIDTH 10 |
139 | 0 | #define MAX_CLASS_TYPE 8 |
140 | 0 | #define MAX_PKT_LOSS 50.331642 |
141 | | |
142 | | enum affinity_mode { |
143 | | /* RFC7308 Extended Administrative group */ |
144 | | AFFINITY_MODE_EXTENDED = 0, |
145 | | /* RFC3630/RFC5305/RFC5329 Administrative group */ |
146 | | AFFINITY_MODE_STANDARD = 1, |
147 | | /* Standard and Extended Administrative group */ |
148 | | AFFINITY_MODE_BOTH = 2, |
149 | | }; |
150 | | |
151 | | /* |
152 | | * Link Parameters Status: |
153 | | * equal to 0: unset |
154 | | * different from 0: set |
155 | | */ |
156 | 0 | #define LP_UNSET 0x0000 |
157 | 0 | #define LP_TE_METRIC 0x0001 |
158 | 0 | #define LP_MAX_BW 0x0002 |
159 | 0 | #define LP_MAX_RSV_BW 0x0004 |
160 | 0 | #define LP_UNRSV_BW 0x0008 |
161 | | #define LP_ADM_GRP 0x0010 |
162 | | #define LP_RMT_AS 0x0020 |
163 | | #define LP_DELAY 0x0040 |
164 | | #define LP_MM_DELAY 0x0080 |
165 | 0 | #define LP_DELAY_VAR 0x0100 |
166 | 0 | #define LP_PKT_LOSS 0x0200 |
167 | 0 | #define LP_RES_BW 0x0400 |
168 | 0 | #define LP_AVA_BW 0x0800 |
169 | 0 | #define LP_USE_BW 0x1000 |
170 | | #define LP_EXTEND_ADM_GRP 0x2000 |
171 | | |
172 | 0 | #define IS_PARAM_UNSET(lp, st) !(lp->lp_status & st) |
173 | 0 | #define IS_PARAM_SET(lp, st) (lp->lp_status & st) |
174 | 0 | #define IS_LINK_PARAMS_SET(lp) (lp->lp_status != LP_UNSET) |
175 | | |
176 | 0 | #define SET_PARAM(lp, st) (lp->lp_status) |= (st) |
177 | 0 | #define UNSET_PARAM(lp, st) (lp->lp_status) &= ~(st) |
178 | | #define RESET_LINK_PARAM(lp) (lp->lp_status = LP_UNSET) |
179 | | |
180 | | /* Link Parameters for Traffic Engineering |
181 | | * Do not forget to update if_link_params_copy() |
182 | | * and if_link_params_cmp() when updating the structure |
183 | | */ |
184 | | struct if_link_params { |
185 | | uint32_t lp_status; /* Status of Link Parameters: */ |
186 | | uint32_t te_metric; /* Traffic Engineering metric */ |
187 | | float default_bw; |
188 | | float max_bw; /* Maximum Bandwidth */ |
189 | | float max_rsv_bw; /* Maximum Reservable Bandwidth */ |
190 | | float unrsv_bw[MAX_CLASS_TYPE]; /* Unreserved Bandwidth per Class Type |
191 | | (8) */ |
192 | | uint32_t admin_grp; /* RFC5305/RFC5329 Administrative group */ |
193 | | struct admin_group ext_admin_grp; /* RFC7308 Extended Admin group */ |
194 | | uint32_t rmt_as; /* Remote AS number */ |
195 | | struct in_addr rmt_ip; /* Remote IP address */ |
196 | | uint32_t av_delay; /* Link Average Delay */ |
197 | | uint32_t min_delay; /* Link Min Delay */ |
198 | | uint32_t max_delay; /* Link Max Delay */ |
199 | | uint32_t delay_var; /* Link Delay Variation */ |
200 | | float pkt_loss; /* Link Packet Loss */ |
201 | | float res_bw; /* Residual Bandwidth */ |
202 | | float ava_bw; /* Available Bandwidth */ |
203 | | float use_bw; /* Utilized Bandwidth */ |
204 | | }; |
205 | | |
206 | | #define INTERFACE_LINK_PARAMS_SIZE sizeof(struct if_link_params) |
207 | 1 | #define HAS_LINK_PARAMS(ifp) ((ifp)->link_params != NULL) |
208 | | |
209 | | /* Interface structure */ |
210 | | struct interface { |
211 | | RB_ENTRY(interface) name_entry, index_entry; |
212 | | |
213 | | /* Interface name. This should probably never be changed after the |
214 | | interface is created, because the configuration info for this |
215 | | interface |
216 | | is associated with this structure. For that reason, the interface |
217 | | should also never be deleted (to avoid losing configuration info). |
218 | | To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the |
219 | | interface does not exist in the kernel. |
220 | | */ |
221 | | char name[INTERFACE_NAMSIZ]; |
222 | | |
223 | | /* Interface index (should be IFINDEX_INTERNAL for non-kernel or |
224 | | deleted interfaces). |
225 | | WARNING: the ifindex needs to be changed using the if_set_index() |
226 | | function. Failure to respect this will cause corruption in the data |
227 | | structure used to store the interfaces and if_lookup_by_index() will |
228 | | not work as expected. |
229 | | */ |
230 | | ifindex_t ifindex; |
231 | | ifindex_t oldifindex; |
232 | | |
233 | | /* |
234 | | * ifindex of parent interface, if any |
235 | | */ |
236 | | ifindex_t link_ifindex; |
237 | 5 | #define IFINDEX_INTERNAL 0 |
238 | | |
239 | | /* Zebra internal interface status */ |
240 | | uint8_t status; |
241 | | #define ZEBRA_INTERFACE_ACTIVE (1 << 0) |
242 | | #define ZEBRA_INTERFACE_SUB (1 << 1) |
243 | | #define ZEBRA_INTERFACE_LINKDETECTION (1 << 2) |
244 | | #define ZEBRA_INTERFACE_VRF_LOOPBACK (1 << 3) |
245 | | |
246 | | /* Interface flags. */ |
247 | | uint64_t flags; |
248 | | |
249 | | /* Interface metric */ |
250 | | uint32_t metric; |
251 | | |
252 | | /* Interface Speed in Mb/s */ |
253 | | uint32_t speed; |
254 | | |
255 | | /* Interface MTU. */ |
256 | | unsigned int mtu; /* IPv4 MTU */ |
257 | | unsigned int |
258 | | mtu6; /* IPv6 MTU - probably, but not necessarily same as mtu |
259 | | */ |
260 | | |
261 | | /* Link-layer information and hardware address */ |
262 | | enum zebra_link_type ll_type; |
263 | | uint8_t hw_addr[INTERFACE_HWADDR_MAX]; |
264 | | int hw_addr_len; |
265 | | |
266 | | /* interface bandwidth, kbits */ |
267 | | unsigned int bandwidth; |
268 | | |
269 | | /* Link parameters for Traffic Engineering */ |
270 | | struct if_link_params *link_params; |
271 | | |
272 | | /* description of the interface. */ |
273 | | char *desc; |
274 | | |
275 | | /* Distribute list. */ |
276 | | void *distribute_in; |
277 | | void *distribute_out; |
278 | | |
279 | | /* Connected address list. */ |
280 | | struct list *connected; |
281 | | |
282 | | /* Neighbor connected address list. */ |
283 | | struct list *nbr_connected; |
284 | | |
285 | | /* Daemon specific interface data pointer. */ |
286 | | void *info; |
287 | | |
288 | | char ptm_enable; /* Should we look at ptm_status ? */ |
289 | | char ptm_status; |
290 | | |
291 | | /* Statistics fileds. */ |
292 | | #ifdef HAVE_PROC_NET_DEV |
293 | | struct if_stats stats; |
294 | | #endif /* HAVE_PROC_NET_DEV */ |
295 | | #ifdef HAVE_NET_RT_IFLIST |
296 | | struct if_data stats; |
297 | | #endif /* HAVE_NET_RT_IFLIST */ |
298 | | |
299 | | struct route_node *node; |
300 | | |
301 | | struct vrf *vrf; |
302 | | |
303 | | /* |
304 | | * Has the end users entered `interface XXXX` from the cli in some |
305 | | * fashion? |
306 | | */ |
307 | | bool configured; |
308 | | |
309 | | QOBJ_FIELDS; |
310 | | }; |
311 | | |
312 | | RB_HEAD(if_name_head, interface); |
313 | | RB_PROTOTYPE(if_name_head, interface, name_entry, if_cmp_func) |
314 | | RB_HEAD(if_index_head, interface); |
315 | | RB_PROTOTYPE(if_index_head, interface, index_entry, if_cmp_index_func) |
316 | | DECLARE_QOBJ_TYPE(interface); |
317 | | |
318 | | #define IFNAME_RB_INSERT(v, ifp) \ |
319 | 3 | ({ \ |
320 | 3 | struct interface *_iz = \ |
321 | 3 | RB_INSERT(if_name_head, &v->ifaces_by_name, (ifp)); \ |
322 | 3 | if (_iz) \ |
323 | 3 | flog_err( \ |
324 | 3 | EC_LIB_INTERFACE, \ |
325 | 3 | "%s(%s): corruption detected -- interface with this " \ |
326 | 3 | "name exists already in VRF %s!", \ |
327 | 3 | __func__, (ifp)->name, (ifp)->vrf->name); \ |
328 | 3 | _iz; \ |
329 | 3 | }) |
330 | | |
331 | | #define IFNAME_RB_REMOVE(v, ifp) \ |
332 | 0 | ({ \ |
333 | 0 | struct interface *_iz = \ |
334 | 0 | RB_REMOVE(if_name_head, &v->ifaces_by_name, (ifp)); \ |
335 | 0 | if (_iz == NULL) \ |
336 | 0 | flog_err( \ |
337 | 0 | EC_LIB_INTERFACE, \ |
338 | 0 | "%s(%s): corruption detected -- interface with this " \ |
339 | 0 | "name doesn't exist in VRF %s!", \ |
340 | 0 | __func__, (ifp)->name, (ifp)->vrf->name); \ |
341 | 0 | _iz; \ |
342 | 0 | }) |
343 | | |
344 | | |
345 | | #define IFINDEX_RB_INSERT(v, ifp) \ |
346 | 1 | ({ \ |
347 | 1 | struct interface *_iz = \ |
348 | 1 | RB_INSERT(if_index_head, &v->ifaces_by_index, (ifp)); \ |
349 | 1 | if (_iz) \ |
350 | 1 | flog_err( \ |
351 | 1 | EC_LIB_INTERFACE, \ |
352 | 1 | "%s(%u): corruption detected -- interface with this " \ |
353 | 1 | "ifindex exists already in VRF %s!", \ |
354 | 1 | __func__, (ifp)->ifindex, (ifp)->vrf->name); \ |
355 | 1 | _iz; \ |
356 | 1 | }) |
357 | | |
358 | | #define IFINDEX_RB_REMOVE(v, ifp) \ |
359 | 0 | ({ \ |
360 | 0 | struct interface *_iz = \ |
361 | 0 | RB_REMOVE(if_index_head, &v->ifaces_by_index, (ifp)); \ |
362 | 0 | if (_iz == NULL) \ |
363 | 0 | flog_err( \ |
364 | 0 | EC_LIB_INTERFACE, \ |
365 | 0 | "%s(%u): corruption detected -- interface with this " \ |
366 | 0 | "ifindex doesn't exist in VRF %s!", \ |
367 | 0 | __func__, (ifp)->ifindex, (ifp)->vrf->name); \ |
368 | 0 | _iz; \ |
369 | 0 | }) |
370 | | |
371 | | #define FOR_ALL_INTERFACES(vrf, ifp) \ |
372 | 74.2k | if (vrf) \ |
373 | 74.2k | RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name) |
374 | | |
375 | | #define FOR_ALL_INTERFACES_ADDRESSES(ifp, connected, node) \ |
376 | | for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, connected)) |
377 | | |
378 | | /* called from the library code whenever interfaces are created/deleted |
379 | | * note: interfaces may not be fully realized at that point; also they |
380 | | * may not exist in the system (ifindex = IFINDEX_INTERNAL) |
381 | | * |
382 | | * priority values are important here, daemons should be at 0 while modules |
383 | | * can use 1000+ so they run after the daemon has initialised daemon-specific |
384 | | * interface data |
385 | | */ |
386 | | DECLARE_HOOK(if_add, (struct interface * ifp), (ifp)); |
387 | | DECLARE_KOOH(if_del, (struct interface * ifp), (ifp)); |
388 | | |
389 | 0 | #define METRIC_MAX (~0) |
390 | | |
391 | | /* Connected address structure. */ |
392 | | struct connected { |
393 | | /* Attached interface. */ |
394 | | struct interface *ifp; |
395 | | |
396 | | /* Flags for configuration. */ |
397 | | uint8_t conf; |
398 | | #define ZEBRA_IFC_REAL (1 << 0) |
399 | | #define ZEBRA_IFC_CONFIGURED (1 << 1) |
400 | | #define ZEBRA_IFC_QUEUED (1 << 2) |
401 | | #define ZEBRA_IFC_DOWN (1 << 3) |
402 | | /* |
403 | | The ZEBRA_IFC_REAL flag should be set if and only if this address |
404 | | exists in the kernel and is actually usable. (A case where it exists |
405 | | but is not yet usable would be IPv6 with DAD) |
406 | | The ZEBRA_IFC_CONFIGURED flag should be set if and only if this |
407 | | address was configured by the user from inside frr. |
408 | | The ZEBRA_IFC_QUEUED flag should be set if and only if the address |
409 | | exists in the kernel. It may and should be set although the |
410 | | address might not be usable yet. (compare with ZEBRA_IFC_REAL) |
411 | | The ZEBRA_IFC_DOWN flag is used to record that an address is |
412 | | present, but down/unavailable. |
413 | | */ |
414 | | |
415 | | /* Flags for connected address. */ |
416 | | uint8_t flags; |
417 | | #define ZEBRA_IFA_SECONDARY (1 << 0) |
418 | | #define ZEBRA_IFA_PEER (1 << 1) |
419 | | #define ZEBRA_IFA_UNNUMBERED (1 << 2) |
420 | | /* N.B. the ZEBRA_IFA_PEER flag should be set if and only if |
421 | | a peer address has been configured. If this flag is set, |
422 | | the destination field must contain the peer address. |
423 | | */ |
424 | | |
425 | | /* Address of connected network. */ |
426 | | struct prefix *address; |
427 | | |
428 | | /* Peer address, if ZEBRA_IFA_PEER is set, otherwise NULL */ |
429 | | struct prefix *destination; |
430 | | |
431 | | /* Label for Linux 2.2.X and upper. */ |
432 | | char *label; |
433 | | |
434 | | /* |
435 | | * Used for setting the connected route's cost. If the metric |
436 | | * here is set to METRIC_MAX the connected route falls back to |
437 | | * "struct interface" |
438 | | */ |
439 | | uint32_t metric; |
440 | | }; |
441 | | |
442 | | /* Nbr Connected address structure. */ |
443 | | struct nbr_connected { |
444 | | /* Attached interface. */ |
445 | | struct interface *ifp; |
446 | | |
447 | | /* Address of connected network. */ |
448 | | struct prefix *address; |
449 | | }; |
450 | | |
451 | | /* Does the destination field contain a peer address? */ |
452 | 2.92k | #define CONNECTED_PEER(C) CHECK_FLAG((C)->flags, ZEBRA_IFA_PEER) |
453 | | |
454 | | /* Prefix to insert into the RIB */ |
455 | | #define CONNECTED_PREFIX(C) \ |
456 | 2.92k | (CONNECTED_PEER(C) ? (C)->destination : (C)->address) |
457 | | |
458 | | /* Identifying address. We guess that if there's a peer address, but the |
459 | | local address is in the same prefix, then the local address may be unique. */ |
460 | | #define CONNECTED_ID(C) \ |
461 | | ((CONNECTED_PEER(C) && !prefix_match((C)->destination, (C)->address)) \ |
462 | | ? (C)->destination \ |
463 | | : (C)->address) |
464 | | |
465 | | /* There are some interface flags which are only supported by some |
466 | | operating system. */ |
467 | | |
468 | | #ifndef IFF_NOTRAILERS |
469 | | #define IFF_NOTRAILERS 0x0 |
470 | | #endif /* IFF_NOTRAILERS */ |
471 | | #ifndef IFF_OACTIVE |
472 | | #define IFF_OACTIVE 0x0 |
473 | | #endif /* IFF_OACTIVE */ |
474 | | #ifndef IFF_SIMPLEX |
475 | | #define IFF_SIMPLEX 0x0 |
476 | | #endif /* IFF_SIMPLEX */ |
477 | | #ifndef IFF_LINK0 |
478 | | #define IFF_LINK0 0x0 |
479 | | #endif /* IFF_LINK0 */ |
480 | | #ifndef IFF_LINK1 |
481 | | #define IFF_LINK1 0x0 |
482 | | #endif /* IFF_LINK1 */ |
483 | | #ifndef IFF_LINK2 |
484 | | #define IFF_LINK2 0x0 |
485 | | #endif /* IFF_LINK2 */ |
486 | | #ifndef IFF_NOXMIT |
487 | 5.71k | #define IFF_NOXMIT 0x0 |
488 | | #endif /* IFF_NOXMIT */ |
489 | | #ifndef IFF_NORTEXCH |
490 | | #define IFF_NORTEXCH 0x0 |
491 | | #endif /* IFF_NORTEXCH */ |
492 | | #ifndef IFF_IPV4 |
493 | | #define IFF_IPV4 0x0 |
494 | | #endif /* IFF_IPV4 */ |
495 | | #ifndef IFF_IPV6 |
496 | | #define IFF_IPV6 0x0 |
497 | | #endif /* IFF_IPV6 */ |
498 | | #ifndef IFF_VIRTUAL |
499 | 5.71k | #define IFF_VIRTUAL 0x0 |
500 | | #endif /* IFF_VIRTUAL */ |
501 | | |
502 | | /* Prototypes. */ |
503 | | extern int if_cmp_name_func(const char *p1, const char *p2); |
504 | | |
505 | | /* |
506 | | * Passing in VRF_UNKNOWN is a valid thing to do, unless we |
507 | | * are creating a new interface. |
508 | | * |
509 | | * This is useful for vrf route-leaking. So more than anything |
510 | | * else think before you use VRF_UNKNOWN |
511 | | */ |
512 | | extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id); |
513 | | |
514 | | extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id); |
515 | | extern struct interface *if_vrf_lookup_by_index_next(ifindex_t ifindex, |
516 | | vrf_id_t vrf_id); |
517 | | extern struct interface *if_lookup_address_local(const void *matchaddr, |
518 | | int family, vrf_id_t vrf_id); |
519 | | extern struct connected *if_lookup_address(const void *matchaddr, int family, |
520 | | vrf_id_t vrf_id); |
521 | | extern struct interface *if_lookup_prefix(const struct prefix *prefix, |
522 | | vrf_id_t vrf_id); |
523 | | size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz, |
524 | | struct interface ***result, vrf_id_t vrf_id); |
525 | | |
526 | | static inline bool if_address_is_local(const void *matchaddr, int family, |
527 | | vrf_id_t vrf_id) |
528 | 1.15k | { |
529 | 1.15k | return if_lookup_address_local(matchaddr, family, vrf_id) != NULL; |
530 | 1.15k | } Unexecuted instantiation: ospf_main.c:if_address_is_local Unexecuted instantiation: frr-ospf-route-map.yang.c:if_address_is_local Unexecuted instantiation: ospf_bfd.c:if_address_is_local Unexecuted instantiation: ospf_dump.c:if_address_is_local Unexecuted instantiation: ospf_dump_api.c:if_address_is_local Unexecuted instantiation: ospf_errors.c:if_address_is_local Unexecuted instantiation: ospf_interface.c:if_address_is_local Unexecuted instantiation: ospf_lsa.c:if_address_is_local Unexecuted instantiation: ospf_lsdb.c:if_address_is_local Unexecuted instantiation: ospf_neighbor.c:if_address_is_local Unexecuted instantiation: ospf_network.c:if_address_is_local Unexecuted instantiation: ospf_nsm.c:if_address_is_local Unexecuted instantiation: ospf_opaque.c:if_address_is_local Unexecuted instantiation: ospf_packet.c:if_address_is_local Unexecuted instantiation: ospf_ri.c:if_address_is_local Unexecuted instantiation: ospf_routemap.c:if_address_is_local Unexecuted instantiation: ospf_routemap_nb.c:if_address_is_local Unexecuted instantiation: ospf_routemap_nb_config.c:if_address_is_local Unexecuted instantiation: ospf_spf.c:if_address_is_local Unexecuted instantiation: ospf_ti_lfa.c:if_address_is_local Unexecuted instantiation: ospf_sr.c:if_address_is_local Unexecuted instantiation: ospf_te.c:if_address_is_local Unexecuted instantiation: ospf_vty.c:if_address_is_local Unexecuted instantiation: ospf_zebra.c:if_address_is_local Unexecuted instantiation: ospfd.c:if_address_is_local Unexecuted instantiation: ospf_gr_helper.c:if_address_is_local Unexecuted instantiation: ospf_abr.c:if_address_is_local Unexecuted instantiation: ospf_apiserver.c:if_address_is_local Unexecuted instantiation: ospf_asbr.c:if_address_is_local Unexecuted instantiation: ospf_ase.c:if_address_is_local Unexecuted instantiation: ospf_ext.c:if_address_is_local Unexecuted instantiation: ospf_flood.c:if_address_is_local Unexecuted instantiation: ospf_gr.c:if_address_is_local Unexecuted instantiation: ospf_ia.c:if_address_is_local Unexecuted instantiation: ospf_ism.c:if_address_is_local Unexecuted instantiation: ospf_ldp_sync.c:if_address_is_local Unexecuted instantiation: ospf_route.c:if_address_is_local Unexecuted instantiation: ospf_api.c:if_address_is_local Unexecuted instantiation: affinitymap.c:if_address_is_local Unexecuted instantiation: affinitymap_cli.c:if_address_is_local Unexecuted instantiation: affinitymap_northbound.c:if_address_is_local Unexecuted instantiation: agg_table.c:if_address_is_local Unexecuted instantiation: asn.c:if_address_is_local Unexecuted instantiation: bfd.c:if_address_is_local Unexecuted instantiation: buffer.c:if_address_is_local Unexecuted instantiation: command.c:if_address_is_local Unexecuted instantiation: command_graph.c:if_address_is_local Unexecuted instantiation: command_match.c:if_address_is_local Unexecuted instantiation: cspf.c:if_address_is_local Unexecuted instantiation: debug.c:if_address_is_local Unexecuted instantiation: distribute.c:if_address_is_local Unexecuted instantiation: ferr.c:if_address_is_local Unexecuted instantiation: filter.c:if_address_is_local Unexecuted instantiation: filter_cli.c:if_address_is_local Unexecuted instantiation: filter_nb.c:if_address_is_local Unexecuted instantiation: flex_algo.c:if_address_is_local Unexecuted instantiation: frr_pthread.c:if_address_is_local Unexecuted instantiation: grammar_sandbox.c:if_address_is_local Unexecuted instantiation: hash.c:if_address_is_local Unexecuted instantiation: id_alloc.c:if_address_is_local Unexecuted instantiation: if.c:if_address_is_local Unexecuted instantiation: if_rmap.c:if_address_is_local Unexecuted instantiation: json.c:if_address_is_local Unexecuted instantiation: keychain.c:if_address_is_local Unexecuted instantiation: ldp_sync.c:if_address_is_local Unexecuted instantiation: lib_errors.c:if_address_is_local Unexecuted instantiation: lib_vty.c:if_address_is_local Unexecuted instantiation: libfrr.c:if_address_is_local Unexecuted instantiation: link_state.c:if_address_is_local Unexecuted instantiation: log.c:if_address_is_local Unexecuted instantiation: log_vty.c:if_address_is_local Unexecuted instantiation: mgmt_be_client.c:if_address_is_local Unexecuted instantiation: mgmt_fe_client.c:if_address_is_local Unexecuted instantiation: mgmt_msg.c:if_address_is_local Unexecuted instantiation: mlag.c:if_address_is_local Unexecuted instantiation: srv6.c:if_address_is_local Unexecuted instantiation: network.c:if_address_is_local Unexecuted instantiation: nexthop.c:if_address_is_local Unexecuted instantiation: netns_linux.c:if_address_is_local Unexecuted instantiation: nexthop_group.c:if_address_is_local Unexecuted instantiation: northbound.c:if_address_is_local Unexecuted instantiation: northbound_cli.c:if_address_is_local Unexecuted instantiation: northbound_db.c:if_address_is_local Unexecuted instantiation: pid_output.c:if_address_is_local Unexecuted instantiation: plist.c:if_address_is_local Unexecuted instantiation: prefix.c:if_address_is_local Unexecuted instantiation: privs.c:if_address_is_local Unexecuted instantiation: pullwr.c:if_address_is_local Unexecuted instantiation: routemap.c:if_address_is_local Unexecuted instantiation: routemap_cli.c:if_address_is_local Unexecuted instantiation: routemap_northbound.c:if_address_is_local Unexecuted instantiation: sigevent.c:if_address_is_local Unexecuted instantiation: skiplist.c:if_address_is_local Unexecuted instantiation: sockopt.c:if_address_is_local Unexecuted instantiation: sockunion.c:if_address_is_local Unexecuted instantiation: spf_backoff.c:if_address_is_local Unexecuted instantiation: srcdest_table.c:if_address_is_local Unexecuted instantiation: stream.c:if_address_is_local Unexecuted instantiation: systemd.c:if_address_is_local Unexecuted instantiation: table.c:if_address_is_local Unexecuted instantiation: termtable.c:if_address_is_local Unexecuted instantiation: event.c:if_address_is_local Unexecuted instantiation: vrf.c:if_address_is_local Unexecuted instantiation: vty.c:if_address_is_local Unexecuted instantiation: workqueue.c:if_address_is_local Unexecuted instantiation: xref.c:if_address_is_local Unexecuted instantiation: yang.c:if_address_is_local Unexecuted instantiation: yang_translator.c:if_address_is_local Unexecuted instantiation: yang_wrappers.c:if_address_is_local Unexecuted instantiation: zclient.c:if_address_is_local Unexecuted instantiation: zlog_5424.c:if_address_is_local Unexecuted instantiation: zlog_5424_cli.c:if_address_is_local Unexecuted instantiation: routing_nb.c:if_address_is_local Unexecuted instantiation: routing_nb_config.c:if_address_is_local Unexecuted instantiation: tc.c:if_address_is_local Unexecuted instantiation: frr-affinity-map.yang.c:if_address_is_local Unexecuted instantiation: frr-filter.yang.c:if_address_is_local Unexecuted instantiation: frr-if-rmap.yang.c:if_address_is_local Unexecuted instantiation: frr-interface.yang.c:if_address_is_local Unexecuted instantiation: frr-route-map.yang.c:if_address_is_local Unexecuted instantiation: frr-route-types.yang.c:if_address_is_local Unexecuted instantiation: frr-vrf.yang.c:if_address_is_local Unexecuted instantiation: frr-routing.yang.c:if_address_is_local Unexecuted instantiation: frr-nexthop.yang.c:if_address_is_local Unexecuted instantiation: ietf-routing-types.yang.c:if_address_is_local Unexecuted instantiation: ietf-interfaces.yang.c:if_address_is_local Unexecuted instantiation: ietf-bgp-types.yang.c:if_address_is_local Unexecuted instantiation: frr-module-translator.yang.c:if_address_is_local Unexecuted instantiation: connected.c:if_address_is_local Unexecuted instantiation: if_netlink.c:if_address_is_local Unexecuted instantiation: interface.c:if_address_is_local Unexecuted instantiation: ioctl.c:if_address_is_local Unexecuted instantiation: kernel_netlink.c:if_address_is_local Unexecuted instantiation: label_manager.c:if_address_is_local Unexecuted instantiation: main.c:if_address_is_local Unexecuted instantiation: netconf_netlink.c:if_address_is_local Unexecuted instantiation: redistribute.c:if_address_is_local Unexecuted instantiation: router-id.c:if_address_is_local Unexecuted instantiation: rt_netlink.c:if_address_is_local Unexecuted instantiation: rtadv.c:if_address_is_local Unexecuted instantiation: rtread_netlink.c:if_address_is_local Unexecuted instantiation: rule_netlink.c:if_address_is_local Unexecuted instantiation: table_manager.c:if_address_is_local Unexecuted instantiation: tc_netlink.c:if_address_is_local Unexecuted instantiation: zapi_msg.c:if_address_is_local Unexecuted instantiation: zebra_affinitymap.c:if_address_is_local Unexecuted instantiation: zebra_dplane.c:if_address_is_local Unexecuted instantiation: zebra_errors.c:if_address_is_local Unexecuted instantiation: zebra_gr.c:if_address_is_local Unexecuted instantiation: zebra_l2.c:if_address_is_local Unexecuted instantiation: zebra_l2_bridge_if.c:if_address_is_local Unexecuted instantiation: zebra_evpn.c:if_address_is_local Unexecuted instantiation: zebra_evpn_mac.c:if_address_is_local Unexecuted instantiation: zebra_evpn_neigh.c:if_address_is_local Unexecuted instantiation: zebra_mlag.c:if_address_is_local Unexecuted instantiation: zebra_mlag_vty.c:if_address_is_local Unexecuted instantiation: zebra_mpls.c:if_address_is_local Unexecuted instantiation: zebra_mpls_netlink.c:if_address_is_local Unexecuted instantiation: zebra_mpls_null.c:if_address_is_local Unexecuted instantiation: zebra_mpls_vty.c:if_address_is_local Unexecuted instantiation: zebra_srv6.c:if_address_is_local Unexecuted instantiation: zebra_srv6_vty.c:if_address_is_local Unexecuted instantiation: zebra_mroute.c:if_address_is_local Unexecuted instantiation: zebra_nb.c:if_address_is_local Unexecuted instantiation: zebra_nb_config.c:if_address_is_local Unexecuted instantiation: zebra_nb_rpcs.c:if_address_is_local Unexecuted instantiation: zebra_nb_state.c:if_address_is_local Unexecuted instantiation: zebra_netns_id.c:if_address_is_local Unexecuted instantiation: zebra_netns_notify.c:if_address_is_local Unexecuted instantiation: zebra_nhg.c:if_address_is_local Unexecuted instantiation: zebra_ns.c:if_address_is_local Unexecuted instantiation: zebra_opaque.c:if_address_is_local Unexecuted instantiation: zebra_pbr.c:if_address_is_local Unexecuted instantiation: zebra_ptm.c:if_address_is_local Unexecuted instantiation: zebra_ptm_redistribute.c:if_address_is_local Unexecuted instantiation: zebra_pw.c:if_address_is_local Unexecuted instantiation: zebra_rib.c:if_address_is_local Unexecuted instantiation: zebra_router.c:if_address_is_local Unexecuted instantiation: zebra_rnh.c:if_address_is_local Unexecuted instantiation: zebra_routemap.c:if_address_is_local Unexecuted instantiation: zebra_routemap_nb.c:if_address_is_local Unexecuted instantiation: zebra_routemap_nb_config.c:if_address_is_local Unexecuted instantiation: zebra_script.c:if_address_is_local Unexecuted instantiation: zebra_srte.c:if_address_is_local Unexecuted instantiation: zebra_tc.c:if_address_is_local Unexecuted instantiation: zebra_vrf.c:if_address_is_local Unexecuted instantiation: zebra_vty.c:if_address_is_local Unexecuted instantiation: zebra_vxlan.c:if_address_is_local Unexecuted instantiation: zebra_vxlan_if.c:if_address_is_local Unexecuted instantiation: zebra_evpn_mh.c:if_address_is_local Unexecuted instantiation: zebra_neigh.c:if_address_is_local Unexecuted instantiation: zserv.c:if_address_is_local Unexecuted instantiation: debug_nl.c:if_address_is_local Unexecuted instantiation: frr-zebra.yang.c:if_address_is_local Unexecuted instantiation: frr-zebra-route-map.yang.c:if_address_is_local Unexecuted instantiation: bgp_main.c:if_address_is_local Unexecuted instantiation: frr-bgp-types.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-common-structure.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-common.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-common-multiprotocol.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-neighbor.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-peer-group.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-bmp.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-rpki.yang.c:if_address_is_local Unexecuted instantiation: frr-deviations-bgp-datacenter.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-filter.yang.c:if_address_is_local Unexecuted instantiation: frr-bgp-route-map.yang.c:if_address_is_local Unexecuted instantiation: bgp_attr.c:if_address_is_local Unexecuted instantiation: bgp_attr_evpn.c:if_address_is_local Unexecuted instantiation: bgp_clist.c:if_address_is_local Unexecuted instantiation: bgp_community.c:if_address_is_local Unexecuted instantiation: bgp_community_alias.c:if_address_is_local Unexecuted instantiation: bgp_debug.c:if_address_is_local Unexecuted instantiation: bgp_dump.c:if_address_is_local Unexecuted instantiation: bgp_ecommunity.c:if_address_is_local Unexecuted instantiation: bgp_errors.c:if_address_is_local Unexecuted instantiation: bgp_evpn.c:if_address_is_local Unexecuted instantiation: bgp_evpn_mh.c:if_address_is_local Unexecuted instantiation: bgp_evpn_vty.c:if_address_is_local Unexecuted instantiation: bgp_filter.c:if_address_is_local Unexecuted instantiation: bgp_flowspec_vty.c:if_address_is_local Unexecuted instantiation: bgp_fsm.c:if_address_is_local Unexecuted instantiation: bgp_io.c:if_address_is_local Unexecuted instantiation: bgp_keepalives.c:if_address_is_local Unexecuted instantiation: bgp_labelpool.c:if_address_is_local Unexecuted instantiation: bgp_lcommunity.c:if_address_is_local Unexecuted instantiation: bgp_mac.c:if_address_is_local Unexecuted instantiation: bgp_mpath.c:if_address_is_local Unexecuted instantiation: bgp_mplsvpn.c:if_address_is_local Unexecuted instantiation: bgp_network.c:if_address_is_local Unexecuted instantiation: bgp_nexthop.c:if_address_is_local Unexecuted instantiation: bgp_nht.c:if_address_is_local Unexecuted instantiation: bgp_packet.c:if_address_is_local Unexecuted instantiation: bgp_pbr.c:if_address_is_local Unexecuted instantiation: bgp_rd.c:if_address_is_local Unexecuted instantiation: bgp_regex.c:if_address_is_local Unexecuted instantiation: bgp_route.c:if_address_is_local Unexecuted instantiation: bgp_routemap.c:if_address_is_local Unexecuted instantiation: bgp_routemap_nb.c:if_address_is_local Unexecuted instantiation: bgp_routemap_nb_config.c:if_address_is_local Unexecuted instantiation: bgp_table.c:if_address_is_local Unexecuted instantiation: bgp_updgrp.c:if_address_is_local Unexecuted instantiation: bgp_updgrp_adv.c:if_address_is_local Unexecuted instantiation: bgp_updgrp_packet.c:if_address_is_local Unexecuted instantiation: bgp_vpn.c:if_address_is_local Unexecuted instantiation: bgp_vty.c:if_address_is_local Unexecuted instantiation: bgp_zebra.c:if_address_is_local Unexecuted instantiation: bgpd.c:if_address_is_local Unexecuted instantiation: bgp_rfapi_cfg.c:if_address_is_local Unexecuted instantiation: rfapi_import.c:if_address_is_local Unexecuted instantiation: rfapi.c:if_address_is_local Unexecuted instantiation: rfapi_ap.c:if_address_is_local Unexecuted instantiation: rfapi_encap_tlv.c:if_address_is_local Unexecuted instantiation: rfapi_nve_addr.c:if_address_is_local Unexecuted instantiation: rfapi_monitor.c:if_address_is_local Unexecuted instantiation: rfapi_rib.c:if_address_is_local Unexecuted instantiation: rfapi_vty.c:if_address_is_local Unexecuted instantiation: vnc_debug.c:if_address_is_local Unexecuted instantiation: vnc_export_bgp.c:if_address_is_local Unexecuted instantiation: vnc_export_table.c:if_address_is_local Unexecuted instantiation: vnc_import_bgp.c:if_address_is_local Unexecuted instantiation: vnc_zebra.c:if_address_is_local Unexecuted instantiation: bgp_addpath.c:if_address_is_local Unexecuted instantiation: bgp_advertise.c:if_address_is_local Unexecuted instantiation: bgp_aspath.c:if_address_is_local Unexecuted instantiation: bgp_bfd.c:if_address_is_local Unexecuted instantiation: bgp_conditional_adv.c:if_address_is_local Unexecuted instantiation: bgp_damp.c:if_address_is_local Unexecuted instantiation: bgp_encap_tlv.c:if_address_is_local Unexecuted instantiation: bgp_flowspec.c:if_address_is_local Unexecuted instantiation: bgp_flowspec_util.c:if_address_is_local Unexecuted instantiation: bgp_label.c:if_address_is_local Unexecuted instantiation: bgp_open.c:if_address_is_local Unexecuted instantiation: rfp_example.c:if_address_is_local Unexecuted instantiation: pim_addr.c:if_address_is_local Unexecuted instantiation: pim_assert.c:if_address_is_local Unexecuted instantiation: pim_bfd.c:if_address_is_local pim_bsm.c:if_address_is_local Line | Count | Source | 528 | 1.12k | { | 529 | 1.12k | return if_lookup_address_local(matchaddr, family, vrf_id) != NULL; | 530 | 1.12k | } |
Unexecuted instantiation: pim_cmd_common.c:if_address_is_local Unexecuted instantiation: pim_errors.c:if_address_is_local Unexecuted instantiation: pim_hello.c:if_address_is_local Unexecuted instantiation: pim_iface.c:if_address_is_local Unexecuted instantiation: pim_ifchannel.c:if_address_is_local Unexecuted instantiation: pim_instance.c:if_address_is_local Unexecuted instantiation: pim_join.c:if_address_is_local Unexecuted instantiation: pim_jp_agg.c:if_address_is_local Unexecuted instantiation: pim_macro.c:if_address_is_local Unexecuted instantiation: pim_mroute.c:if_address_is_local Unexecuted instantiation: pim_msg.c:if_address_is_local Unexecuted instantiation: pim_nb.c:if_address_is_local Unexecuted instantiation: pim_nb_config.c:if_address_is_local Unexecuted instantiation: pim_neighbor.c:if_address_is_local Unexecuted instantiation: pim_nht.c:if_address_is_local Unexecuted instantiation: pim_oil.c:if_address_is_local Unexecuted instantiation: pim_pim.c:if_address_is_local Unexecuted instantiation: pim_routemap.c:if_address_is_local Unexecuted instantiation: pim_rp.c:if_address_is_local Unexecuted instantiation: pim_rpf.c:if_address_is_local Unexecuted instantiation: pim_sock.c:if_address_is_local Unexecuted instantiation: pim_ssm.c:if_address_is_local Unexecuted instantiation: pim_ssmpingd.c:if_address_is_local Unexecuted instantiation: pim_static.c:if_address_is_local Unexecuted instantiation: pim_str.c:if_address_is_local Unexecuted instantiation: pim_tib.c:if_address_is_local Unexecuted instantiation: pim_time.c:if_address_is_local Unexecuted instantiation: pim_tlv.c:if_address_is_local Unexecuted instantiation: pim_upstream.c:if_address_is_local Unexecuted instantiation: pim_util.c:if_address_is_local Unexecuted instantiation: pim_vty.c:if_address_is_local Unexecuted instantiation: pim_zebra.c:if_address_is_local Unexecuted instantiation: pim_zlookup.c:if_address_is_local Unexecuted instantiation: pim_vxlan.c:if_address_is_local pim_register.c:if_address_is_local Line | Count | Source | 528 | 33 | { | 529 | 33 | return if_lookup_address_local(matchaddr, family, vrf_id) != NULL; | 530 | 33 | } |
Unexecuted instantiation: pimd.c:if_address_is_local Unexecuted instantiation: pim_cmd.c:if_address_is_local Unexecuted instantiation: pim_igmp.c:if_address_is_local Unexecuted instantiation: pim_igmp_mtrace.c:if_address_is_local Unexecuted instantiation: pim_igmpv2.c:if_address_is_local Unexecuted instantiation: pim_igmpv3.c:if_address_is_local Unexecuted instantiation: pim_main.c:if_address_is_local Unexecuted instantiation: pim_mlag.c:if_address_is_local Unexecuted instantiation: pim_msdp.c:if_address_is_local Unexecuted instantiation: pim_msdp_packet.c:if_address_is_local Unexecuted instantiation: pim_msdp_socket.c:if_address_is_local Unexecuted instantiation: pim_signals.c:if_address_is_local Unexecuted instantiation: pim_zpthread.c:if_address_is_local Unexecuted instantiation: frr-pim.yang.c:if_address_is_local Unexecuted instantiation: frr-pim-rp.yang.c:if_address_is_local Unexecuted instantiation: frr-gmp.yang.c:if_address_is_local |
531 | | |
532 | | struct vrf; |
533 | | extern struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf); |
534 | | extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id); |
535 | | extern struct interface *if_get_vrf_loopback(vrf_id_t vrf_id); |
536 | | extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id, |
537 | | const char *vrf_name); |
538 | | |
539 | | /* Sets the index and adds to index list */ |
540 | | extern int if_set_index(struct interface *ifp, ifindex_t ifindex); |
541 | | |
542 | | /* Delete the interface, but do not free the structure, and leave it in the |
543 | | interface list. It is often advisable to leave the pseudo interface |
544 | | structure because there may be configuration information attached. */ |
545 | | extern void if_delete_retain(struct interface *); |
546 | | |
547 | | /* Delete and free the interface structure: calls if_delete_retain and then |
548 | | deletes it from the interface list and frees the structure. */ |
549 | | extern void if_delete(struct interface **ifp); |
550 | | |
551 | | extern int if_is_up(const struct interface *ifp); |
552 | | extern int if_is_running(const struct interface *ifp); |
553 | | extern int if_is_operative(const struct interface *ifp); |
554 | | extern int if_is_no_ptm_operative(const struct interface *ifp); |
555 | | extern int if_is_loopback_exact(const struct interface *ifp); |
556 | | extern int if_is_vrf(const struct interface *ifp); |
557 | | extern bool if_is_loopback(const struct interface *ifp); |
558 | | extern int if_is_broadcast(const struct interface *ifp); |
559 | | extern int if_is_pointopoint(const struct interface *ifp); |
560 | | extern int if_is_multicast(const struct interface *ifp); |
561 | | extern void if_terminate(struct vrf *vrf); |
562 | | extern void if_dump_all(void); |
563 | | extern const char *if_flag_dump(unsigned long); |
564 | | extern const char *if_link_type_str(enum zebra_link_type); |
565 | | |
566 | | /* Please use ifindex2ifname instead of if_indextoname where possible; |
567 | | ifindex2ifname uses internal interface info, whereas if_indextoname must |
568 | | make a system call. */ |
569 | | extern const char *ifindex2ifname(ifindex_t, vrf_id_t vrf_id); |
570 | | |
571 | | /* Please use ifname2ifindex instead of if_nametoindex where possible; |
572 | | ifname2ifindex uses internal interface info, whereas if_nametoindex must |
573 | | make a system call. */ |
574 | | extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id); |
575 | | |
576 | | /* Connected address functions. */ |
577 | | extern struct connected *connected_new(void); |
578 | | extern void connected_free(struct connected **connected); |
579 | | extern void connected_add(struct interface *, struct connected *); |
580 | | extern struct connected * |
581 | | connected_add_by_prefix(struct interface *, struct prefix *, struct prefix *); |
582 | | extern struct connected *connected_delete_by_prefix(struct interface *, |
583 | | struct prefix *); |
584 | | extern struct connected *connected_lookup_prefix(struct interface *, |
585 | | const struct prefix *); |
586 | | extern struct connected *connected_lookup_prefix_exact(struct interface *, |
587 | | const struct prefix *); |
588 | | extern unsigned int connected_count_by_family(struct interface *, int family); |
589 | | extern struct nbr_connected *nbr_connected_new(void); |
590 | | extern void nbr_connected_free(struct nbr_connected *); |
591 | | struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *); |
592 | | struct connected *connected_get_linklocal(struct interface *ifp); |
593 | | |
594 | | /* link parameters */ |
595 | | bool if_link_params_cmp(struct if_link_params *iflp1, |
596 | | struct if_link_params *iflp2); |
597 | | void if_link_params_copy(struct if_link_params *dst, |
598 | | struct if_link_params *src); |
599 | | struct if_link_params *if_link_params_get(struct interface *); |
600 | | struct if_link_params *if_link_params_enable(struct interface *ifp); |
601 | | struct if_link_params *if_link_params_init(struct interface *ifp); |
602 | | void if_link_params_free(struct interface *); |
603 | | |
604 | | /* Northbound. */ |
605 | | struct vty; |
606 | | extern void if_vty_config_start(struct vty *vty, struct interface *ifp); |
607 | | extern void if_vty_config_end(struct vty *vty); |
608 | | extern void if_cmd_init(int (*config_write)(struct vty *)); |
609 | | extern void if_cmd_init_default(void); |
610 | | extern void if_zapi_callbacks(int (*create)(struct interface *ifp), |
611 | | int (*up)(struct interface *ifp), |
612 | | int (*down)(struct interface *ifp), |
613 | | int (*destroy)(struct interface *ifp)); |
614 | | |
615 | | extern void if_new_via_zapi(struct interface *ifp); |
616 | | extern void if_up_via_zapi(struct interface *ifp); |
617 | | extern void if_down_via_zapi(struct interface *ifp); |
618 | | extern void if_destroy_via_zapi(struct interface *ifp); |
619 | | |
620 | | extern const struct frr_yang_module_info frr_interface_info; |
621 | | |
622 | | #ifdef FUZZING |
623 | | struct interface *if_create_name(const char *name, struct vrf *vrf); |
624 | | #endif |
625 | | |
626 | | #ifdef __cplusplus |
627 | | } |
628 | | #endif |
629 | | |
630 | | #endif /* _ZEBRA_IF_H */ |