]> git.proxmox.com Git - mirror_frr.git/blob - lib/if.h
lib,yang,zebra: add extended admin-group support
[mirror_frr.git] / lib / if.h
1 /* Interface related header.
2 * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 2, or (at your
9 * option) any later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _ZEBRA_IF_H
22 #define _ZEBRA_IF_H
23
24 #include "zebra.h"
25 #include "linklist.h"
26 #include "memory.h"
27 #include "qobj.h"
28 #include "hook.h"
29 #include "admin_group.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 DECLARE_MTYPE(CONNECTED_LABEL);
36
37 /* Interface link-layer type, if known. Derived from:
38 *
39 * net/if_arp.h on various platforms - Linux especially.
40 * http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml
41 *
42 * Some of the more obviously defunct technologies left out.
43 */
44 enum zebra_link_type {
45 ZEBRA_LLT_UNKNOWN = 0,
46 ZEBRA_LLT_ETHER,
47 ZEBRA_LLT_EETHER,
48 ZEBRA_LLT_AX25,
49 ZEBRA_LLT_PRONET,
50 ZEBRA_LLT_IEEE802,
51 ZEBRA_LLT_ARCNET,
52 ZEBRA_LLT_APPLETLK,
53 ZEBRA_LLT_DLCI,
54 ZEBRA_LLT_ATM,
55 ZEBRA_LLT_METRICOM,
56 ZEBRA_LLT_IEEE1394,
57 ZEBRA_LLT_EUI64,
58 ZEBRA_LLT_INFINIBAND,
59 ZEBRA_LLT_SLIP,
60 ZEBRA_LLT_CSLIP,
61 ZEBRA_LLT_SLIP6,
62 ZEBRA_LLT_CSLIP6,
63 ZEBRA_LLT_RSRVD,
64 ZEBRA_LLT_ADAPT,
65 ZEBRA_LLT_ROSE,
66 ZEBRA_LLT_X25,
67 ZEBRA_LLT_PPP,
68 ZEBRA_LLT_CHDLC,
69 ZEBRA_LLT_LAPB,
70 ZEBRA_LLT_RAWHDLC,
71 ZEBRA_LLT_IPIP,
72 ZEBRA_LLT_IPIP6,
73 ZEBRA_LLT_FRAD,
74 ZEBRA_LLT_SKIP,
75 ZEBRA_LLT_LOOPBACK,
76 ZEBRA_LLT_LOCALTLK,
77 ZEBRA_LLT_FDDI,
78 ZEBRA_LLT_SIT,
79 ZEBRA_LLT_IPDDP,
80 ZEBRA_LLT_IPGRE,
81 ZEBRA_LLT_IP6GRE,
82 ZEBRA_LLT_PIMREG,
83 ZEBRA_LLT_HIPPI,
84 ZEBRA_LLT_ECONET,
85 ZEBRA_LLT_IRDA,
86 ZEBRA_LLT_FCPP,
87 ZEBRA_LLT_FCAL,
88 ZEBRA_LLT_FCPL,
89 ZEBRA_LLT_FCFABRIC,
90 ZEBRA_LLT_IEEE802_TR,
91 ZEBRA_LLT_IEEE80211,
92 ZEBRA_LLT_IEEE80211_RADIOTAP,
93 ZEBRA_LLT_IEEE802154,
94 ZEBRA_LLT_IEEE802154_PHY,
95 };
96
97 /*
98 Interface name length.
99
100 Linux define value in /usr/include/linux/if.h.
101 #define IFNAMSIZ 16
102
103 FreeBSD define value in /usr/include/net/if.h.
104 #define IFNAMSIZ 16
105 */
106
107 #define INTERFACE_NAMSIZ IFNAMSIZ
108 #define INTERFACE_HWADDR_MAX 20
109
110 typedef signed int ifindex_t;
111
112 #ifdef HAVE_PROC_NET_DEV
113 struct if_stats {
114 unsigned long rx_packets; /* total packets received */
115 unsigned long tx_packets; /* total packets transmitted */
116 unsigned long rx_bytes; /* total bytes received */
117 unsigned long tx_bytes; /* total bytes transmitted */
118 unsigned long rx_errors; /* bad packets received */
119 unsigned long tx_errors; /* packet transmit problems */
120 unsigned long rx_dropped; /* no space in linux buffers */
121 unsigned long tx_dropped; /* no space available in linux */
122 unsigned long rx_multicast; /* multicast packets received */
123 unsigned long rx_compressed;
124 unsigned long tx_compressed;
125 unsigned long collisions;
126
127 /* detailed rx_errors: */
128 unsigned long rx_length_errors;
129 unsigned long rx_over_errors; /* receiver ring buff overflow */
130 unsigned long rx_crc_errors; /* recved pkt with crc error */
131 unsigned long rx_frame_errors; /* recv'd frame alignment error */
132 unsigned long rx_fifo_errors; /* recv'r fifo overrun */
133 unsigned long rx_missed_errors; /* receiver missed packet */
134 /* detailed tx_errors */
135 unsigned long tx_aborted_errors;
136 unsigned long tx_carrier_errors;
137 unsigned long tx_fifo_errors;
138 unsigned long tx_heartbeat_errors;
139 unsigned long tx_window_errors;
140 };
141 #endif /* HAVE_PROC_NET_DEV */
142
143 /* Here are "non-official" architectural constants. */
144 #define TE_EXT_MASK 0x00FFFFFF
145 #define TE_EXT_ANORMAL 0x80000000
146 #define LOSS_PRECISION 0.000003
147 /* TE_MEGA_BIT and TE_BYTE are utilized to convert TE bandwidth */
148 #define TE_MEGA_BIT 1000000
149 #define TE_BYTE 8
150 /* Default TE bandwidth when no value in config.
151 * The value is in Mbps (will be multiplied by TE_BYTE)
152 */
153 #define DEFAULT_BANDWIDTH 10
154 #define MAX_CLASS_TYPE 8
155 #define MAX_PKT_LOSS 50.331642
156
157 enum affinity_mode {
158 /* RFC7308 Extended Administrative group */
159 AFFINITY_MODE_EXTENDED = 0,
160 /* RFC3630/RFC5305/RFC5329 Administrative group */
161 AFFINITY_MODE_STANDARD = 1,
162 /* Standard and Extended Administrative group */
163 AFFINITY_MODE_BOTH = 2,
164 };
165
166 /*
167 * Link Parameters Status:
168 * equal to 0: unset
169 * different from 0: set
170 */
171 #define LP_UNSET 0x0000
172 #define LP_TE_METRIC 0x0001
173 #define LP_MAX_BW 0x0002
174 #define LP_MAX_RSV_BW 0x0004
175 #define LP_UNRSV_BW 0x0008
176 #define LP_ADM_GRP 0x0010
177 #define LP_RMT_AS 0x0020
178 #define LP_DELAY 0x0040
179 #define LP_MM_DELAY 0x0080
180 #define LP_DELAY_VAR 0x0100
181 #define LP_PKT_LOSS 0x0200
182 #define LP_RES_BW 0x0400
183 #define LP_AVA_BW 0x0800
184 #define LP_USE_BW 0x1000
185 #define LP_EXTEND_ADM_GRP 0x2000
186
187 #define IS_PARAM_UNSET(lp, st) !(lp->lp_status & st)
188 #define IS_PARAM_SET(lp, st) (lp->lp_status & st)
189 #define IS_LINK_PARAMS_SET(lp) (lp->lp_status != LP_UNSET)
190
191 #define SET_PARAM(lp, st) (lp->lp_status) |= (st)
192 #define UNSET_PARAM(lp, st) (lp->lp_status) &= ~(st)
193 #define RESET_LINK_PARAM(lp) (lp->lp_status = LP_UNSET)
194
195 /* Link Parameters for Traffic Engineering
196 * Do not forget to update if_link_params_copy()
197 * and if_link_params_cmp() when updating the structure
198 */
199 struct if_link_params {
200 uint32_t lp_status; /* Status of Link Parameters: */
201 uint32_t te_metric; /* Traffic Engineering metric */
202 float default_bw;
203 float max_bw; /* Maximum Bandwidth */
204 float max_rsv_bw; /* Maximum Reservable Bandwidth */
205 float unrsv_bw[MAX_CLASS_TYPE]; /* Unreserved Bandwidth per Class Type
206 (8) */
207 uint32_t admin_grp; /* RFC5305/RFC5329 Administrative group */
208 struct admin_group ext_admin_grp; /* RFC7308 Extended Admin group */
209 uint32_t rmt_as; /* Remote AS number */
210 struct in_addr rmt_ip; /* Remote IP address */
211 uint32_t av_delay; /* Link Average Delay */
212 uint32_t min_delay; /* Link Min Delay */
213 uint32_t max_delay; /* Link Max Delay */
214 uint32_t delay_var; /* Link Delay Variation */
215 float pkt_loss; /* Link Packet Loss */
216 float res_bw; /* Residual Bandwidth */
217 float ava_bw; /* Available Bandwidth */
218 float use_bw; /* Utilized Bandwidth */
219 };
220
221 #define INTERFACE_LINK_PARAMS_SIZE sizeof(struct if_link_params)
222 #define HAS_LINK_PARAMS(ifp) ((ifp)->link_params != NULL)
223
224 /* Interface structure */
225 struct interface {
226 RB_ENTRY(interface) name_entry, index_entry;
227
228 /* Interface name. This should probably never be changed after the
229 interface is created, because the configuration info for this
230 interface
231 is associated with this structure. For that reason, the interface
232 should also never be deleted (to avoid losing configuration info).
233 To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the
234 interface does not exist in the kernel.
235 */
236 char name[INTERFACE_NAMSIZ];
237
238 /* Interface index (should be IFINDEX_INTERNAL for non-kernel or
239 deleted interfaces).
240 WARNING: the ifindex needs to be changed using the if_set_index()
241 function. Failure to respect this will cause corruption in the data
242 structure used to store the interfaces and if_lookup_by_index() will
243 not work as expected.
244 */
245 ifindex_t ifindex;
246 ifindex_t oldifindex;
247
248 /*
249 * ifindex of parent interface, if any
250 */
251 ifindex_t link_ifindex;
252 #define IFINDEX_INTERNAL 0
253
254 /* Zebra internal interface status */
255 uint8_t status;
256 #define ZEBRA_INTERFACE_ACTIVE (1 << 0)
257 #define ZEBRA_INTERFACE_SUB (1 << 1)
258 #define ZEBRA_INTERFACE_LINKDETECTION (1 << 2)
259 #define ZEBRA_INTERFACE_VRF_LOOPBACK (1 << 3)
260
261 /* Interface flags. */
262 uint64_t flags;
263
264 /* Interface metric */
265 uint32_t metric;
266
267 /* Interface Speed in Mb/s */
268 uint32_t speed;
269
270 /* Interface MTU. */
271 unsigned int mtu; /* IPv4 MTU */
272 unsigned int
273 mtu6; /* IPv6 MTU - probably, but not necessarily same as mtu
274 */
275
276 /* Link-layer information and hardware address */
277 enum zebra_link_type ll_type;
278 uint8_t hw_addr[INTERFACE_HWADDR_MAX];
279 int hw_addr_len;
280
281 /* interface bandwidth, kbits */
282 unsigned int bandwidth;
283
284 /* Link parameters for Traffic Engineering */
285 struct if_link_params *link_params;
286
287 /* description of the interface. */
288 char *desc;
289
290 /* Distribute list. */
291 void *distribute_in;
292 void *distribute_out;
293
294 /* Connected address list. */
295 struct list *connected;
296
297 /* Neighbor connected address list. */
298 struct list *nbr_connected;
299
300 /* Daemon specific interface data pointer. */
301 void *info;
302
303 char ptm_enable; /* Should we look at ptm_status ? */
304 char ptm_status;
305
306 /* Statistics fileds. */
307 #ifdef HAVE_PROC_NET_DEV
308 struct if_stats stats;
309 #endif /* HAVE_PROC_NET_DEV */
310 #ifdef HAVE_NET_RT_IFLIST
311 struct if_data stats;
312 #endif /* HAVE_NET_RT_IFLIST */
313
314 struct route_node *node;
315
316 struct vrf *vrf;
317
318 /*
319 * Has the end users entered `interface XXXX` from the cli in some
320 * fashion?
321 */
322 bool configured;
323
324 QOBJ_FIELDS;
325 };
326
327 RB_HEAD(if_name_head, interface);
328 RB_PROTOTYPE(if_name_head, interface, name_entry, if_cmp_func)
329 RB_HEAD(if_index_head, interface);
330 RB_PROTOTYPE(if_index_head, interface, index_entry, if_cmp_index_func)
331 DECLARE_QOBJ_TYPE(interface);
332
333 #define IFNAME_RB_INSERT(v, ifp) \
334 ({ \
335 struct interface *_iz = \
336 RB_INSERT(if_name_head, &v->ifaces_by_name, (ifp)); \
337 if (_iz) \
338 flog_err( \
339 EC_LIB_INTERFACE, \
340 "%s(%s): corruption detected -- interface with this " \
341 "name exists already in VRF %s!", \
342 __func__, (ifp)->name, (ifp)->vrf->name); \
343 _iz; \
344 })
345
346 #define IFNAME_RB_REMOVE(v, ifp) \
347 ({ \
348 struct interface *_iz = \
349 RB_REMOVE(if_name_head, &v->ifaces_by_name, (ifp)); \
350 if (_iz == NULL) \
351 flog_err( \
352 EC_LIB_INTERFACE, \
353 "%s(%s): corruption detected -- interface with this " \
354 "name doesn't exist in VRF %s!", \
355 __func__, (ifp)->name, (ifp)->vrf->name); \
356 _iz; \
357 })
358
359
360 #define IFINDEX_RB_INSERT(v, ifp) \
361 ({ \
362 struct interface *_iz = \
363 RB_INSERT(if_index_head, &v->ifaces_by_index, (ifp)); \
364 if (_iz) \
365 flog_err( \
366 EC_LIB_INTERFACE, \
367 "%s(%u): corruption detected -- interface with this " \
368 "ifindex exists already in VRF %s!", \
369 __func__, (ifp)->ifindex, (ifp)->vrf->name); \
370 _iz; \
371 })
372
373 #define IFINDEX_RB_REMOVE(v, ifp) \
374 ({ \
375 struct interface *_iz = \
376 RB_REMOVE(if_index_head, &v->ifaces_by_index, (ifp)); \
377 if (_iz == NULL) \
378 flog_err( \
379 EC_LIB_INTERFACE, \
380 "%s(%u): corruption detected -- interface with this " \
381 "ifindex doesn't exist in VRF %s!", \
382 __func__, (ifp)->ifindex, (ifp)->vrf->name); \
383 _iz; \
384 })
385
386 #define FOR_ALL_INTERFACES(vrf, ifp) \
387 if (vrf) \
388 RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name)
389
390 #define FOR_ALL_INTERFACES_ADDRESSES(ifp, connected, node) \
391 for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, connected))
392
393 /* called from the library code whenever interfaces are created/deleted
394 * note: interfaces may not be fully realized at that point; also they
395 * may not exist in the system (ifindex = IFINDEX_INTERNAL)
396 *
397 * priority values are important here, daemons should be at 0 while modules
398 * can use 1000+ so they run after the daemon has initialised daemon-specific
399 * interface data
400 */
401 DECLARE_HOOK(if_add, (struct interface * ifp), (ifp));
402 DECLARE_KOOH(if_del, (struct interface * ifp), (ifp));
403
404 #define METRIC_MAX (~0)
405
406 /* Connected address structure. */
407 struct connected {
408 /* Attached interface. */
409 struct interface *ifp;
410
411 /* Flags for configuration. */
412 uint8_t conf;
413 #define ZEBRA_IFC_REAL (1 << 0)
414 #define ZEBRA_IFC_CONFIGURED (1 << 1)
415 #define ZEBRA_IFC_QUEUED (1 << 2)
416 #define ZEBRA_IFC_DOWN (1 << 3)
417 /*
418 The ZEBRA_IFC_REAL flag should be set if and only if this address
419 exists in the kernel and is actually usable. (A case where it exists
420 but is not yet usable would be IPv6 with DAD)
421 The ZEBRA_IFC_CONFIGURED flag should be set if and only if this
422 address was configured by the user from inside frr.
423 The ZEBRA_IFC_QUEUED flag should be set if and only if the address
424 exists in the kernel. It may and should be set although the
425 address might not be usable yet. (compare with ZEBRA_IFC_REAL)
426 The ZEBRA_IFC_DOWN flag is used to record that an address is
427 present, but down/unavailable.
428 */
429
430 /* Flags for connected address. */
431 uint8_t flags;
432 #define ZEBRA_IFA_SECONDARY (1 << 0)
433 #define ZEBRA_IFA_PEER (1 << 1)
434 #define ZEBRA_IFA_UNNUMBERED (1 << 2)
435 /* N.B. the ZEBRA_IFA_PEER flag should be set if and only if
436 a peer address has been configured. If this flag is set,
437 the destination field must contain the peer address.
438 */
439
440 /* Address of connected network. */
441 struct prefix *address;
442
443 /* Peer address, if ZEBRA_IFA_PEER is set, otherwise NULL */
444 struct prefix *destination;
445
446 /* Label for Linux 2.2.X and upper. */
447 char *label;
448
449 /*
450 * Used for setting the connected route's cost. If the metric
451 * here is set to METRIC_MAX the connected route falls back to
452 * "struct interface"
453 */
454 uint32_t metric;
455 };
456
457 /* Nbr Connected address structure. */
458 struct nbr_connected {
459 /* Attached interface. */
460 struct interface *ifp;
461
462 /* Address of connected network. */
463 struct prefix *address;
464 };
465
466 /* Does the destination field contain a peer address? */
467 #define CONNECTED_PEER(C) CHECK_FLAG((C)->flags, ZEBRA_IFA_PEER)
468
469 /* Prefix to insert into the RIB */
470 #define CONNECTED_PREFIX(C) \
471 (CONNECTED_PEER(C) ? (C)->destination : (C)->address)
472
473 /* Identifying address. We guess that if there's a peer address, but the
474 local address is in the same prefix, then the local address may be unique. */
475 #define CONNECTED_ID(C) \
476 ((CONNECTED_PEER(C) && !prefix_match((C)->destination, (C)->address)) \
477 ? (C)->destination \
478 : (C)->address)
479
480 /* There are some interface flags which are only supported by some
481 operating system. */
482
483 #ifndef IFF_NOTRAILERS
484 #define IFF_NOTRAILERS 0x0
485 #endif /* IFF_NOTRAILERS */
486 #ifndef IFF_OACTIVE
487 #define IFF_OACTIVE 0x0
488 #endif /* IFF_OACTIVE */
489 #ifndef IFF_SIMPLEX
490 #define IFF_SIMPLEX 0x0
491 #endif /* IFF_SIMPLEX */
492 #ifndef IFF_LINK0
493 #define IFF_LINK0 0x0
494 #endif /* IFF_LINK0 */
495 #ifndef IFF_LINK1
496 #define IFF_LINK1 0x0
497 #endif /* IFF_LINK1 */
498 #ifndef IFF_LINK2
499 #define IFF_LINK2 0x0
500 #endif /* IFF_LINK2 */
501 #ifndef IFF_NOXMIT
502 #define IFF_NOXMIT 0x0
503 #endif /* IFF_NOXMIT */
504 #ifndef IFF_NORTEXCH
505 #define IFF_NORTEXCH 0x0
506 #endif /* IFF_NORTEXCH */
507 #ifndef IFF_IPV4
508 #define IFF_IPV4 0x0
509 #endif /* IFF_IPV4 */
510 #ifndef IFF_IPV6
511 #define IFF_IPV6 0x0
512 #endif /* IFF_IPV6 */
513 #ifndef IFF_VIRTUAL
514 #define IFF_VIRTUAL 0x0
515 #endif /* IFF_VIRTUAL */
516
517 /* Prototypes. */
518 extern int if_cmp_name_func(const char *p1, const char *p2);
519
520 /*
521 * Passing in VRF_UNKNOWN is a valid thing to do, unless we
522 * are creating a new interface.
523 *
524 * This is useful for vrf route-leaking. So more than anything
525 * else think before you use VRF_UNKNOWN
526 */
527 extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
528
529 extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
530 extern struct interface *if_vrf_lookup_by_index_next(ifindex_t ifindex,
531 vrf_id_t vrf_id);
532 extern struct interface *if_lookup_address_local(const void *matchaddr,
533 int family, vrf_id_t vrf_id);
534 extern struct connected *if_lookup_address(const void *matchaddr, int family,
535 vrf_id_t vrf_id);
536 extern struct interface *if_lookup_prefix(const struct prefix *prefix,
537 vrf_id_t vrf_id);
538 size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
539 struct interface ***result, vrf_id_t vrf_id);
540
541 static inline bool if_address_is_local(const void *matchaddr, int family,
542 vrf_id_t vrf_id)
543 {
544 return if_lookup_address_local(matchaddr, family, vrf_id) != NULL;
545 }
546
547 struct vrf;
548 extern struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf);
549 extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
550 extern struct interface *if_get_vrf_loopback(vrf_id_t vrf_id);
551 extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id,
552 const char *vrf_name);
553
554 /* Sets the index and adds to index list */
555 extern int if_set_index(struct interface *ifp, ifindex_t ifindex);
556
557 /* Delete the interface, but do not free the structure, and leave it in the
558 interface list. It is often advisable to leave the pseudo interface
559 structure because there may be configuration information attached. */
560 extern void if_delete_retain(struct interface *);
561
562 /* Delete and free the interface structure: calls if_delete_retain and then
563 deletes it from the interface list and frees the structure. */
564 extern void if_delete(struct interface **ifp);
565
566 extern int if_is_up(const struct interface *ifp);
567 extern int if_is_running(const struct interface *ifp);
568 extern int if_is_operative(const struct interface *ifp);
569 extern int if_is_no_ptm_operative(const struct interface *ifp);
570 extern int if_is_loopback_exact(const struct interface *ifp);
571 extern int if_is_vrf(const struct interface *ifp);
572 extern bool if_is_loopback(const struct interface *ifp);
573 extern int if_is_broadcast(const struct interface *ifp);
574 extern int if_is_pointopoint(const struct interface *ifp);
575 extern int if_is_multicast(const struct interface *ifp);
576 extern void if_terminate(struct vrf *vrf);
577 extern void if_dump_all(void);
578 extern const char *if_flag_dump(unsigned long);
579 extern const char *if_link_type_str(enum zebra_link_type);
580
581 /* Please use ifindex2ifname instead of if_indextoname where possible;
582 ifindex2ifname uses internal interface info, whereas if_indextoname must
583 make a system call. */
584 extern const char *ifindex2ifname(ifindex_t, vrf_id_t vrf_id);
585
586 /* Please use ifname2ifindex instead of if_nametoindex where possible;
587 ifname2ifindex uses internal interface info, whereas if_nametoindex must
588 make a system call. */
589 extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id);
590
591 /* Connected address functions. */
592 extern struct connected *connected_new(void);
593 extern void connected_free(struct connected **connected);
594 extern void connected_add(struct interface *, struct connected *);
595 extern struct connected *
596 connected_add_by_prefix(struct interface *, struct prefix *, struct prefix *);
597 extern struct connected *connected_delete_by_prefix(struct interface *,
598 struct prefix *);
599 extern struct connected *connected_lookup_prefix(struct interface *,
600 const struct prefix *);
601 extern struct connected *connected_lookup_prefix_exact(struct interface *,
602 const struct prefix *);
603 extern unsigned int connected_count_by_family(struct interface *, int family);
604 extern struct nbr_connected *nbr_connected_new(void);
605 extern void nbr_connected_free(struct nbr_connected *);
606 struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *);
607 struct connected *connected_get_linklocal(struct interface *ifp);
608
609 /* link parameters */
610 bool if_link_params_cmp(struct if_link_params *iflp1,
611 struct if_link_params *iflp2);
612 void if_link_params_copy(struct if_link_params *dst,
613 struct if_link_params *src);
614 struct if_link_params *if_link_params_get(struct interface *);
615 struct if_link_params *if_link_params_enable(struct interface *ifp);
616 struct if_link_params *if_link_params_init(struct interface *ifp);
617 void if_link_params_free(struct interface *);
618
619 /* Northbound. */
620 struct vty;
621 extern void if_vty_config_start(struct vty *vty, struct interface *ifp);
622 extern void if_vty_config_end(struct vty *vty);
623 extern void if_cmd_init(int (*config_write)(struct vty *));
624 extern void if_cmd_init_default(void);
625 extern void if_zapi_callbacks(int (*create)(struct interface *ifp),
626 int (*up)(struct interface *ifp),
627 int (*down)(struct interface *ifp),
628 int (*destroy)(struct interface *ifp));
629
630 extern void if_new_via_zapi(struct interface *ifp);
631 extern void if_up_via_zapi(struct interface *ifp);
632 extern void if_down_via_zapi(struct interface *ifp);
633 extern void if_destroy_via_zapi(struct interface *ifp);
634
635 extern const struct frr_yang_module_info frr_interface_info;
636
637 #ifdef __cplusplus
638 }
639 #endif
640
641 #endif /* _ZEBRA_IF_H */