]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Minor finalizations of link state checks.
authorOndrej Zajicek <santiago@crfreenet.org>
Fri, 19 Nov 2010 12:46:21 +0000 (13:46 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Fri, 19 Nov 2010 12:46:21 +0000 (13:46 +0100)
doc/bird.sgml
proto/ospf/config.Y
proto/ospf/hello.c
proto/ospf/iface.c
proto/ospf/neighbor.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/static/config.Y
proto/static/static.c
proto/static/static.h

index 53d9fcd075e4b986036fe9e5910b17e132ee2b41..1eaf382d47b69401eb45909c4a8c5720dc9fff35 100644 (file)
@@ -1675,7 +1675,7 @@ protocol ospf &lt;name&gt; {
        <tag>rx buffer <M>num</M></tag>
         This sets the size of buffer used for receiving packets. The buffer should
         be bigger than maximal size of any packets. Value NORMAL (default)
-        means 2*MTU, value LARGE means maximal allowed packet - 65536.
+        means 2*MTU, value LARGE means maximal allowed packet - 65535.
 
        <tag>type broadcast</tag>
         BIRD detects a type of a connected network automatically, but sometimes it's
@@ -1695,6 +1695,14 @@ protocol ospf &lt;name&gt; {
         If set, don't send hello to any undefined neighbor. This switch
         is ignored on any non-NBMA network. Default is No.
 
+       <tag>check link <M>switch</M></tag>
+        if set, a hardware link state (reported by OS) is taken into
+        consideration. When a link disappears (e.g. an ethernet cable is
+        unplugged), neighbors are immediately considered unreachable
+        and only the address of the iface (instead of whole network
+        prefix) is propagated. It is possible that some hardware
+        drivers or platforms do not implement this feature. Default: off.
+
        <tag>authentication none</tag>
         No passwords are sent in OSPF packets. This is the default value.
 
@@ -2045,8 +2053,8 @@ the next hop of the route is not a neighbor at the moment), Static just
 uninstalls the route from the table it is connected to and adds it again as soon
 as the destination becomes adjacent again.
 
-<p>The Static protocol has no configuration options. Instead, the
-definition of the protocol contains a list of static routes:
+<p>The Static protocol does not have many configuration options. The
+definition of the protocol contains mainly a list of static routes:
 
 <descrip>
        <tag>route <m/prefix/ via <m/ip/</tag> Static route through
@@ -2056,6 +2064,14 @@ definition of the protocol contains a list of static routes:
        <tag>route <m/prefix/ drop|reject|prohibit</tag> Special routes
        specifying to drop the packet, return it as unreachable or return
        it as administratively prohibited.
+
+       <tag>check link <M>switch</M></tag>
+       The only option of the static protocol. If set, hardware link
+       states of network interfaces are taken into consideration.
+       When link disappears (e.g. ethernet cable is unplugged),
+       static routes directing to that interface are removed. It is
+       possible that some hardware drivers or platforms do not
+       implement this feature. Default: off.
 </descrip>
 
 <p>Static routes have no specific attributes.
index 49d65942deeb261b6d34c09a6828c7018ec48c51..3af879d6d04706a723fd41039a081c1a62913a26 100644 (file)
@@ -49,7 +49,7 @@ CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG, OSPF_ROUTER_ID)
 CF_KEYWORDS(BROADCAST, NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
 CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, NONBROADCAST, POINTOPOINT, TYPE)
 CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
-CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, LINK)
+CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
 CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY)
 CF_KEYWORDS(WAIT, DELAY, LSADB)
 
@@ -192,7 +192,7 @@ ospf_iface_item:
  | TYPE POINTOPOINT { OSPF_PATT->type = OSPF_IT_PTP ; }
  | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
  | STUB bool { OSPF_PATT->stub = $2 ; }
- | LINK bool { OSPF_PATT->use_link = $2 ; }
+ | CHECK LINK bool { OSPF_PATT->check_link = $3; }
  | NEIGHBORS '{' ipa_list '}'
  | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE ; }
  | AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE ; }
@@ -274,9 +274,6 @@ ospf_iface_start:
   OSPF_PATT->deadc = DEADC_D;
   OSPF_PATT->dead = 0;
   OSPF_PATT->type = OSPF_IT_UNDEF;
-  OSPF_PATT->strictnbma = 0;
-  OSPF_PATT->stub = 0;
-  OSPF_PATT->use_link = 1;
   init_list(&OSPF_PATT->nbma_list);
   OSPF_PATT->autype = OSPF_AUTH_NONE;
   reset_passwords();
index 3d7d8de3677ed81340e5b59202bf3f70890082c0..216dc72f7027a373790d64ed6c2ccb570c462c5a 100644 (file)
@@ -247,7 +247,7 @@ ospf_hello_send(timer *timer, int poll, struct ospf_neighbor *dirn)
   else
     ifa = (struct ospf_iface *) timer->data;
 
-  if (ifa->state == OSPF_IS_DOWN)
+  if (ifa->state <= OSPF_IS_LOOP)
     return;
 
   if (ifa->stub)
index 072e1c71900395760513b6994ca3e862478d1121..83ea1c294a602ece1a676811ae31fe1ac0921159 100644 (file)
@@ -334,7 +334,7 @@ ospf_iface_sm(struct ospf_iface *ifa, int event)
     break;
 
   case ISM_LOOP:
-    if (ifa->sk && ifa->use_link)
+    if (ifa->sk && ifa->check_link)
       ospf_iface_chstate(ifa, OSPF_IS_LOOP);
     break;
 
@@ -401,7 +401,7 @@ ospf_iface_add(struct object_lock *lock)
   }
 
   /* Do iface UP, unless there is no link and we use link detection */
-  ospf_iface_sm(ifa, (ifa->use_link && !(ifa->iface->flags & IF_LINK_UP)) ? ISM_LOOP : ISM_UP);
+  ospf_iface_sm(ifa, (ifa->check_link && !(ifa->iface->flags & IF_LINK_UP)) ? ISM_LOOP : ISM_UP);
 }
 
 void
@@ -435,7 +435,7 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr,
   ifa->stub = ospf_iface_stubby(ip, addr);
   ifa->ioprob = OSPF_I_OK;
   ifa->rxbuf = ip->rxbuf;
-  ifa->use_link = ip->use_link;
+  ifa->check_link = ip->check_link;
 
 #ifdef OSPFv2
   ifa->autype = ip->autype;
index 2563abd480ebd1292d88bee0e7e8e61e4179d43a..05f024a703b9fa5ca33861fd17ac515089937e66 100644 (file)
@@ -284,6 +284,7 @@ can_do_adj(struct ospf_neighbor *n)
     switch (ifa->state)
     {
     case OSPF_IS_DOWN:
+    case OSPF_IS_LOOP:
       bug("%s: Iface %s in down state?", p->name, ifa->iface->name);
       break;
     case OSPF_IS_WAITING:
index d9d8b7c49f019374fee5aa3fb5324620659a3efa..026d975146d50cd02f9630278b9109b224f937b8 100644 (file)
@@ -759,12 +759,12 @@ ospf_reconfigure(struct proto *p, struct proto_config *c)
        }
 
        /* LINK */
-       if (oldip->use_link != newip->use_link)
+       if (oldip->check_link != newip->check_link)
        {
-         ifa->use_link = newip->use_link;
+         ifa->check_link = newip->check_link;
 
          if (!(ifa->iface->flags & IF_LINK_UP))
-           ospf_iface_sm(ifa, ifa->use_link ? ISM_LOOP : ISM_UNLOOP);
+           ospf_iface_sm(ifa, ifa->check_link ? ISM_LOOP : ISM_UNLOOP);
        }
 
        /* strict nbma */
index 341d9a7c2120f1c7c59aa8f675927e466b3e0eac..3345d4fcd2b271140478222d7be42270827054a2 100644 (file)
@@ -246,7 +246,7 @@ struct ospf_iface
   u8 sk_spf;                   /* Socket is a member of SPFRouters group */
   u8 sk_dr;                    /* Socket is a member of DRouters group */
   u16 rxbuf;                   /* Buffer size */
-  u8 use_link;                 /* Whether iface link change is used */
+  u8 check_link;               /* Whether iface link change is used */
 };
 
 struct ospf_md5
@@ -755,7 +755,7 @@ struct ospf_iface_patt
   u32 stub;
   u32 vid;
   u16 rxbuf;
-  u8 use_link;
+  u8 check_link;
 #define OSPF_RXBUF_NORMAL 0
 #define OSPF_RXBUF_LARGE 1
 #define OSPF_RXBUF_MINSIZE 256 /* Minimal allowed size */
index 9f4d7da6f6b5077473e743165b5439bcaf6239e0..2849015b3c1ad614e610da9c0e33017b8b2bffc1 100644 (file)
@@ -32,7 +32,7 @@ static_proto_start: proto_start STATIC {
 static_proto:
    static_proto_start proto_name '{'
  | static_proto proto_item ';'
- | static_proto CHECK LINK ';' { STATIC_CFG->check = STATIC_CHECK_LINK; }
+ | static_proto CHECK LINK bool ';' { STATIC_CFG->check_link = $4; }
  | static_proto stat_route ';'
  ;
 
index 4f879bd3e2ef84360ddddd00e538fae70a359151..4ee2cbdb45d06102b23cfbfbadd9cb47039c9e67 100644 (file)
@@ -72,7 +72,7 @@ static_decide(struct static_config *cf, struct static_route *r)
   if (!ifa)
     return 0;
 
-  if ((cf->check == STATIC_CHECK_LINK) && !(ifa->flags & IF_LINK_UP))
+  if (cf->check_link && !(ifa->flags & IF_LINK_UP))
     return 0;
 
   return 1;
index 40da74c9a2d5dbd83dfdc4fcdf790de18cfd02ea..5c31e0091d6f667ff1da99b03465a544157ab0eb 100644 (file)
@@ -13,11 +13,9 @@ struct static_config {
   struct proto_config c;
   list iface_routes;           /* Routes to search on interface events */
   list other_routes;           /* Routes hooked to neighbor cache and reject routes */
-  int check;                   /* Condition for route install */
+  int check_link;              /* Whether iface link state is used */
 };
 
-#define STATIC_CHECK_NONE 0
-#define STATIC_CHECK_LINK 1
 
 void static_init_config(struct static_config *);