]> git.proxmox.com Git - mirror_frr.git/blame - lib/if.h
Merge pull request #4595 from ton31337/feature/autocomplete/bgp_peer-groups_7.1
[mirror_frr.git] / lib / if.h
CommitLineData
718e3744 1/* Interface related header.
896014f4
DL
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 */
718e3744 20
21#ifndef _ZEBRA_IF_H
22#define _ZEBRA_IF_H
23
b892f1dd 24#include "zebra.h"
718e3744 25#include "linklist.h"
4a1ab8e4 26#include "memory.h"
e80e7cce 27#include "qobj.h"
ce19a04a 28#include "hook.h"
4a1ab8e4 29
5e244469
RW
30#ifdef __cplusplus
31extern "C" {
32#endif
33
4a1ab8e4
DL
34DECLARE_MTYPE(IF)
35DECLARE_MTYPE(CONNECTED_LABEL)
718e3744 36
8ccc7e80
TT
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 */
44enum zebra_link_type {
d62a17ae 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,
8ccc7e80
TT
95};
96
718e3744 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 20
108#define INTERFACE_HWADDR_MAX 20
109
b892f1dd
PJ
110typedef signed int ifindex_t;
111
718e3744 112#ifdef HAVE_PROC_NET_DEV
d62a17ae 113struct 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;
718e3744 140};
141#endif /* HAVE_PROC_NET_DEV */
142
16f1b9ee
OD
143/* Here are "non-official" architectural constants. */
144#define TE_EXT_MASK 0x0FFFFFFF
145#define TE_EXT_ANORMAL 0x80000000
146#define LOSS_PRECISION 0.000003
147#define TE_KILO_BIT 1000
148#define TE_BYTE 8
149#define DEFAULT_BANDWIDTH 10000
150#define MAX_CLASS_TYPE 8
151#define MAX_PKT_LOSS 50.331642
152
daf0a4d2
OD
153/*
154 * Link Parameters Status:
155 * equal to 0: unset
156 * different from 0: set
157 */
16f1b9ee 158#define LP_UNSET 0x0000
daf0a4d2 159#define LP_TE_METRIC 0x0001
16f1b9ee
OD
160#define LP_MAX_BW 0x0002
161#define LP_MAX_RSV_BW 0x0004
162#define LP_UNRSV_BW 0x0008
163#define LP_ADM_GRP 0x0010
164#define LP_RMT_AS 0x0020
165#define LP_DELAY 0x0040
166#define LP_MM_DELAY 0x0080
167#define LP_DELAY_VAR 0x0100
168#define LP_PKT_LOSS 0x0200
169#define LP_RES_BW 0x0400
170#define LP_AVA_BW 0x0800
171#define LP_USE_BW 0x1000
172
173#define IS_PARAM_UNSET(lp, st) !(lp->lp_status & st)
174#define IS_PARAM_SET(lp, st) (lp->lp_status & st)
175#define IS_LINK_PARAMS_SET(lp) (lp->lp_status != LP_UNSET)
176
177#define SET_PARAM(lp, st) (lp->lp_status) |= (st)
178#define UNSET_PARAM(lp, st) (lp->lp_status) &= ~(st)
179#define RESET_LINK_PARAM(lp) (lp->lp_status = LP_UNSET)
180
181/* Link Parameters for Traffic Engineering */
182struct if_link_params {
d7c0a89a
QY
183 uint32_t lp_status; /* Status of Link Parameters: */
184 uint32_t te_metric; /* Traffic Engineering metric */
d62a17ae 185 float default_bw;
186 float max_bw; /* Maximum Bandwidth */
187 float max_rsv_bw; /* Maximum Reservable Bandwidth */
188 float unrsv_bw[MAX_CLASS_TYPE]; /* Unreserved Bandwidth per Class Type
189 (8) */
d7c0a89a
QY
190 uint32_t admin_grp; /* Administrative group */
191 uint32_t rmt_as; /* Remote AS number */
d62a17ae 192 struct in_addr rmt_ip; /* Remote IP address */
d7c0a89a
QY
193 uint32_t av_delay; /* Link Average Delay */
194 uint32_t min_delay; /* Link Min Delay */
195 uint32_t max_delay; /* Link Max Delay */
196 uint32_t delay_var; /* Link Delay Variation */
d62a17ae 197 float pkt_loss; /* Link Packet Loss */
198 float res_bw; /* Residual Bandwidth */
199 float ava_bw; /* Available Bandwidth */
200 float use_bw; /* Utilized Bandwidth */
16f1b9ee
OD
201};
202
203#define INTERFACE_LINK_PARAMS_SIZE sizeof(struct if_link_params)
204#define HAS_LINK_PARAMS(ifp) ((ifp)->link_params != NULL)
205
718e3744 206/* Interface structure */
d62a17ae 207struct interface {
ff880b78 208 RB_ENTRY(interface) name_entry, index_entry;
f4e14fdb 209
d62a17ae 210 /* Interface name. This should probably never be changed after the
211 interface is created, because the configuration info for this
212 interface
213 is associated with this structure. For that reason, the interface
214 should also never be deleted (to avoid losing configuration info).
215 To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the
216 interface does not exist in the kernel.
217 */
bcc24579 218 char name[INTERFACE_NAMSIZ];
d62a17ae 219
220 /* Interface index (should be IFINDEX_INTERNAL for non-kernel or
ff880b78
RW
221 deleted interfaces).
222 WARNING: the ifindex needs to be changed using the if_set_index()
223 function. Failure to respect this will cause corruption in the data
224 structure used to store the interfaces and if_lookup_by_index() will
225 not work as expected.
226 */
d62a17ae 227 ifindex_t ifindex;
d2fc8896 228#define IFINDEX_INTERNAL 0
718e3744 229
d62a17ae 230 /* Zebra internal interface status */
d7c0a89a 231 uint8_t status;
718e3744 232#define ZEBRA_INTERFACE_ACTIVE (1 << 0)
233#define ZEBRA_INTERFACE_SUB (1 << 1)
2e3b2e47 234#define ZEBRA_INTERFACE_LINKDETECTION (1 << 2)
c23af4d3 235#define ZEBRA_INTERFACE_VRF_LOOPBACK (1 << 3)
525c1839 236
d62a17ae 237 /* Interface flags. */
238 uint64_t flags;
718e3744 239
d62a17ae 240 /* Interface metric */
241 uint32_t metric;
718e3744 242
d62a17ae 243 /* Interface Speed in Mb/s */
244 uint32_t speed;
2d7f0d76 245
d62a17ae 246 /* Interface MTU. */
247 unsigned int mtu; /* IPv4 MTU */
248 unsigned int
249 mtu6; /* IPv6 MTU - probably, but not neccessarily same as mtu
9d303b37 250 */
718e3744 251
d62a17ae 252 /* Link-layer information and hardware address */
253 enum zebra_link_type ll_type;
d7c0a89a 254 uint8_t hw_addr[INTERFACE_HWADDR_MAX];
d62a17ae 255 int hw_addr_len;
718e3744 256
d62a17ae 257 /* interface bandwidth, kbits */
258 unsigned int bandwidth;
16f1b9ee 259
d62a17ae 260 /* Link parameters for Traffic Engineering */
261 struct if_link_params *link_params;
718e3744 262
d62a17ae 263 /* description of the interface. */
264 char *desc;
718e3744 265
d62a17ae 266 /* Distribute list. */
267 void *distribute_in;
268 void *distribute_out;
718e3744 269
d62a17ae 270 /* Connected address list. */
271 struct list *connected;
a80beece 272
d62a17ae 273 /* Neighbor connected address list. */
274 struct list *nbr_connected;
718e3744 275
d62a17ae 276 /* Daemon specific interface data pointer. */
277 void *info;
244c1cdc 278
d62a17ae 279 char ptm_enable; /* Should we look at ptm_status ? */
280 char ptm_status;
281
282/* Statistics fileds. */
718e3744 283#ifdef HAVE_PROC_NET_DEV
d62a17ae 284 struct if_stats stats;
285#endif /* HAVE_PROC_NET_DEV */
718e3744 286#ifdef HAVE_NET_RT_IFLIST
d62a17ae 287 struct if_data stats;
718e3744 288#endif /* HAVE_NET_RT_IFLIST */
3968dbf8 289
d62a17ae 290 struct route_node *node;
291 vrf_id_t vrf_id;
e80e7cce 292
d62a17ae 293 QOBJ_FIELDS
718e3744 294};
0c74bbe0 295
f4e14fdb 296RB_HEAD(if_name_head, interface);
f3dd45d1 297RB_PROTOTYPE(if_name_head, interface, name_entry, if_cmp_func)
ff880b78 298RB_HEAD(if_index_head, interface);
f3dd45d1 299RB_PROTOTYPE(if_index_head, interface, index_entry, if_cmp_func)
e80e7cce 300DECLARE_QOBJ_TYPE(interface)
718e3744 301
ff880b78
RW
302#define IFNAME_RB_INSERT(vrf, ifp) \
303 if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \
1c50c1c0
QY
304 flog_err(EC_LIB_INTERFACE, \
305 "%s(%s): corruption detected -- interface with this " \
306 "name exists already in VRF %u!", \
307 __func__, (ifp)->name, (ifp)->vrf_id);
ff880b78
RW
308
309#define IFNAME_RB_REMOVE(vrf, ifp) \
310 if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \
1c50c1c0
QY
311 flog_err(EC_LIB_INTERFACE, \
312 "%s(%s): corruption detected -- interface with this " \
313 "name doesn't exist in VRF %u!", \
314 __func__, (ifp)->name, (ifp)->vrf_id);
ff880b78
RW
315
316#define IFINDEX_RB_INSERT(vrf, ifp) \
317 if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \
1c50c1c0
QY
318 flog_err(EC_LIB_INTERFACE, \
319 "%s(%u): corruption detected -- interface with this " \
320 "ifindex exists already in VRF %u!", \
321 __func__, (ifp)->ifindex, (ifp)->vrf_id);
ff880b78
RW
322
323#define IFINDEX_RB_REMOVE(vrf, ifp) \
324 if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \
1c50c1c0
QY
325 flog_err(EC_LIB_INTERFACE, \
326 "%s(%u): corruption detected -- interface with this " \
327 "ifindex doesn't exist in VRF %u!", \
328 __func__, (ifp)->ifindex, (ifp)->vrf_id);
ff880b78 329
451fda4f
RW
330#define FOR_ALL_INTERFACES(vrf, ifp) \
331 if (vrf) \
332 RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name)
333
334#define FOR_ALL_INTERFACES_ADDRESSES(ifp, connected, node) \
335 for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, connected))
336
ce19a04a
DL
337/* called from the library code whenever interfaces are created/deleted
338 * note: interfaces may not be fully realized at that point; also they
339 * may not exist in the system (ifindex = IFINDEX_INTERNAL)
340 *
341 * priority values are important here, daemons should be at 0 while modules
342 * can use 1000+ so they run after the daemon has initialised daemon-specific
343 * interface data
344 */
996c9314
LB
345DECLARE_HOOK(if_add, (struct interface * ifp), (ifp))
346DECLARE_KOOH(if_del, (struct interface * ifp), (ifp))
ce19a04a 347
cde1af84
AK
348#define METRIC_MAX (~0)
349
718e3744 350/* Connected address structure. */
d62a17ae 351struct connected {
352 /* Attached interface. */
353 struct interface *ifp;
718e3744 354
d62a17ae 355 /* Flags for configuration. */
d7c0a89a 356 uint8_t conf;
718e3744 357#define ZEBRA_IFC_REAL (1 << 0)
358#define ZEBRA_IFC_CONFIGURED (1 << 1)
f7f740fe 359#define ZEBRA_IFC_QUEUED (1 << 2)
d62a17ae 360 /*
361 The ZEBRA_IFC_REAL flag should be set if and only if this address
362 exists in the kernel and is actually usable. (A case where it exists
363 but
364 is not yet usable would be IPv6 with DAD)
365 The ZEBRA_IFC_CONFIGURED flag should be set if and only if this
366 address
367 was configured by the user from inside quagga.
368 The ZEBRA_IFC_QUEUED flag should be set if and only if the address
369 exists
370 in the kernel. It may and should be set although the address might
371 not be
372 usable yet. (compare with ZEBRA_IFC_REAL)
373 */
374
375 /* Flags for connected address. */
d7c0a89a 376 uint8_t flags;
e4529636
AS
377#define ZEBRA_IFA_SECONDARY (1 << 0)
378#define ZEBRA_IFA_PEER (1 << 1)
525c1839 379#define ZEBRA_IFA_UNNUMBERED (1 << 2)
d62a17ae 380 /* N.B. the ZEBRA_IFA_PEER flag should be set if and only if
381 a peer address has been configured. If this flag is set,
382 the destination field must contain the peer address.
383 Otherwise, if this flag is not set, the destination address
384 will either contain a broadcast address or be NULL.
385 */
386
387 /* Address of connected network. */
388 struct prefix *address;
389
390 /* Peer or Broadcast address, depending on whether ZEBRA_IFA_PEER is
391 set.
392 Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */
393 struct prefix *destination;
394
395 /* Label for Linux 2.2.X and upper. */
396 char *label;
cde1af84
AK
397
398 /*
399 * Used for setting the connected route's cost. If the metric
400 * here is set to METRIC_MAX the connected route falls back to
401 * "struct interface"
402 */
403 uint32_t metric;
718e3744 404};
405
a80beece 406/* Nbr Connected address structure. */
d62a17ae 407struct nbr_connected {
408 /* Attached interface. */
409 struct interface *ifp;
a80beece 410
d62a17ae 411 /* Address of connected network. */
412 struct prefix *address;
a80beece
DS
413};
414
e4529636
AS
415/* Does the destination field contain a peer address? */
416#define CONNECTED_PEER(C) CHECK_FLAG((C)->flags, ZEBRA_IFA_PEER)
417
418/* Prefix to insert into the RIB */
d62a17ae 419#define CONNECTED_PREFIX(C) \
e4529636 420 (CONNECTED_PEER(C) ? (C)->destination : (C)->address)
3fb9cd6e 421
e4529636
AS
422/* Identifying address. We guess that if there's a peer address, but the
423 local address is in the same prefix, then the local address may be unique. */
d62a17ae 424#define CONNECTED_ID(C) \
425 ((CONNECTED_PEER(C) && !prefix_match((C)->destination, (C)->address)) \
426 ? (C)->destination \
427 : (C)->address)
3fb9cd6e 428
718e3744 429/* There are some interface flags which are only supported by some
430 operating system. */
431
432#ifndef IFF_NOTRAILERS
433#define IFF_NOTRAILERS 0x0
434#endif /* IFF_NOTRAILERS */
435#ifndef IFF_OACTIVE
436#define IFF_OACTIVE 0x0
437#endif /* IFF_OACTIVE */
438#ifndef IFF_SIMPLEX
439#define IFF_SIMPLEX 0x0
440#endif /* IFF_SIMPLEX */
441#ifndef IFF_LINK0
442#define IFF_LINK0 0x0
443#endif /* IFF_LINK0 */
444#ifndef IFF_LINK1
445#define IFF_LINK1 0x0
446#endif /* IFF_LINK1 */
447#ifndef IFF_LINK2
448#define IFF_LINK2 0x0
449#endif /* IFF_LINK2 */
4ba9b924 450#ifndef IFF_NOXMIT
451#define IFF_NOXMIT 0x0
452#endif /* IFF_NOXMIT */
453#ifndef IFF_NORTEXCH
454#define IFF_NORTEXCH 0x0
455#endif /* IFF_NORTEXCH */
456#ifndef IFF_IPV4
457#define IFF_IPV4 0x0
458#endif /* IFF_IPV4 */
459#ifndef IFF_IPV6
460#define IFF_IPV6 0x0
461#endif /* IFF_IPV6 */
462#ifndef IFF_VIRTUAL
463#define IFF_VIRTUAL 0x0
464#endif /* IFF_VIRTUAL */
718e3744 465
466/* Prototypes. */
36de6e0e 467extern int if_cmp_name_func(const char *p1, const char *p2);
d62a17ae 468
14fcc65c
DS
469/*
470 * Passing in VRF_UNKNOWN is a valid thing to do, unless we
471 * are creating a new interface.
472 *
473 * This is useful for vrf route-leaking. So more than anything
474 * else think before you use VRF_UNKNOWN
475 */
d62a17ae 476extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
996c9314 477extern struct interface *if_create(const char *name, vrf_id_t vrf_id);
d62a17ae 478extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
479extern struct interface *if_lookup_exact_address(void *matchaddr, int family,
480 vrf_id_t vrf_id);
481extern struct connected *if_lookup_address(void *matchaddr, int family,
482 vrf_id_t vrf_id);
483extern struct interface *if_lookup_prefix(struct prefix *prefix,
484 vrf_id_t vrf_id);
8736158a 485
92a57eb2 486/* These 3 functions are to be used when the ifname argument is terminated
08dbfb69 487 by a '\0' character: */
d62a17ae 488extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
489extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
8f90d89b 490extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id);
ff880b78 491extern void if_set_index(struct interface *ifp, ifindex_t ifindex);
a349198f 492
d2fc8896 493/* Delete the interface, but do not free the structure, and leave it in the
d62a17ae 494 interface list. It is often advisable to leave the pseudo interface
d2fc8896 495 structure because there may be configuration information attached. */
d62a17ae 496extern void if_delete_retain(struct interface *);
d2fc8896 497
498/* Delete and free the interface structure: calls if_delete_retain and then
499 deletes it from the interface list and frees the structure. */
d62a17ae 500extern void if_delete(struct interface *);
501
6339042c
MS
502extern int if_is_up(const struct interface *ifp);
503extern int if_is_running(const struct interface *ifp);
504extern int if_is_operative(const struct interface *ifp);
505extern int if_is_no_ptm_operative(const struct interface *ifp);
506extern int if_is_loopback(const struct interface *ifp);
507extern int if_is_vrf(const struct interface *ifp);
508extern bool if_is_loopback_or_vrf(const struct interface *ifp);
509extern int if_is_broadcast(const struct interface *ifp);
510extern int if_is_pointopoint(const struct interface *ifp);
511extern int if_is_multicast(const struct interface *ifp);
f4e14fdb
RW
512struct vrf;
513extern void if_terminate(struct vrf *vrf);
d62a17ae 514extern void if_dump_all(void);
847947f2 515extern const char *if_flag_dump(unsigned long);
d62a17ae 516extern const char *if_link_type_str(enum zebra_link_type);
718e3744 517
d2fc8896 518/* Please use ifindex2ifname instead of if_indextoname where possible;
519 ifindex2ifname uses internal interface info, whereas if_indextoname must
520 make a system call. */
d62a17ae 521extern const char *ifindex2ifname(ifindex_t, vrf_id_t vrf_id);
d2fc8896 522
523/* Please use ifname2ifindex instead of if_nametoindex where possible;
524 ifname2ifindex uses internal interface info, whereas if_nametoindex must
525 make a system call. */
128c2be2 526extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id);
d2fc8896 527
718e3744 528/* Connected address functions. */
d62a17ae 529extern struct connected *connected_new(void);
530extern void connected_free(struct connected *);
531extern void connected_add(struct interface *, struct connected *);
532extern struct connected *
533connected_add_by_prefix(struct interface *, struct prefix *, struct prefix *);
534extern struct connected *connected_delete_by_prefix(struct interface *,
535 struct prefix *);
536extern struct connected *connected_lookup_prefix(struct interface *,
537 struct prefix *);
538extern struct connected *connected_lookup_prefix_exact(struct interface *,
539 struct prefix *);
540extern struct nbr_connected *nbr_connected_new(void);
541extern void nbr_connected_free(struct nbr_connected *);
542struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *);
718e3744 543
16f1b9ee 544/* link parameters */
d62a17ae 545struct if_link_params *if_link_params_get(struct interface *);
546void if_link_params_free(struct interface *);
16f1b9ee 547
a4bed468
RW
548/* Northbound. */
549extern void if_cmd_init(void);
550extern const struct frr_yang_module_info frr_interface_info;
551
5e244469
RW
552#ifdef __cplusplus
553}
554#endif
555
718e3744 556#endif /* _ZEBRA_IF_H */