]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Bugfix - options bits were not included in LSAs
authorOndrej Filip <feela@network.cz>
Tue, 13 Jul 2004 11:58:50 +0000 (11:58 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 13 Jul 2004 11:58:50 +0000 (11:58 +0000)
Bugfix - E bit was not unset on stub areas.

proto/ospf/dbdes.c
proto/ospf/hello.c
proto/ospf/iface.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/rt.c
proto/ospf/topology.c

index 7bc87c50b2533e1dc015e838dcf581adc8db3f76..2b65b1a34a8785ad9abbd45ce62a8003770ed3f0 100644 (file)
@@ -40,7 +40,7 @@ ospf_dbdes_send(struct ospf_neighbor *n)
     op = (struct ospf_packet *) pkt;
     ospf_pkt_fill_hdr(ifa, pkt, DBDES_P);
     pkt->iface_mtu = htons(ifa->iface->mtu);
-    pkt->options = ifa->options;
+    pkt->options = ifa->oa->opt.byte;
     pkt->imms = n->myimms;
     pkt->ddseq = htonl(n->dds);
     length = sizeof(struct ospf_dbdes_packet);
@@ -64,7 +64,7 @@ ospf_dbdes_send(struct ospf_neighbor *n)
 
       ospf_pkt_fill_hdr(ifa, pkt, DBDES_P);
       pkt->iface_mtu = htons(ifa->iface->mtu);
-      pkt->options = ifa->options;
+      pkt->options = ifa->oa->opt.byte;
       pkt->ddseq = htonl(n->dds);
 
       j = i = (ospf_pkt_maxsize(ifa) - sizeof(struct ospf_dbdes_packet)) / sizeof(struct ospf_lsa_header);     /* Number of possible lsaheaders to send */
index bc5e876387d129afeaf5539c45ac9474e45a6815..73721d1f64ca84207225ccb49beaa33d6b9afec1 100644 (file)
@@ -44,7 +44,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
     return;
   }
 
-  if (ps->options != ifa->options)
+  if (ps->options != ifa->oa->opt.byte)
   {
     log(L_ERR "%s%I%soptions mismatch (0x%x).", beg, faddr, rec, ps->options);
     return;
@@ -207,7 +207,7 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
   pkt->netmask = ipa_mkmask(ifa->iface->addr->pxlen);
   ipa_hton(pkt->netmask);
   pkt->helloint = ntohs(ifa->helloint);
-  pkt->options = ifa->options;
+  pkt->options = ifa->oa->opt.byte;
   pkt->priority = ifa->priority;
   pkt->deadint = htonl(ifa->deadc * ifa->helloint);
   pkt->dr = ifa->drip;
index 054ea7c1d2566ff37e9e4d689bd32485eb28433b..25d3441debcde5803569a986bd7319edc92886bb 100644 (file)
@@ -374,7 +374,6 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ospf_area_conf
   ifa->stub = ip->stub;
   ifa->autype = ip->autype;
   ifa->passwords = ip->passwords;
-  ifa->options = 2;            /* FIXME what options? */
 
   if (ip->type == OSPF_IT_UNDEF)
     ifa->type = ospf_iface_clasify(ifa->iface);
index d948d652c3664a7b95556c191f43a2c4d358fbef..ccdc502bc38619be2d0a6722be02601307106fa2 100644 (file)
@@ -150,6 +150,8 @@ ospf_start(struct proto *p)
     add_area_nets(oa, ac);
     fib_init(&oa->rtr, p->pool, sizeof(ort), 16, ospf_rt_initort);
     if (oa->areaid == 0) po->backbone = oa;
+    oa->opt.byte = 0;
+    if(!oa->stub) oa->opt.bit.e = 1;
   }
 
   /* Add all virtual links as interfaces */
index 2a499f751bc16b588c11d58f5ffb404d760fa18c..ea77aa9893171b21e30717e4383d9f3fcb6b3118 100644 (file)
@@ -95,6 +95,34 @@ struct ospf_area_config
   list net_list;
 };
 
+struct obits
+{
+#ifdef _BIG_ENDIAN
+  u8 unused2:2;
+  u8 dc:1;
+  u8 ea:1;
+  u8 np:1;
+  u8 mc:1;
+  u8 e:1;
+  u8 unused1:1;
+#else
+  u8 unused1:1;
+  u8 e:1;
+  u8 mc:1;
+  u8 np:1;
+  u8 ea:1;
+  u8 dc:1;
+  u8 unused2:2;
+#endif
+};
+
+union options
+{
+  u8 byte;
+  struct obits bit;
+};
+
+
 struct ospf_iface
 {
   node n;
@@ -111,8 +139,6 @@ struct ospf_iface
   u16 inftransdelay;           /* The estimated number of seconds it takes to
                                   transmit a Link State Update Packet over this
                                   interface.  LSAs contained in the update */
-  u8 priority;                 /* A router priority for DR election */
-  u16 helloint;                        /* number of seconds between hello sending */
   u32 waitint;                 /* number of sec before changing state from wait */
   u32 rxmtint;                 /* number of seconds between LSA retransmissions */
   u32 pollint;                 /* Poll interval */
@@ -121,7 +147,7 @@ struct ospf_iface
   ip_addr vip;                 /* IP of peer of virtual link */
   struct ospf_area *voa;       /* Area wich the vlink goes through */
   u16 autype;
-  u8 options;
+  u16 helloint;                        /* number of seconds between hello sending */
   list *passwords;
   u32 csn;                      /* Crypt seq num. that will be sent net */
   ip_addr drip;                        /* Designated router */
@@ -136,7 +162,6 @@ struct ospf_iface
 #define OSPF_IT_UNDEF 4
   u8 strictnbma;               /* Can I talk with unknown neighbors? */
   u8 stub;                     /* Inactive interface */
-  u8 ioprob;
 #define OSPF_I_OK 0            /* Everything OK */
 #define OSPF_I_MC 1            /* I didn't open MC socket */
 #define OSPF_I_IP 2            /* I didn't open IP socet */
@@ -166,6 +191,8 @@ struct ospf_iface
   int orignet;                 /* Schedule network LSA origination */
   int fadj;                    /* Number of full adjacent neigh */
   list nbma_list;
+  u8 priority;                 /* A router priority for DR election */
+  u8 ioprob;
 };
 
 struct ospf_md5
@@ -494,6 +521,7 @@ struct ospf_area
   struct proto_ospf *po;
   unsigned tick;
   struct fib rtr;              /* Routing tables for routers */
+  union options opt;            /* RFC2328 - A.2 */
 };
 
 struct proto_ospf
index cee1589e2c65811cc7735260e1b2ad1ef915253b..3d2ee513fbbc8b2ffa1b7210479d29b8f2f80804 100644 (file)
@@ -243,7 +243,7 @@ ospf_rt_spfa(struct ospf_area *oa)
          DBG("PTP found.\n");
          break;
        default:
-         log("Unknown link type in router lsa.");
+         log("Unknown link type in router lsa. (rid = %I)", act->lsa.id);
          break;
        }
        if (tmp)
@@ -339,7 +339,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
           }
          break;
        default:
-         log("Unknown link type in router lsa.");
+         log("Unknown link type in router lsa. (rid = %I)", fol->lsa.id);
          break;
        }
       }
@@ -357,7 +357,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
       }
       break;
     default:
-      log("Unknown link type in router lsa.");
+      bug("Unknown lsa type. (id = %I)", fol->lsa.id);
   }
   return 0;
 }
index 215765e640cb9217c9cd61cf9e4e4fed10a93ce5..c368d91f6f92fcf767b57730c7fbf6451e98100b 100644 (file)
@@ -190,7 +190,7 @@ originate_rt_lsa(struct ospf_area *oa)
   lsa.id = rtid;
   lsa.type = LSA_T_RT;
   lsa.rt = rtid;
-  lsa.options = 0;
+  lsa.options = oa->opt.byte;
   if (oa->rt == NULL)
   {
     lsa.sn = LSA_INITSEQNO;
@@ -290,7 +290,7 @@ originate_net_lsa(struct ospf_iface *ifa)
   lsa.id = ipa_to_u32(ifa->iface->addr->ip);
   lsa.type = LSA_T_NET;
   lsa.rt = rtid;
-  lsa.options = 0;
+  lsa.options = ifa->oa->opt.byte;
   if (ifa->nlsa == NULL)
   {
     lsa.sn = LSA_INITSEQNO;