diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/ospf/dbdes.c | 4 | ||||
-rw-r--r-- | proto/ospf/hello.c | 4 | ||||
-rw-r--r-- | proto/ospf/iface.c | 1 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 2 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 36 | ||||
-rw-r--r-- | proto/ospf/rt.c | 6 | ||||
-rw-r--r-- | proto/ospf/topology.c | 4 |
7 files changed, 43 insertions, 14 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 7bc87c5..2b65b1a 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -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 */ diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index bc5e876..73721d1 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -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; diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 054ea7c..25d3441 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -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); diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index d948d65..ccdc502 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -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 */ diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 2a499f7..ea77aa9 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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 diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index cee1589..3d2ee51 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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; } diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 215765e..c368d91 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -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; |