Revision a7a7372a proto/ospf/ospf.h

View differences:

proto/ospf/ospf.h
102 102
struct ospf_config
103 103
{
104 104
  struct proto_config c;
105
  unsigned tick;
105
  uint tick;
106 106
  byte ospf2;
107 107
  byte rfc1583;
108 108
  byte stub_router;
......
110 110
  byte abr;
111 111
  byte asbr;
112 112
  int ecmp;
113
  list area_list;		/* list of struct ospf_area_config */
114
  list vlink_list;		/* list of struct ospf_iface_patt */
113
  list area_list;		/* list of area configs (struct ospf_area_config) */
114
  list vlink_list;		/* list of configured vlinks (struct ospf_iface_patt) */
115 115
};
116 116

  
117
struct nbma_node
117
struct ospf_area_config
118 118
{
119 119
  node n;
120
  ip_addr ip;
121
  byte eligible;
122
  byte found; 
120
  u32 areaid;
121
  u32 default_cost;		/* Cost of default route for stub areas
122
				   (With possible LSA_EXT3_EBIT for NSSA areas) */
123
  u8 type;			/* Area type (standard, stub, NSSA), represented
124
				   by option flags (OPT_E, OPT_N) */
125
  u8 summary;			/* Import summaries to this stub/NSSA area, valid for ABR */
126
  u8 default_nssa;		/* Generate default NSSA route for NSSA+summary area */
127
  u8 translator;		/* Translator role, for NSSA ABR */
128
  u32 transint;			/* Translator stability interval */
129
  list patt_list;		/* List of iface configs (struct ospf_iface_patt) */
130
  list net_list;	      	/* List of aggregate networks for that area */
131
  list enet_list;	      	/* List of aggregate external (NSSA) networks */
132
  list stubnet_list;		/* List of stub networks added to Router LSA */
123 133
};
124 134

  
125 135
struct area_net_config
......
148 158
  u8 summary;
149 159
};
150 160

  
151
struct ospf_area_config
161
struct nbma_node
152 162
{
153 163
  node n;
154
  u32 areaid;
155
  u32 default_cost;		/* Cost of default route for stub areas
156
				   (With possible LSA_EXT3_EBIT for NSSA areas) */
157
  u8 type;			/* Area type (standard, stub, NSSA), represented
158
				   by option flags (OPT_E, OPT_N) */
159
  u8 summary;			/* Import summaries to this stub/NSSA area, valid for ABR */
160
  u8 default_nssa;		/* Generate default NSSA route for NSSA+summary area */
161
  u8 translator;		/* Translator role, for NSSA ABR */
162
  u32 transint;			/* Translator stability interval */
163
  list patt_list;
164
  list net_list;	      	/* List of aggregate networks for that area */
165
  list enet_list;	      	/* List of aggregate external (NSSA) networks */
166
  list stubnet_list;		/* List of stub networks added to Router LSA */
164
  ip_addr ip;
165
  byte eligible;
166
  byte found; 
167 167
};
168 168

  
169
struct ospf_iface_patt
170
{
171
  struct iface_patt i;
172
  u32 type;
173
  u32 stub;
174
  u32 cost;
175
  u32 helloint;
176
  u32 rxmtint;
177
  u32 pollint;
178
  u32 waitint;
179
  u32 deadc;
180
  u32 deadint;
181
  u32 inftransdelay;
182
  list nbma_list;
183
  u32 priority;
184
  u32 voa;
185
  u32 vid;
186
  int tx_tos;
187
  int tx_priority;
188
  u16 tx_length;
189
  u16 rx_buffer;
169 190

  
170
/* Generic option flags */
171
#define OPT_V6	0x01		/* OSPFv3, LSA relevant for IPv6 routing calculation */
172
#define OPT_E	0x02		/* Related to AS-external LSAs */
173
#define OPT_MC	0x04		/* Related to MOSPF, not used and obsolete */
174
#define OPT_N	0x08		/* Related to NSSA */
175
#define OPT_P	0x08		/* OSPFv2, flags P and N share position, see NSSA RFC */
176
#define OPT_EA	0x10		/* OSPFv2, external attributes, not used and obsolete */
177
#define OPT_R	0x10		/* OSPFv3, originator is active router */
178
#define OPT_DC	0x20		/* Related to demand circuits, not used */
179

  
180
/* Router-LSA VEB flags are are stored together with links (OSPFv2) or options (OSPFv3) */
181
#define OPT_RT_B  (0x01 << 24)
182
#define OPT_RT_E  (0x02 << 24)
183
#define OPT_RT_V  (0x04 << 24)
184
#define OPT_RT_NT (0x10 << 24)
185

  
186
/* Prefix flags, specific for OSPFv3 */
187
#define OPT_PX_NU 0x01
188
#define OPT_PX_LA 0x02
189
#define OPT_PX_P  0x08
190
#define OPT_PX_DN 0x10
191

  
192

  
193
/* OSPF interface types */
194
#define OSPF_IT_BCAST	0
195
#define OSPF_IT_NBMA	1
196
#define OSPF_IT_PTP	2
197
#define OSPF_IT_PTMP	3
198
#define OSPF_IT_VLINK	4
199
#define OSPF_IT_UNDEF	5
200

  
201
/* OSPF interface states */
202
#define OSPF_IS_DOWN	0	/* Not active */
203
#define OSPF_IS_LOOP	1	/* Iface with no link */
204
#define OSPF_IS_WAITING	2	/* Waiting for Wait timer */
205
#define OSPF_IS_PTP	3	/* PTP operational */
206
#define OSPF_IS_DROTHER	4	/* I'm on BCAST or NBMA and I'm not DR */
207
#define OSPF_IS_BACKUP	5	/* I'm BDR */
208
#define OSPF_IS_DR	6	/* I'm DR */
209

  
191
#define OSPF_RXBUF_MINSIZE 256	/* Minimal allowed size */
192
  u8 instance_id;
193
  u8 autype;			/* Not really used in OSPFv3 */
194
#define OSPF_AUTH_NONE 0
195
#define OSPF_AUTH_SIMPLE 1
196
#define OSPF_AUTH_CRYPT 2
197
#define OSPF_AUTH_CRYPT_SIZE 16
198
  u8 strictnbma;
199
  u8 check_link;
200
  u8 ecmp_weight;
201
  u8 link_lsa_suppression;
202
  u8 real_bcast;		/* Not really used in OSPFv3 */
203
  u8 ptp_netmask;		/* bool + 2 for unspecified */
204
  u8 ttl_security;		/* bool + 2 for TX only */
205
  u8 bfd;
206
  u8 bsd_secondary;
207
  list *passwords;
208
};
210 209

  
211 210
/* Default values for interface parameters */
212 211
#define COST_D 10
......
220 219
  /* Value of Wait timer - not found it in RFC * - using 4*HELLO */
221 220

  
222 221

  
222

  
223
struct ospf_proto
224
{
225
  struct proto p;
226
  timer *disp_timer;		/* OSPF proto dispatcher */
227
  uint tick;
228
  struct top_graph *gr;		/* LSA graph */
229
  slist lsal;			/* List of all LSA's */
230
  int calcrt;			/* Routing table calculation scheduled?
231
				   0=no, 1=normal, 2=forced reload */
232
  list iface_list;		/* List of OSPF interfaces (struct ospf_iface) */
233
  list area_list;		/* List of OSPF areas (struct ospf_area) */
234
  int areano;			/* Number of area I belong to */
235
  int padj;			/* Number of neighbors in Exchange or Loading state */
236
  struct fib rtf;		/* Routing table */
237
  byte ospf2;			/* OSPF v2 or v3 */
238
  byte rfc1583;			/* RFC1583 compatibility */
239
  byte stub_router;		/* Do not forward transit traffic */
240
  byte merge_external;		/* Should i merge external routes? */
241
  byte asbr;			/* May i originate any ext/NSSA lsa? */
242
  byte ecmp;			/* Maximal number of nexthops in ECMP route, or 0 */
243
  struct ospf_area *backbone;	/* If exists */
244
  void *lsab;			/* LSA buffer used when originating router LSAs */
245
  int lsab_size, lsab_used;
246
  linpool *nhpool;		/* Linpool used for next hops computed in SPF */
247
  sock *vlink_sk;		/* IP socket used for vlink TX */
248
  u32 router_id;
249
  u32 last_vlink_id;		/* Interface IDs for vlinks (starts at 0x80000000) */
250
};
251

  
252
struct ospf_area
253
{
254
  node n;
255
  u32 areaid;
256
  struct ospf_area_config *ac;	/* Related area config */
257
  struct top_hash_entry *rt;	/* My own router LSA */
258
  struct top_hash_entry *pxr_lsa; /* Originated prefix LSA */
259
  list cand;			/* List of candidates for RT calc. */
260
  struct fib net_fib;		/* Networks to advertise or not */
261
  struct fib enet_fib;		/* External networks for NSSAs */
262
  u32 options;			/* Optional features */
263
  u8 update_rt_lsa;		/* Rt lsa origination scheduled? */
264
  u8 trcap;			/* Transit capability? */
265
  u8 marked;			/* Used in OSPF reconfigure */
266
  u8 translate;			/* Translator state (TRANS_*), for NSSA ABR  */
267
  timer *translator_timer;	/* For NSSA translator switch */
268
  struct ospf_proto *po;
269
  struct fib rtr;		/* Routing tables for routers */
270
};
271

  
272

  
273

  
223 274
struct ospf_iface
224 275
{
225 276
  node n;
......
231 282

  
232 283
  pool *pool;
233 284
  sock *sk;			/* IP socket */
234
  list neigh_list;		/* List of neigbours */
285
  list neigh_list;		/* List of neigbours (struct ospf_neighbor) */
235 286
  u32 cost;			/* Cost of iface */
236 287
  u32 waitint;			/* number of sec before changing state from wait */
237 288
  u32 rxmtint;			/* number of seconds between LSA retransmissions */
......
295 346
  u8 bfd;			/* Use BFD on iface */
296 347
};
297 348

  
349
struct ospf_neighbor
350
{
351
  node n;
352
  pool *pool;
353
  struct ospf_iface *ifa;
354
  u8 state;
355
  timer *inactim;		/* Inactivity timer */
356
  u8 imms;			/* I, M, Master/slave received */
357
  u8 myimms;			/* I, M Master/slave */
358
  u32 dds;			/* DD Sequence number being sent */
359
  u32 ddr;			/* last Dat Des packet received */
360

  
361
  u32 rid;			/* Router ID */
362
  ip_addr ip;			/* IP of it's interface */
363
  u8 priority;			/* Priority */
364
  u8 adj;			/* built adjacency? */
365
  u8 want_lsreq;		/* Set to 1 when lsrql was shortened during LSUPD */
366
  u32 options;			/* Options received */
367

  
368
  /* Entries dr and bdr store IP addresses in OSPFv2 and router IDs in
369
     OSPFv3, we use the same type to simplify handling */
370
  u32 dr;			/* Neigbour's idea of DR */
371
  u32 bdr;			/* Neigbour's idea of BDR */
372
  u32 iface_id;			/* ID of Neighbour's iface connected to common network */
373

  
374
  /* Database summary list iterator, controls initial dbdes exchange.
375
   * Advances in the LSA list as dbdes packets are sent.
376
   */
377
  siterator dbsi;		/* iterator of po->lsal */
378

  
379
  /* Link state request list, controls initial LSA exchange.
380
   * Entries added when received in dbdes packets, removed as sent in lsreq packets.
381
   */
382
  slist lsrql;			/* slist of struct top_hash_entry from n->lsrqh */
383
  struct top_graph *lsrqh;
384

  
385
  /* Link state retransmission list, controls LSA retransmission during flood.
386
   * Entries added as sent in lsupd packets, removed when received in lsack packets.
387
   * These entries hold ret_count in appropriate LSA entries.
388
   */
389
  slist lsrtl;			/* slist of struct top_hash_entry from n->lsrth */
390
  struct top_graph *lsrth;
391
  timer *rxmt_timer;		/* RXMT timer */
392
  list ackl[2];
393
#define ACKL_DIRECT 0
394
#define ACKL_DELAY 1
395
  timer *ackd_timer;		/* Delayed ack timer */
396
  struct bfd_request *bfd_req;	/* BFD request, if BFD is used */
397
  void *ldd_buffer;		/* Last database description packet */
398
  u32 ldd_bsize;		/* Buffer size for ldd_buffer */
399
  u32 csn;                      /* Last received crypt seq number (for MD5) */
400
};
401

  
402

  
403
/* OSPF interface types */
404
#define OSPF_IT_BCAST	0
405
#define OSPF_IT_NBMA	1
406
#define OSPF_IT_PTP	2
407
#define OSPF_IT_PTMP	3
408
#define OSPF_IT_VLINK	4
409
#define OSPF_IT_UNDEF	5
410

  
411
/* OSPF interface states */
412
#define OSPF_IS_DOWN	0	/* Not active */
413
#define OSPF_IS_LOOP	1	/* Iface with no link */
414
#define OSPF_IS_WAITING	2	/* Waiting for Wait timer */
415
#define OSPF_IS_PTP	3	/* PTP operational */
416
#define OSPF_IS_DROTHER	4	/* I'm on BCAST or NBMA and I'm not DR */
417
#define OSPF_IS_BACKUP	5	/* I'm BDR */
418
#define OSPF_IS_DR	6	/* I'm DR */
419

  
420
/* Definitions for interface state machine */
421
#define ISM_UP		0	/* Interface Up */
422
#define ISM_WAITF	1	/* Wait timer fired */
423
#define ISM_BACKS	2	/* Backup seen */
424
#define ISM_NEICH	3	/* Neighbor change */
425
#define ISM_LOOP	4	/* Link down */
426
#define ISM_UNLOOP	5	/* Link up */
427
#define ISM_DOWN	6	/* Interface down */
428

  
429

  
430
/* OSPF neighbor states */
431
#define NEIGHBOR_DOWN	0
432
#define NEIGHBOR_ATTEMPT 1
433
#define NEIGHBOR_INIT	2
434
#define NEIGHBOR_2WAY	3
435
#define NEIGHBOR_EXSTART 4
436
#define NEIGHBOR_EXCHANGE 5
437
#define NEIGHBOR_LOADING 6
438
#define NEIGHBOR_FULL	7
439

  
440
/* Definitions for neighbor state machine */
441
#define INM_HELLOREC	0	/* Hello Received */
442
#define INM_START	1	/* Neighbor start - for NBMA */
443
#define INM_2WAYREC	2	/* 2-Way received */
444
#define INM_NEGDONE	3	/* Negotiation done */
445
#define INM_EXDONE	4	/* Exchange done */
446
#define INM_BADLSREQ	5	/* Bad LS Request */
447
#define INM_LOADDONE	6	/* Load done */
448
#define INM_ADJOK	7	/* AdjOK? */
449
#define INM_SEQMIS	8	/* Sequence number mismatch */
450
#define INM_1WAYREC	9	/* 1-Way */
451
#define INM_KILLNBR	10	/* Kill Neighbor */
452
#define INM_INACTTIM	11	/* Inactivity timer */
453
#define INM_LLDOWN	12	/* Line down */
454

  
455
#define TRANS_OFF	0
456
#define TRANS_ON	1
457
#define TRANS_WAIT	2	/* Waiting before the end of translation */
458

  
459

  
460

  
461
/* Generic option flags */
462
#define OPT_V6		0x01	/* OSPFv3, LSA relevant for IPv6 routing calculation */
463
#define OPT_E		0x02	/* Related to AS-external LSAs */
464
#define OPT_MC		0x04	/* Related to MOSPF, not used and obsolete */
465
#define OPT_N		0x08	/* Related to NSSA */
466
#define OPT_P		0x08	/* OSPFv2, flags P and N share position, see NSSA RFC */
467
#define OPT_EA		0x10	/* OSPFv2, external attributes, not used and obsolete */
468
#define OPT_R		0x10	/* OSPFv3, originator is active router */
469
#define OPT_DC		0x20	/* Related to demand circuits, not used */
470

  
471
/* Router-LSA VEB flags are are stored together with links (OSPFv2) or options (OSPFv3) */
472
#define OPT_RT_B	(0x01 << 24)
473
#define OPT_RT_E	(0x02 << 24)
474
#define OPT_RT_V	(0x04 << 24)
475
#define OPT_RT_NT	(0x10 << 24)
476

  
477
/* Prefix flags, specific for OSPFv3 */
478
#define OPT_PX_NU	0x01
479
#define OPT_PX_LA	0x02
480
#define OPT_PX_P	0x08
481
#define OPT_PX_DN	0x10
482

  
483

  
484
struct ospf_packet
485
{
486
  u8 version;
487
  u8 type;
488
  u16 length;
489
  u32 routerid;
490
  u32 areaid;
491
  u16 checksum;
492
  u8 instance_id;		/* See RFC 6549 */
493
  u8 autype;			/* Undefined for OSPFv3 */
494
};
495

  
298 496
struct ospf_md5
299 497
{
300 498
  u16 zero;
......
309 507
  struct ospf_md5 md5;
310 508
};
311 509

  
312

  
313 510
/* Packet types */
314 511
#define HELLO_P		1	/* Hello */
315 512
#define DBDES_P		2	/* Database description */
......
317 514
#define LSUPD_P		4	/* Link state update */
318 515
#define LSACK_P		5	/* Link state acknowledgement */
319 516

  
320
/* Area IDs */
321
#define BACKBONE	0
322 517

  
323 518
#define DBDES_I		4	/* Init bit */
324 519
#define DBDES_M		2	/* More bit */
......
326 521
#define DBDES_IMMS	(DBDES_I | DBDES_M | DBDES_MS)
327 522

  
328 523

  
329
struct ospf_packet
330
{
331
  u8 version;
332
  u8 type;
333
  u16 length;
334
  u32 routerid;
335
  u32 areaid;
336
  u16 checksum;
337
  u8 instance_id;		/* See RFC 6549 */
338
  u8 autype;			/* Undefined for OSPFv3 */
339
};
340

  
341

  
342 524
#define LSA_T_RT	0x2001
343 525
#define LSA_T_NET	0x2002
344 526
#define LSA_T_SUM_NET	0x2003
......
530 712
};
531 713

  
532 714

  
533
static inline unsigned
715
static inline uint
534 716
lsa_net_count(struct ospf_lsa_header *lsa)
535 717
{
536 718
  return (lsa->length - sizeof(struct ospf_lsa_header) - sizeof(struct ospf_lsa_net))
......
558 740

  
559 741
  *addr = IPA_NONE;
560 742

  
743
#ifdef IPV6
561 744
  if (pxl > 0)
562 745
    _I0(*addr) = *buf++;
563 746
  if (pxl > 32)
......
570 753
  /* Clean up remaining bits */
571 754
  if (pxl < 128)
572 755
    addr->addr[pxl / 32] &= u32_mkmask(pxl % 32);
756
#endif
573 757

  
574 758
  return buf;
575 759
}
......
613 797
};
614 798

  
615 799

  
616
struct ospf_neighbor
617
{
618
  node n;
619
  pool *pool;
620
  struct ospf_iface *ifa;
621
  u8 state;
622
#define NEIGHBOR_DOWN 0
623
#define NEIGHBOR_ATTEMPT 1
624
#define NEIGHBOR_INIT 2
625
#define NEIGHBOR_2WAY 3
626
#define NEIGHBOR_EXSTART 4
627
#define NEIGHBOR_EXCHANGE 5
628
#define NEIGHBOR_LOADING 6
629
#define NEIGHBOR_FULL 7
630
  timer *inactim;		/* Inactivity timer */
631
  u8 imms;			/* I, M, Master/slave received */
632
  u8 myimms;			/* I, M Master/slave */
633
  u32 dds;			/* DD Sequence number being sent */
634
  u32 ddr;			/* last Dat Des packet received */
635

  
636
  u32 rid;			/* Router ID */
637
  ip_addr ip;			/* IP of it's interface */
638
  u8 priority;			/* Priority */
639
  u8 adj;			/* built adjacency? */
640
  u32 options;			/* Options received */
641

  
642
  /* Entries dr and bdr store IP addresses in OSPFv2 and router IDs in
643
     OSPFv3, we use the same type to simplify handling */
644
  u32 dr;			/* Neigbour's idea of DR */
645
  u32 bdr;			/* Neigbour's idea of BDR */
646
  u32 iface_id;			/* ID of Neighbour's iface connected to common network */
647

  
648
  /* Database summary list iterator, controls initial dbdes exchange.
649
   * Advances in the LSA list as dbdes packets are sent.
650
   */
651
  siterator dbsi;		/* iterator of po->lsal */
652

  
653
  /* Link state request list, controls initial LSA exchange.
654
   * Entries added when received in dbdes packets, removed as sent in lsreq packets.
655
   */
656
  slist lsrql;			/* slist of struct top_hash_entry from n->lsrqh */
657
  struct top_graph *lsrqh;
658

  
659
  /* Link state retransmission list, controls LSA retransmission during flood.
660
   * Entries added as sent in lsupd packets, removed when received in lsack packets.
661
   */
662
  slist lsrtl;			/* slist of struct top_hash_entry from n->lsrth */
663
  struct top_graph *lsrth;
664
  timer *rxmt_timer;		/* RXMT timer */
665
  list ackl[2];
666
#define ACKL_DIRECT 0
667
#define ACKL_DELAY 1
668
  timer *ackd_timer;		/* Delayed ack timer */
669
  struct bfd_request *bfd_req;	/* BFD request, if BFD is used */
670
  void *ldd_buffer;		/* Last database description packet */
671
  u32 ldd_bsize;		/* Buffer size for ldd_buffer */
672
  u32 csn;                      /* Last received crypt seq number (for MD5) */
673
};
674

  
675
/* Definitions for interface state machine */
676
#define ISM_UP 0		/* Interface Up */
677
#define ISM_WAITF 1		/* Wait timer fired */
678
#define ISM_BACKS 2		/* Backup seen */
679
#define ISM_NEICH 3		/* Neighbor change */
680
#define ISM_LOOP 4		/* Link down */
681
#define ISM_UNLOOP 5		/* Link up */
682
#define ISM_DOWN 6		/* Interface down */
683

  
684
/* Definitions for neighbor state machine */
685
#define INM_HELLOREC 0		/* Hello Received */
686
#define INM_START 1		/* Neighbor start - for NBMA */
687
#define INM_2WAYREC 2		/* 2-Way received */
688
#define INM_NEGDONE 3		/* Negotiation done */
689
#define INM_EXDONE 4		/* Exchange done */
690
#define INM_BADLSREQ 5		/* Bad LS Request */
691
#define INM_LOADDONE 6		/* Load done */
692
#define INM_ADJOK 7		/* AdjOK? */
693
#define INM_SEQMIS 8		/* Sequence number mismatch */
694
#define INM_1WAYREC 9		/* 1-Way */
695
#define INM_KILLNBR 10		/* Kill Neighbor */
696
#define INM_INACTTIM 11		/* Inactivity timer */
697
#define INM_LLDOWN 12		/* Line down */
698

  
699
struct ospf_area
700
{
701
  node n;
702
  u32 areaid;
703
  struct ospf_area_config *ac;	/* Related area config */
704
  struct top_hash_entry *rt;	/* My own router LSA */
705
  struct top_hash_entry *pxr_lsa; /* Originated prefix LSA */
706
  list cand;			/* List of candidates for RT calc. */
707
  struct fib net_fib;		/* Networks to advertise or not */
708
  struct fib enet_fib;		/* External networks for NSSAs */
709
  u32 options;			/* Optional features */
710
  u8 update_rt_lsa;		/* Rt lsa origination scheduled? */
711
  u8 trcap;			/* Transit capability? */
712
  u8 marked;			/* Used in OSPF reconfigure */
713
  u8 translate;			/* Translator state (TRANS_*), for NSSA ABR  */
714
  timer *translator_timer;	/* For NSSA translator switch */
715
  struct ospf_proto *po;
716
  struct fib rtr;		/* Routing tables for routers */
717
};
718

  
719
#define TRANS_OFF	0
720
#define TRANS_ON	1
721
#define TRANS_WAIT	2	/* Waiting before the end of translation */
722

  
723
struct ospf_proto
724
{
725
  struct proto p;
726
  timer *disp_timer;		/* OSPF proto dispatcher */
727
  unsigned tick;
728
  struct top_graph *gr;		/* LSA graph */
729
  slist lsal;			/* List of all LSA's */
730
  int calcrt;			/* Routing table calculation scheduled?
731
				   0=no, 1=normal, 2=forced reload */
732
  list iface_list;		/* Interfaces we really use */
733
  list area_list;
734
  int areano;			/* Number of area I belong to */
735
  int padj;			/* Number of neighbors in Exchange or Loading state */
736
  struct fib rtf;		/* Routing table */
737
  byte ospf2;			/* OSPF v2 or v3 */
738
  byte rfc1583;			/* RFC1583 compatibility */
739
  byte stub_router;		/* Do not forward transit traffic */
740
  byte merge_external;		/* Should i merge external routes? */
741
  byte asbr;			/* May i originate any ext/NSSA lsa? */
742
  byte ecmp;			/* Maximal number of nexthops in ECMP route, or 0 */
743
  struct ospf_area *backbone;	/* If exists */
744
  void *lsab;			/* LSA buffer used when originating router LSAs */
745
  int lsab_size, lsab_used;
746
  linpool *nhpool;		/* Linpool used for next hops computed in SPF */
747
  sock *vlink_sk;		/* IP socket used for vlink TX */
748
  u32 router_id;
749
  u32 last_vlink_id;		/* Interface IDs for vlinks (starts at 0x80000000) */
750
};
751

  
752
struct ospf_iface_patt
753
{
754
  struct iface_patt i;
755
  u32 type;
756
  u32 stub;
757
  u32 cost;
758
  u32 helloint;
759
  u32 rxmtint;
760
  u32 pollint;
761
  u32 waitint;
762
  u32 deadc;
763
  u32 deadint;
764
  u32 inftransdelay;
765
  list nbma_list;
766
  u32 priority;
767
  u32 voa;
768
  u32 vid;
769
  int tx_tos;
770
  int tx_priority;
771
  u16 tx_length;
772
  u16 rx_buffer;
773

  
774
#define OSPF_RXBUF_MINSIZE 256	/* Minimal allowed size */
775
  u8 instance_id;
776
  u8 autype;			/* Not really used in OSPFv3 */
777
#define OSPF_AUTH_NONE 0
778
#define OSPF_AUTH_SIMPLE 1
779
#define OSPF_AUTH_CRYPT 2
780
#define OSPF_AUTH_CRYPT_SIZE 16
781
  u8 strictnbma;
782
  u8 check_link;
783
  u8 ecmp_weight;
784
  u8 link_lsa_suppression;
785
  u8 real_bcast;		/* Not really used in OSPFv3 */
786
  u8 ptp_netmask;		/* bool + 2 for unspecified */
787
  u8 ttl_security;		/* bool + 2 for TX only */
788
  u8 bfd;
789
  u8 bsd_secondary;
790
  list *passwords;
791
};
792

  
793 800

  
794 801
#define SH_ROUTER_SELF 0xffffffff
795 802

  
......
810 817

  
811 818

  
812 819
/* ospf.c */
813
void schedule_rtcalc(struct ospf_proto *p);
820
void ospf_schedule_rtcalc(struct ospf_proto *p);
814 821

  
815 822
static inline void ospf_notify_rt_lsa(struct ospf_area *oa)
816 823
{ oa->update_rt_lsa = 1; }
......
822 829
{ ifa->update_link_lsa = 1; }
823 830

  
824 831

  
832
#define ospf_is_v2(X) OSPF_IS_V2
833
#define ospf_is_v3(X) (!OSPF_IS_V2)
834
/*
825 835
static inline int ospf_is_v2(struct ospf_proto *p)
826 836
{ return p->ospf2; }
827 837

  
828 838
static inline int ospf_is_v3(struct ospf_proto *p)
829 839
{ return ! p->ospf2; }
830

  
840
*/
831 841
static inline int ospf_get_version(struct ospf_proto *p)
832 842
{ return ospf_is_v2(p) ? 2 : 3; }
833 843

  
......
920 930
void ospf_receive_hello(struct ospf_packet *pkt, struct ospf_iface *ifa, struct ospf_neighbor *n, ip_addr faddr);
921 931

  
922 932
/* dbdes.c */
923
void ospf_send_dbdes(struct ospf_neighbor *n, int next);
933
void ospf_send_dbdes(struct ospf_proto *p, struct ospf_neighbor *n, int next);
924 934
void ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa, struct ospf_neighbor *n);
925 935

  
926 936
/* lsreq.c */
......
930 940
/* lsupd.c */
931 941
void ospf_dump_lsahdr(struct ospf_proto *p, struct ospf_lsa_header *lsa_n);
932 942
void ospf_dump_common(struct ospf_proto *p, struct ospf_packet *pkt);
933
int ospf_lsupd_flood(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_neighbor *from);
943
void ospf_add_flushed_to_lsrt(struct ospf_proto *p, struct ospf_neighbor *n);
944
int ospf_flood_lsa(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_neighbor *from);
934 945
int ospf_send_lsupd(struct ospf_proto *p, struct top_hash_entry **lsa_list, uint lsa_count, struct ospf_neighbor *n);
935 946
void ospf_rxmt_lsupd(struct ospf_proto *p, struct ospf_neighbor *n);
936 947
void ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa, struct ospf_neighbor *n);
......
938 949
/* lsack.c */
939 950
void ospf_enqueue_lsack(struct ospf_neighbor *n, struct ospf_lsa_header *h_n, int queue);
940 951
void ospf_reset_lsack_queue(struct ospf_neighbor *n);
941
void ospf_lsack_send(struct ospf_neighbor *n, int queue);
952
void ospf_send_lsack(struct ospf_proto *p, struct ospf_neighbor *n, int queue);
942 953
void ospf_receive_lsack(struct ospf_packet *pkt, struct ospf_iface *ifa, struct ospf_neighbor *n);
943 954

  
944 955

  

Also available in: Unified diff