diff options
author | Ondrej Filip <feela@network.cz> | 2004-07-14 21:46:20 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2004-07-14 21:46:20 +0000 |
commit | 3b16080c97a2d89c90f7df7a8fda0401ec9abe42 (patch) | |
tree | ef885699eaa72453b99f40dba181112d7e9540b7 /proto/ospf/packet.c | |
parent | a417ad13a117d2458702cbec4aa418ba99981611 (diff) |
Multiple OSPF areas can be attached.
Origination of summary LSA works.
Routing table calculation works.
Virtual links works.
Well, I hope, OSPF is fully compatible with RFC2328!!!!
Diffstat (limited to 'proto/ospf/packet.c')
-rw-r--r-- | proto/ospf/packet.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c index 488a3a29..92e05226 100644 --- a/proto/ospf/packet.c +++ b/proto/ospf/packet.c @@ -25,7 +25,7 @@ ospf_pkt_fill_hdr(struct ospf_iface *ifa, void *buf, u8 h_type) pkt->type = h_type; pkt->routerid = htonl(p->cf->global->router_id); - pkt->areaid = htonl(ifa->an); + pkt->areaid = htonl(ifa->oa->areaid); pkt->autype = htons(ifa->autype); pkt->checksum = 0; } @@ -219,17 +219,32 @@ ospf_rx_hook(sock * sk, int size) { struct ospf_packet *ps; struct ospf_iface *ifa = (struct ospf_iface *) (sk->data); + struct proto_ospf *po = ifa->proto; struct proto *p = (struct proto *) (ifa->proto); struct ospf_neighbor *n; int osize; char *mesg = "Bad OSPF packet from "; + struct ospf_iface *iff; if (ifa->stub) return (1); + ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size); + + if ((ifa->oa->areaid != 0) && (ntohl(ps->areaid) == 0)) + { + WALK_LIST(iff, po->iface_list) + { + if ((iff->type == OSPF_IT_VLINK) && (iff->iface == ifa->iface) && + (iff->voa = ifa->oa) && ipa_equal(sk->faddr, iff->vip)) + { + return 1; /* Packet is for VLINK */ + } + } + } + DBG("%s: RX_Hook called on interface %s.\n", p->name, sk->iface->name); - ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size); osize = ntohs(ps->length); if (ps == NULL) { @@ -263,7 +278,7 @@ ospf_rx_hook(sock * sk, int size) return 1; } - if (ntohl(ps->areaid) != ifa->an) + if (ntohl(ps->areaid) != ifa->oa->areaid) { log(L_ERR "%s%I - other area %ld", mesg, sk->faddr, ps->areaid); return 1; @@ -374,9 +389,9 @@ ospf_send_to_agt(sock * sk, struct ospf_iface *ifa, u8 state) void ospf_send_to_bdr(sock * sk, struct ospf_iface *ifa) { - if (ipa_compare(ifa->drip, ipa_from_u32(0)) != 0) + if (!ipa_equal(ifa->drip, IPA_NONE)) ospf_send_to(sk, ifa->drip, ifa); - if (ipa_compare(ifa->bdrip, ipa_from_u32(0)) != 0) + if (!ipa_equal(ifa->bdrip, IPA_NONE)) ospf_send_to(sk, ifa->bdrip, ifa); } |