Revision 178a197a

View differences:

doc/bird.sgml
2288 2288
<code>
2289 2289
protocol ospf &lt;name&gt; {
2290 2290
	rfc1583compat &lt;switch&gt;;
2291
	instance id &lt;num&gt;;
2291 2292
	stub router &lt;switch&gt;;
2292 2293
	tick &lt;num&gt;;
2293 2294
	ecmp &lt;switch&gt; [limit &lt;num&gt;];
......
2375 2376
	RFC 1583 <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">.
2376 2377
	Default	value is no.
2377 2378

  
2379
	<tag>instance id <m/num/</tag>
2380
	When multiple OSPF protocol instances are active on the same links, they
2381
	should use different instance IDs to distinguish their packets. Although
2382
	it could be done on per-interface basis, it is often preferred to set
2383
	one instance ID to whole OSPF domain/topology (e.g., when multiple
2384
	instances are used to represent separate logical topologies on the same
2385
	physical network). This option specifies the default instance ID for all
2386
	interfaces of the OSPF instance. Note that this option, if used, must
2387
	precede interface definitions. Default value is 0.
2388

  
2378 2389
	<tag>stub router <M>switch</M></tag>
2379 2390
	This option configures the router to be a stub router, i.e., a router
2380 2391
	that participates in the OSPF topology but does not allow transit
2381 2392
	traffic. In OSPFv2, this is implemented by advertising maximum metric
2382
	for outgoing links, as suggested by
2383
	RFC 3137 <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc3137.txt">.
2384
	In OSPFv3, the stub router behavior is announced by clearing the R-bit
2385
	in the router LSA. Default value is no.
2393
	for outgoing links. In OSPFv3, the stub router behavior is announced by
2394
	clearing the R-bit in the router LSA. See RFC 6987
2395
	<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc6987.txt"> for
2396
	details. Default value is no.
2386 2397

  
2387 2398
	<tag>tick <M>num</M></tag>
2388 2399
	The routing table calculation and clean-up of areas' databases is not
......
2484 2495
	prefix. When option <cf/summary/ is used, also default stub networks
2485 2496
	that are subnetworks of given stub network are suppressed. This might be
2486 2497
	used, for example, to aggregate generated stub networks.
2487
	 
2498

  
2488 2499
	<tag>interface <M>pattern</M> [instance <m/num/]</tag>
2489 2500
	Defines that the specified interfaces belong to the area being defined.
2490 2501
	See <ref id="dsc-iface" name="interface"> common option for detailed
2491 2502
	description. In OSPFv2, extended interface clauses are used, because
2492
	OSPFv2 handles each network prefix as a separate virtual interface. In
2493
	OSPFv3, you can specify instance ID for that interface description, so
2494
	it is possible to have several instances of that interface with
2495
	different options or even in different areas.
2503
	each network prefix is handled as a separate virtual interface.
2504

  
2505
	You can specify alternative instance ID for the interface definition,
2506
	therefore it is possible to have several instances of that interface
2507
	with different options or even in different areas. For OSPFv2,
2508
	instance ID support is an extension (RFC 6549
2509
	<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc6549.txt">) and is
2510
	supposed to be set per-protocol. For OSPFv3, it is an integral feature.
2496 2511

  
2497 2512
	<tag>virtual link <M>id</M> [instance <m/num/]</tag>
2498 2513
	Virtual link to router with the router id. Virtual link acts as a
2499 2514
	point-to-point interface belonging to backbone. The actual area is used
2500
	as transport area. This item cannot be in the backbone. In OSPFv3, you
2501
	could also use several virtual links to one destination with different
2502
	instance IDs.
2515
	as a transport area. This item cannot be in the backbone. Like with
2516
	<cf/interface/ option, you could also use several virtual links to one
2517
	destination with different instance IDs.
2503 2518

  
2504 2519
	<tag>cost <M>num</M></tag>
2505 2520
	Specifies output cost (metric) of an interface. Default value is 10.
......
2530 2545

  
2531 2546
	<tag>wait <M>num</M></tag>
2532 2547
	After start, router waits for the specified number of seconds between
2533
	starting election and building adjacency. Default value is 40.
2534
	 
2548
	starting election and building adjacency. Default value is 4*<m/hello/.
2549

  
2535 2550
	<tag>dead count <M>num</M></tag>
2536 2551
	When the router does not receive any messages from a neighbor in
2537 2552
	<m/dead count/*<m/hello/ seconds, it will consider the neighbor down.
proto/ospf/config.Y
19 19
static struct nbma_node *this_nbma;
20 20
static list *this_nets;
21 21
static struct area_net_config *this_pref;
22
static struct ospf_stubnet_config *this_stubnet; 
22
static struct ospf_stubnet_config *this_stubnet;
23 23

  
24 24
static inline int ospf_cfg_is_v2(void) { return OSPF_CFG->ospf2; }
25 25
static inline int ospf_cfg_is_v3(void) { return ! OSPF_CFG->ospf2; }
......
32 32
  if (ip->deadint == 0)
33 33
    ip->deadint = ip->deadc * ip->helloint;
34 34

  
35
  if (ip->waitint == 0)
36
    ip->waitint = ip->deadc * ip->helloint;
37

  
35 38
  ip->passwords = get_passwords();
36 39

  
37 40
  if ((ip->autype == OSPF_AUTH_CRYPT) && (ip->helloint < 5))
......
159 162
 | ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); }
160 163
 | MERGE EXTERNAL bool { OSPF_CFG->merge_external = $3; }
161 164
 | TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); }
165
 | INSTANCE ID expr { OSPF_CFG->instance_id = $3; if (($3<0) || ($3>255)) cf_error("Instance ID must be in range 0-255"); }
162 166
 | ospf_area
163 167
 ;
164 168

  
......
213 217
     add_tail(&this_area->stubnet_list, NODE this_stubnet);
214 218
     this_stubnet->px = $1;
215 219
     this_stubnet->cost = COST_D;
216
   } 
220
   }
217 221
 ;
218 222

  
219 223
ospf_stubnet_opts:
......
239 243

  
240 244
ospf_vlink_item:
241 245
 | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
242
 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); }
246
 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=1) cf_error("Retransmit int must be greater than one"); }
243 247
 | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
244
 | WAIT expr { OSPF_PATT->waitint = $2 ; }
248
 | WAIT expr { OSPF_PATT->waitint = $2 ; if ($2<=1) cf_error("Wait interval must be greater than one"); }
245 249
 | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
246 250
 | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
247 251
 | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE;  }
......
261 265
  OSPF_PATT->helloint = HELLOINT_D;
262 266
  OSPF_PATT->rxmtint = RXMTINT_D;
263 267
  OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
264
  OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
265 268
  OSPF_PATT->deadc = DEADC_D;
266
  OSPF_PATT->deadint = 0;
267 269
  OSPF_PATT->type = OSPF_IT_VLINK;
270
  OSPF_PATT->instance_id = OSPF_CFG->instance_id;
268 271
  init_list(&OSPF_PATT->nbma_list);
269
  OSPF_PATT->autype = OSPF_AUTH_NONE;
270 272
  reset_passwords();
271 273
 }
272 274
;
......
275 277
   COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); }
276 278
 | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
277 279
 | POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); }
278
 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); }
279
 | WAIT expr { OSPF_PATT->waitint = $2 ; }
280
 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=1) cf_error("Retransmit int must be greater than one"); }
281
 | WAIT expr { OSPF_PATT->waitint = $2 ; if ($2<=1) cf_error("Wait interval must be greater than one"); }
280 282
 | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
281 283
 | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
282 284
 | TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
......
300 302
 | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE; }
301 303
 | AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE; ospf_check_auth(); }
302 304
 | AUTHENTICATION CRYPTOGRAPHIC { OSPF_PATT->autype = OSPF_AUTH_CRYPT; ospf_check_auth(); }
303
 | RX BUFFER NORMAL { OSPF_PATT->rx_buffer = 0; } 
304
 | RX BUFFER LARGE { OSPF_PATT->rx_buffer = OSPF_MAX_PKT_SIZE; } 
305
 | RX BUFFER NORMAL { OSPF_PATT->rx_buffer = 0; }
306
 | RX BUFFER LARGE { OSPF_PATT->rx_buffer = OSPF_MAX_PKT_SIZE; }
305 307
 | RX BUFFER expr { OSPF_PATT->rx_buffer = $3; if (($3 < OSPF_MIN_PKT_SIZE) || ($3 > OSPF_MAX_PKT_SIZE)) cf_error("Buffer size must be in range 256-65535"); }
306 308
 | TX tos { OSPF_PATT->tx_tos = $2; }
307 309
 | TX PRIORITY expr { OSPF_PATT->tx_priority = $3; }
......
344 346
 /* empty */ { $$ = 0; }
345 347
 | ELIGIBLE { $$ = 1; }
346 348
 ;
347
 
349

  
348 350
nbma_item: ipa nbma_eligible ';'
349 351
 {
350 352
   this_nbma = cfg_allocz(sizeof(struct nbma_node));
......
353 355
   this_nbma->eligible=$2;
354 356
 }
355 357
;
356
 
358

  
357 359
ospf_iface_start:
358 360
 {
359 361
  this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
......
365 367
  OSPF_PATT->rxmtint = RXMTINT_D;
366 368
  OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
367 369
  OSPF_PATT->priority = PRIORITY_D;
368
  OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
369 370
  OSPF_PATT->deadc = DEADC_D;
370
  OSPF_PATT->deadint = 0;
371 371
  OSPF_PATT->type = OSPF_IT_UNDEF;
372
  OSPF_PATT->instance_id = OSPF_CFG->instance_id;
372 373
  init_list(&OSPF_PATT->nbma_list);
373
  OSPF_PATT->autype = OSPF_AUTH_NONE;
374 374
  OSPF_PATT->ptp_netmask = 2; /* not specified */
375 375
  OSPF_PATT->tx_tos = IP_PREC_INTERNET_CONTROL;
376 376
  OSPF_PATT->tx_priority = sk_priority_control;
......
380 380

  
381 381
ospf_instance_id:
382 382
   /* empty */
383
 | INSTANCE expr { OSPF_PATT->instance_id = $2; }
383
 | INSTANCE expr { OSPF_PATT->instance_id = $2; if (($2<0) || ($2>255)) cf_error("Instance ID must be in range 0-255"); }
384 384
 ;
385 385

  
386 386
ospf_iface_patt_list:
387 387
   iface_patt_list { if (ospf_cfg_is_v3()) iface_patt_check(); } ospf_instance_id
388
 ; 
388
 ;
389 389

  
390 390
ospf_iface_opts:
391 391
   /* empty */
proto/ospf/ospf.c
87 87
 * we have recalculated and also those we have deleted to the core's routing
88 88
 * table and the core will take care of the rest. This simplifies the process
89 89
 * and conserves memory.
90
 *
91
 * Supported standards:
92
 * - RFC 2328 - main OSPFv2 standard
93
 * - RFC 5340 - main OSPFv3 standard
94
 * - RFC 3101 - OSPFv2 NSSA areas
95
 * - RFC 6549 - OSPFv2 multi-instance extensions
96
 * - RFC 6987 - OSPF stub router advertisement
90 97
 */
91 98

  
92 99
#include <stdlib.h>
proto/ospf/ospf.h
103 103
{
104 104
  struct proto_config c;
105 105
  uint tick;
106
  byte ospf2;
107
  byte rfc1583;
108
  byte stub_router;
109
  byte merge_external;
110
  byte abr;
111
  byte asbr;
106
  u8 ospf2;
107
  u8 rfc1583;
108
  u8 stub_router;
109
  u8 merge_external;
110
  u8 instance_id;
111
  u8 abr;
112
  u8 asbr;
112 113
  int ecmp;
113 114
  list area_list;		/* list of area configs (struct ospf_area_config) */
114 115
  list vlink_list;		/* list of configured vlinks (struct ospf_iface_patt) */

Also available in: Unified diff