2 * Structures for RIP protocol
4 FIXME: in V6, they insert additional entry whenever next hop differs. Such entry is identified by 0xff in metric.
7 #include "nest/route.h"
8 #include "nest/password.h"
9 #include "nest/locks.h"
11 #define EA_RIP_TAG EA_CODE(EAP_RIP, 0)
12 #define EA_RIP_METRIC EA_CODE(EAP_RIP, 1)
15 #define PACKET_MD5_MAX 18 /* FIXME */
20 #define RIP_NG 1 /* A new version numbering */
23 #define RIP_PORT 520 /* RIP for IPv4 */
25 #define RIP_PORT 521 /* RIPng */
28 struct rip_connection
{
35 struct rip_interface
*rif
;
36 struct fib_iterator iter
;
43 struct rip_packet_heading
{ /* 4 bytes */
45 #define RIPCMD_REQUEST 1 /* want info */
46 #define RIPCMD_RESPONSE 2 /* responding to request */
47 #define RIPCMD_TRACEON 3 /* turn tracing on */
48 #define RIPCMD_TRACEOFF 4 /* turn it off */
53 #define RIP_NG 1 /* this is verion 1 of RIPng */
58 struct rip_block
{ /* 20 bytes */
59 u16 family
; /* 0xffff on first message means this is authentication */
67 struct rip_block
{ /* IPv6 version!, 20 bytes, too */
75 struct rip_block_auth
{ /* 20 bytes */
86 struct rip_md5_tail
{ /* 20 bytes */
100 bird_clock_t updated
, changed
;
105 struct rip_packet_heading heading
;
106 struct rip_block block
[PACKET_MAX
];
109 struct rip_interface
{
114 struct rip_connection
*busy
;
115 int metric
; /* You don't want to put struct rip_patt *patt here -- think about reconfigure */
118 struct object_lock
*lock
;
125 int metric
; /* If you add entries here, don't forget to modify patt_compare! */
127 #define IM_BROADCAST 2
129 #define IM_NOLISTEN 8
130 #define IM_VERSION1 16
135 struct rip_proto_config
{
136 struct proto_config c
;
137 list iface_list
; /* Patterns configured -- keep it first; see rip_reconfigure why */
138 list
*passwords
; /* Passwords, keep second */
140 int infinity
; /* User configurable data; must be comparable with memcmp */
148 #define AT_PLAINTEXT 2
152 #define HO_NEIGHBOR 1
157 struct proto inherited
;
162 list interfaces
; /* Interfaces we really know about */
166 int tx_count
; /* Do one regular update once in a while */
167 int rnd_count
; /* Randomize sending time */
171 #define RIP_MAGIC 81861253
172 #define CHK_MAGIC do { if (P->magic != RIP_MAGIC) bug( "Not enough magic" ); } while (0)
174 #define CHK_MAGIC do { } while (0)
178 void rip_init_instance(struct proto
*p
);
179 void rip_init_config(struct rip_proto_config
*c
);
181 /* Authentication functions */
183 int rip_incoming_authentication( struct proto
*p
, struct rip_block_auth
*block
, struct rip_packet
*packet
, int num
, ip_addr whotoldme
);
184 int rip_outgoing_authentication( struct proto
*p
, struct rip_block_auth
*block
, struct rip_packet
*packet
, int num
);