]>
git.ipfire.org Git - thirdparty/bird.git/blob - nest/iface.h
2 * BIRD Internet Routing Daemon -- Network Interfaces
4 * (c) 1998 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
10 #define _BIRD_IFACE_H_
12 #include "lib/lists.h"
14 extern list iface_list
;
21 unsigned index
; /* OS-dependent interface index */
22 ip_addr ip
; /* IP address of this host */
23 ip_addr prefix
; /* Network prefix */
24 unsigned pxlen
; /* Prefix length */
25 ip_addr brd
; /* Broadcast address */
26 ip_addr opposite
; /* Opposite end of a point-to-point link */
27 struct neighbor
*neigh
; /* List of neighbors on this interface */
31 #define IF_MULTIACCESS 2
32 #define IF_UNNUMBERED 4
33 #define IF_BROADCAST 8
34 #define IF_MULTICAST 16
36 #define IF_ADMIN_DOWN 64
37 #define IF_LOOPBACK 128
39 #define IF_UPDATED 0x1000 /* Touched in last scan */
41 /* Interface change events */
43 #define IF_CHANGE_UP 1
44 #define IF_CHANGE_DOWN 2
45 #define IF_CHANGE_FLAGS 4 /* Can be converted to down/up internally */
46 #define IF_CHANGE_MTU 8
47 #define IF_CHANGE_CREATE 16 /* Seen this interface for the first time */
50 void if_dump(struct iface
*);
51 void if_dump_all(void);
52 void if_update(struct iface
*);
53 void if_end_update(void);
56 * Neighbor Cache. We hold (direct neighbor, protocol) pairs we've seen
57 * along with pointer to protocol-specific data.
59 * The primary goal of this cache is to quickly validate all incoming
60 * packets if their have been sent by our neighbors and to notify
61 * protocols about lost neighbors when an interface goes down.
63 * Anyway, it can also contain `sticky' entries for currently unreachable
64 * addresses which cause notification when the address becomes a neighbor.
67 typedef struct neighbor
{
68 node n
; /* Node in global neighbor list */
69 ip_addr addr
; /* Address of the neighbor */
70 struct iface
*iface
; /* Interface address it's connected to */
71 struct neighbor
*sibling
; /* Next in per-device chain */
72 struct proto
*proto
; /* Protocol this belongs to */
73 void *data
; /* Protocol-specific data */
80 * Find neighbor or return NULL if it doesn't exist.
81 * If you specify flags == NEF_STICKY, a sticky entry is created if the
82 * address is not a neighbor, but NULL can still be returned if the address
85 neighbor
*neigh_find(struct proto
*, ip_addr
*, unsigned flags
);
87 void neigh_dump(neighbor
*);
88 void neigh_dump_all(void);