Bugfix - options bits were not included in LSAs

Bugfix - E bit was not unset on stub areas.
This commit is contained in:
Ondrej Filip 2004-07-13 11:58:50 +00:00
parent 9baece57d3
commit 621ccdfe5a
7 changed files with 43 additions and 14 deletions

View file

@ -40,7 +40,7 @@ ospf_dbdes_send(struct ospf_neighbor *n)
op = (struct ospf_packet *) pkt; op = (struct ospf_packet *) pkt;
ospf_pkt_fill_hdr(ifa, pkt, DBDES_P); ospf_pkt_fill_hdr(ifa, pkt, DBDES_P);
pkt->iface_mtu = htons(ifa->iface->mtu); pkt->iface_mtu = htons(ifa->iface->mtu);
pkt->options = ifa->options; pkt->options = ifa->oa->opt.byte;
pkt->imms = n->myimms; pkt->imms = n->myimms;
pkt->ddseq = htonl(n->dds); pkt->ddseq = htonl(n->dds);
length = sizeof(struct ospf_dbdes_packet); 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); ospf_pkt_fill_hdr(ifa, pkt, DBDES_P);
pkt->iface_mtu = htons(ifa->iface->mtu); pkt->iface_mtu = htons(ifa->iface->mtu);
pkt->options = ifa->options; pkt->options = ifa->oa->opt.byte;
pkt->ddseq = htonl(n->dds); 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 */ j = i = (ospf_pkt_maxsize(ifa) - sizeof(struct ospf_dbdes_packet)) / sizeof(struct ospf_lsa_header); /* Number of possible lsaheaders to send */

View file

@ -44,7 +44,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
return; 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); log(L_ERR "%s%I%soptions mismatch (0x%x).", beg, faddr, rec, ps->options);
return; return;
@ -207,7 +207,7 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
pkt->netmask = ipa_mkmask(ifa->iface->addr->pxlen); pkt->netmask = ipa_mkmask(ifa->iface->addr->pxlen);
ipa_hton(pkt->netmask); ipa_hton(pkt->netmask);
pkt->helloint = ntohs(ifa->helloint); pkt->helloint = ntohs(ifa->helloint);
pkt->options = ifa->options; pkt->options = ifa->oa->opt.byte;
pkt->priority = ifa->priority; pkt->priority = ifa->priority;
pkt->deadint = htonl(ifa->deadc * ifa->helloint); pkt->deadint = htonl(ifa->deadc * ifa->helloint);
pkt->dr = ifa->drip; pkt->dr = ifa->drip;

View file

@ -374,7 +374,6 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ospf_area_conf
ifa->stub = ip->stub; ifa->stub = ip->stub;
ifa->autype = ip->autype; ifa->autype = ip->autype;
ifa->passwords = ip->passwords; ifa->passwords = ip->passwords;
ifa->options = 2; /* FIXME what options? */
if (ip->type == OSPF_IT_UNDEF) if (ip->type == OSPF_IT_UNDEF)
ifa->type = ospf_iface_clasify(ifa->iface); ifa->type = ospf_iface_clasify(ifa->iface);

View file

@ -150,6 +150,8 @@ ospf_start(struct proto *p)
add_area_nets(oa, ac); add_area_nets(oa, ac);
fib_init(&oa->rtr, p->pool, sizeof(ort), 16, ospf_rt_initort); fib_init(&oa->rtr, p->pool, sizeof(ort), 16, ospf_rt_initort);
if (oa->areaid == 0) po->backbone = oa; 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 */ /* Add all virtual links as interfaces */

View file

@ -95,6 +95,34 @@ struct ospf_area_config
list net_list; 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 struct ospf_iface
{ {
node n; node n;
@ -111,8 +139,6 @@ struct ospf_iface
u16 inftransdelay; /* The estimated number of seconds it takes to u16 inftransdelay; /* The estimated number of seconds it takes to
transmit a Link State Update Packet over this transmit a Link State Update Packet over this
interface. LSAs contained in the update */ 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 waitint; /* number of sec before changing state from wait */
u32 rxmtint; /* number of seconds between LSA retransmissions */ u32 rxmtint; /* number of seconds between LSA retransmissions */
u32 pollint; /* Poll interval */ u32 pollint; /* Poll interval */
@ -121,7 +147,7 @@ struct ospf_iface
ip_addr vip; /* IP of peer of virtual link */ ip_addr vip; /* IP of peer of virtual link */
struct ospf_area *voa; /* Area wich the vlink goes through */ struct ospf_area *voa; /* Area wich the vlink goes through */
u16 autype; u16 autype;
u8 options; u16 helloint; /* number of seconds between hello sending */
list *passwords; list *passwords;
u32 csn; /* Crypt seq num. that will be sent net */ u32 csn; /* Crypt seq num. that will be sent net */
ip_addr drip; /* Designated router */ ip_addr drip; /* Designated router */
@ -136,7 +162,6 @@ struct ospf_iface
#define OSPF_IT_UNDEF 4 #define OSPF_IT_UNDEF 4
u8 strictnbma; /* Can I talk with unknown neighbors? */ u8 strictnbma; /* Can I talk with unknown neighbors? */
u8 stub; /* Inactive interface */ u8 stub; /* Inactive interface */
u8 ioprob;
#define OSPF_I_OK 0 /* Everything OK */ #define OSPF_I_OK 0 /* Everything OK */
#define OSPF_I_MC 1 /* I didn't open MC socket */ #define OSPF_I_MC 1 /* I didn't open MC socket */
#define OSPF_I_IP 2 /* I didn't open IP socet */ #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 orignet; /* Schedule network LSA origination */
int fadj; /* Number of full adjacent neigh */ int fadj; /* Number of full adjacent neigh */
list nbma_list; list nbma_list;
u8 priority; /* A router priority for DR election */
u8 ioprob;
}; };
struct ospf_md5 struct ospf_md5
@ -494,6 +521,7 @@ struct ospf_area
struct proto_ospf *po; struct proto_ospf *po;
unsigned tick; unsigned tick;
struct fib rtr; /* Routing tables for routers */ struct fib rtr; /* Routing tables for routers */
union options opt; /* RFC2328 - A.2 */
}; };
struct proto_ospf struct proto_ospf

View file

@ -243,7 +243,7 @@ ospf_rt_spfa(struct ospf_area *oa)
DBG("PTP found.\n"); DBG("PTP found.\n");
break; break;
default: default:
log("Unknown link type in router lsa."); log("Unknown link type in router lsa. (rid = %I)", act->lsa.id);
break; break;
} }
if (tmp) if (tmp)
@ -339,7 +339,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
} }
break; break;
default: default:
log("Unknown link type in router lsa."); log("Unknown link type in router lsa. (rid = %I)", fol->lsa.id);
break; break;
} }
} }
@ -357,7 +357,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
} }
break; break;
default: default:
log("Unknown link type in router lsa."); bug("Unknown lsa type. (id = %I)", fol->lsa.id);
} }
return 0; return 0;
} }

View file

@ -190,7 +190,7 @@ originate_rt_lsa(struct ospf_area *oa)
lsa.id = rtid; lsa.id = rtid;
lsa.type = LSA_T_RT; lsa.type = LSA_T_RT;
lsa.rt = rtid; lsa.rt = rtid;
lsa.options = 0; lsa.options = oa->opt.byte;
if (oa->rt == NULL) if (oa->rt == NULL)
{ {
lsa.sn = LSA_INITSEQNO; 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.id = ipa_to_u32(ifa->iface->addr->ip);
lsa.type = LSA_T_NET; lsa.type = LSA_T_NET;
lsa.rt = rtid; lsa.rt = rtid;
lsa.options = 0; lsa.options = ifa->oa->opt.byte;
if (ifa->nlsa == NULL) if (ifa->nlsa == NULL)
{ {
lsa.sn = LSA_INITSEQNO; lsa.sn = LSA_INITSEQNO;