OSPF instance id option and documentation update.

This commit is contained in:
Ondrej Zajicek 2014-07-21 21:50:56 +02:00
parent 742029eb78
commit 178a197afb
4 changed files with 61 additions and 38 deletions

View file

@ -2288,6 +2288,7 @@ networks.
<code> <code>
protocol ospf &lt;name&gt; { protocol ospf &lt;name&gt; {
rfc1583compat &lt;switch&gt;; rfc1583compat &lt;switch&gt;;
instance id &lt;num&gt;;
stub router &lt;switch&gt;; stub router &lt;switch&gt;;
tick &lt;num&gt;; tick &lt;num&gt;;
ecmp &lt;switch&gt; [limit &lt;num&gt;]; ecmp &lt;switch&gt; [limit &lt;num&gt;];
@ -2375,14 +2376,24 @@ protocol ospf &lt;name&gt; {
RFC 1583 <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">. RFC 1583 <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">.
Default value is no. Default value is no.
<tag>instance id <m/num/</tag>
When multiple OSPF protocol instances are active on the same links, they
should use different instance IDs to distinguish their packets. Although
it could be done on per-interface basis, it is often preferred to set
one instance ID to whole OSPF domain/topology (e.g., when multiple
instances are used to represent separate logical topologies on the same
physical network). This option specifies the default instance ID for all
interfaces of the OSPF instance. Note that this option, if used, must
precede interface definitions. Default value is 0.
<tag>stub router <M>switch</M></tag> <tag>stub router <M>switch</M></tag>
This option configures the router to be a stub router, i.e., a router This option configures the router to be a stub router, i.e., a router
that participates in the OSPF topology but does not allow transit that participates in the OSPF topology but does not allow transit
traffic. In OSPFv2, this is implemented by advertising maximum metric traffic. In OSPFv2, this is implemented by advertising maximum metric
for outgoing links, as suggested by for outgoing links. In OSPFv3, the stub router behavior is announced by
RFC 3137 <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc3137.txt">. clearing the R-bit in the router LSA. See RFC 6987
In OSPFv3, the stub router behavior is announced by clearing the R-bit <htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc6987.txt"> for
in the router LSA. Default value is no. details. Default value is no.
<tag>tick <M>num</M></tag> <tag>tick <M>num</M></tag>
The routing table calculation and clean-up of areas' databases is not The routing table calculation and clean-up of areas' databases is not
@ -2489,17 +2500,21 @@ protocol ospf &lt;name&gt; {
Defines that the specified interfaces belong to the area being defined. Defines that the specified interfaces belong to the area being defined.
See <ref id="dsc-iface" name="interface"> common option for detailed See <ref id="dsc-iface" name="interface"> common option for detailed
description. In OSPFv2, extended interface clauses are used, because description. In OSPFv2, extended interface clauses are used, because
OSPFv2 handles each network prefix as a separate virtual interface. In each network prefix is handled as a separate virtual interface.
OSPFv3, you can specify instance ID for that interface description, so
it is possible to have several instances of that interface with You can specify alternative instance ID for the interface definition,
different options or even in different areas. therefore it is possible to have several instances of that interface
with different options or even in different areas. For OSPFv2,
instance ID support is an extension (RFC 6549
<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc6549.txt">) and is
supposed to be set per-protocol. For OSPFv3, it is an integral feature.
<tag>virtual link <M>id</M> [instance <m/num/]</tag> <tag>virtual link <M>id</M> [instance <m/num/]</tag>
Virtual link to router with the router id. Virtual link acts as a Virtual link to router with the router id. Virtual link acts as a
point-to-point interface belonging to backbone. The actual area is used point-to-point interface belonging to backbone. The actual area is used
as transport area. This item cannot be in the backbone. In OSPFv3, you as a transport area. This item cannot be in the backbone. Like with
could also use several virtual links to one destination with different <cf/interface/ option, you could also use several virtual links to one
instance IDs. destination with different instance IDs.
<tag>cost <M>num</M></tag> <tag>cost <M>num</M></tag>
Specifies output cost (metric) of an interface. Default value is 10. Specifies output cost (metric) of an interface. Default value is 10.
@ -2530,7 +2545,7 @@ protocol ospf &lt;name&gt; {
<tag>wait <M>num</M></tag> <tag>wait <M>num</M></tag>
After start, router waits for the specified number of seconds between After start, router waits for the specified number of seconds between
starting election and building adjacency. Default value is 40. starting election and building adjacency. Default value is 4*<m/hello/.
<tag>dead count <M>num</M></tag> <tag>dead count <M>num</M></tag>
When the router does not receive any messages from a neighbor in When the router does not receive any messages from a neighbor in

View file

@ -32,6 +32,9 @@ ospf_iface_finish(void)
if (ip->deadint == 0) if (ip->deadint == 0)
ip->deadint = ip->deadc * ip->helloint; ip->deadint = ip->deadc * ip->helloint;
if (ip->waitint == 0)
ip->waitint = ip->deadc * ip->helloint;
ip->passwords = get_passwords(); ip->passwords = get_passwords();
if ((ip->autype == OSPF_AUTH_CRYPT) && (ip->helloint < 5)) if ((ip->autype == OSPF_AUTH_CRYPT) && (ip->helloint < 5))
@ -159,6 +162,7 @@ ospf_proto_item:
| ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); } | ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); }
| MERGE EXTERNAL bool { OSPF_CFG->merge_external = $3; } | MERGE EXTERNAL bool { OSPF_CFG->merge_external = $3; }
| TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); } | TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); }
| INSTANCE ID expr { OSPF_CFG->instance_id = $3; if (($3<0) || ($3>255)) cf_error("Instance ID must be in range 0-255"); }
| ospf_area | ospf_area
; ;
@ -239,9 +243,9 @@ ospf_vlink_opts:
ospf_vlink_item: ospf_vlink_item:
| HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); } | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
| RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); } | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=1) cf_error("Retransmit int must be greater than one"); }
| TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); } | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
| WAIT expr { OSPF_PATT->waitint = $2 ; } | WAIT expr { OSPF_PATT->waitint = $2 ; if ($2<=1) cf_error("Wait interval must be greater than one"); }
| DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); } | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
| DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); } | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
| AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE; } | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE; }
@ -261,12 +265,10 @@ ospf_vlink_start: VIRTUAL LINK idval
OSPF_PATT->helloint = HELLOINT_D; OSPF_PATT->helloint = HELLOINT_D;
OSPF_PATT->rxmtint = RXMTINT_D; OSPF_PATT->rxmtint = RXMTINT_D;
OSPF_PATT->inftransdelay = INFTRANSDELAY_D; OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
OSPF_PATT->deadc = DEADC_D; OSPF_PATT->deadc = DEADC_D;
OSPF_PATT->deadint = 0;
OSPF_PATT->type = OSPF_IT_VLINK; OSPF_PATT->type = OSPF_IT_VLINK;
OSPF_PATT->instance_id = OSPF_CFG->instance_id;
init_list(&OSPF_PATT->nbma_list); init_list(&OSPF_PATT->nbma_list);
OSPF_PATT->autype = OSPF_AUTH_NONE;
reset_passwords(); reset_passwords();
} }
; ;
@ -275,8 +277,8 @@ ospf_iface_item:
COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); } COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); }
| HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); } | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
| POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); } | POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); }
| RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); } | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=1) cf_error("Retransmit int must be greater than one"); }
| WAIT expr { OSPF_PATT->waitint = $2 ; } | WAIT expr { OSPF_PATT->waitint = $2 ; if ($2<=1) cf_error("Wait interval must be greater than one"); }
| DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); } | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
| DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); } | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
| TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; } | TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
@ -365,12 +367,10 @@ ospf_iface_start:
OSPF_PATT->rxmtint = RXMTINT_D; OSPF_PATT->rxmtint = RXMTINT_D;
OSPF_PATT->inftransdelay = INFTRANSDELAY_D; OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
OSPF_PATT->priority = PRIORITY_D; OSPF_PATT->priority = PRIORITY_D;
OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
OSPF_PATT->deadc = DEADC_D; OSPF_PATT->deadc = DEADC_D;
OSPF_PATT->deadint = 0;
OSPF_PATT->type = OSPF_IT_UNDEF; OSPF_PATT->type = OSPF_IT_UNDEF;
OSPF_PATT->instance_id = OSPF_CFG->instance_id;
init_list(&OSPF_PATT->nbma_list); init_list(&OSPF_PATT->nbma_list);
OSPF_PATT->autype = OSPF_AUTH_NONE;
OSPF_PATT->ptp_netmask = 2; /* not specified */ OSPF_PATT->ptp_netmask = 2; /* not specified */
OSPF_PATT->tx_tos = IP_PREC_INTERNET_CONTROL; OSPF_PATT->tx_tos = IP_PREC_INTERNET_CONTROL;
OSPF_PATT->tx_priority = sk_priority_control; OSPF_PATT->tx_priority = sk_priority_control;
@ -380,7 +380,7 @@ ospf_iface_start:
ospf_instance_id: ospf_instance_id:
/* empty */ /* empty */
| INSTANCE expr { OSPF_PATT->instance_id = $2; } | INSTANCE expr { OSPF_PATT->instance_id = $2; if (($2<0) || ($2>255)) cf_error("Instance ID must be in range 0-255"); }
; ;
ospf_iface_patt_list: ospf_iface_patt_list:

View file

@ -87,6 +87,13 @@
* we have recalculated and also those we have deleted to the core's routing * we have recalculated and also those we have deleted to the core's routing
* table and the core will take care of the rest. This simplifies the process * table and the core will take care of the rest. This simplifies the process
* and conserves memory. * and conserves memory.
*
* Supported standards:
* - RFC 2328 - main OSPFv2 standard
* - RFC 5340 - main OSPFv3 standard
* - RFC 3101 - OSPFv2 NSSA areas
* - RFC 6549 - OSPFv2 multi-instance extensions
* - RFC 6987 - OSPF stub router advertisement
*/ */
#include <stdlib.h> #include <stdlib.h>

View file

@ -103,12 +103,13 @@ struct ospf_config
{ {
struct proto_config c; struct proto_config c;
uint tick; uint tick;
byte ospf2; u8 ospf2;
byte rfc1583; u8 rfc1583;
byte stub_router; u8 stub_router;
byte merge_external; u8 merge_external;
byte abr; u8 instance_id;
byte asbr; u8 abr;
u8 asbr;
int ecmp; int ecmp;
list area_list; /* list of area configs (struct ospf_area_config) */ list area_list; /* list of area configs (struct ospf_area_config) */
list vlink_list; /* list of configured vlinks (struct ospf_iface_patt) */ list vlink_list; /* list of configured vlinks (struct ospf_iface_patt) */