struct buffered_update {
unsigned char id[8];
unsigned char prefix[16];
unsigned char src_prefix[16];
unsigned char plen;
unsigned char src_plen;
unsigned char pad[2];
};
#define IF_TYPE_DEFAULT 0
#define IF_TYPE_WIRED 1
#define IF_TYPE_WIRELESS 2
#define IF_TYPE_TUNNEL 3
struct key {
char *id;
int type;
int len;
unsigned char *value;
unsigned short ref_count;
};
struct interface_conf {
char *ifname;
unsigned hello_interval;
unsigned update_interval;
unsigned short cost;
char type;
char split_horizon;
char lq;
char faraway;
char unicast;
char enable_timestamps;
char rfc6126;
char accept_bad_signatures;
char v4viav6;
char probe_mtu;
unsigned int rtt_decay;
unsigned int rtt_min;
unsigned int rtt_max;
unsigned int max_rtt_penalty;
struct key *key;
struct interface_conf *next;
};
#define CONFIG_DEFAULT 0
#define CONFIG_NO 1
#define CONFIG_YES 2
#define IF_UP (1 << 0)
#define IF_WIRELESS (1<<1)
#define IF_SPLIT_HORIZON (1 << 2)
#define IF_LQ (1 << 3)
#define IF_FARAWAY (1 << 4)
#define IF_UNICAST (1 << 5)
#define IF_TIMESTAMPS (1 << 6)
#define IF_RFC6126 (1 << 7)
#define IF_ACCEPT_BAD_SIGNATURES (1 << 8)
#define IF_DTLS (1 << 9)
#define IF_V4VIAV6 (1 << 10)
#define IF_PROBE_MTU (1 << 11)
#define IF_CHANNEL_UNKNOWN 0
#define IF_CHANNEL_INTERFERING 255
#define IF_CHANNEL_NONINTERFERING -2
struct buffered {
struct sockaddr_in6 sin6;
unsigned char *buf;
int len;
int size;
int flush_interval;
struct timeval timeout;
char have_id;
char have_nh;
char have_prefix;
unsigned char id[8];
unsigned char nh[4];
unsigned char prefix[16];
int hello;
};
#define INDEX_LEN 8
struct interface {
struct interface *next;
struct interface_conf *conf;
unsigned int ifindex;
unsigned short flags;
unsigned short cost;
struct timeval hello_timeout;
struct timeval update_timeout;
struct timeval update_flush_timeout;
char name[IF_NAMESIZE];
unsigned char *ipv4;
int numll;
unsigned char (*ll)[16];
struct buffered buf;
struct buffered_update *buffered_updates;
int num_buffered_updates;
int update_bufsize;
time_t last_update_time;
unsigned short hello_seqno;
unsigned hello_interval;
unsigned update_interval;
unsigned int rtt_decay;
unsigned int rtt_min;
unsigned int rtt_max;
unsigned int max_rtt_penalty;
struct key *key;
unsigned int pc;
unsigned char index[INDEX_LEN];
};
#define IF_CONF(_ifp, _field) \
((_ifp)->conf ? (_ifp)->conf->_field : 0)
extern struct interface *interfaces;
#define FOR_ALL_INTERFACES(_ifp) for(_ifp = interfaces; _ifp; _ifp = _ifp->next)
static inline int
if_up(struct interface *ifp)
{
return !!(ifp->flags & IF_UP);
}
struct interface *add_interface(char *ifname, struct interface_conf *if_conf);
int flush_interface(char *ifname);
unsigned jitter(struct buffered *buf, int urgent);
unsigned update_jitter(struct interface *ifp, int urgent);
void set_timeout(struct timeval *timeout, int msecs);
int interface_updown(struct interface *ifp, int up);
int interface_ll_address(struct interface *ifp, const unsigned char *address);
void check_interfaces(void);