summaryrefslogtreecommitdiffstats
path: root/proto/ospf/packet.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@majklik.network.cz>2010-04-27 11:28:44 +0200
committerOndrej Filip <feela@majklik.network.cz>2010-04-27 11:28:44 +0200
commit96599c957baa9c82bde91d610ce4f519aead05e9 (patch)
tree28fc5b3e90afb11e288a6c428d1203dd7992bd35 /proto/ospf/packet.c
parentba130172549ef2313f713e048083432f74e7d03d (diff)
parent9d1ee1388771a3caa6c23163571a80457adfab2c (diff)
downloadbird-96599c957baa9c82bde91d610ce4f519aead05e9.tar
bird-96599c957baa9c82bde91d610ce4f519aead05e9.zip
Merge branch 'master' of ssh://git.nic.cz/projects/bird/GIT/bird
Diffstat (limited to 'proto/ospf/packet.c')
-rw-r--r--proto/ospf/packet.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index b47cbfc..74ce550 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -76,6 +76,7 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
}
password_cpy(pkt->u.password, passwd->password, sizeof(union ospf_auth));
case OSPF_AUTH_NONE:
+ pkt->checksum = 0;
pkt->checksum = ipsum_calculate(pkt, sizeof(struct ospf_packet) -
sizeof(union ospf_auth), (pkt + 1),
ntohs(pkt->length) -
@@ -241,6 +242,19 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
#endif
+#ifdef OSPFv2
+static inline struct ospf_neighbor *
+find_neigh_by_ip(struct ospf_iface *ifa, ip_addr ip)
+{
+ struct ospf_neighbor *n;
+ WALK_LIST(n, ifa->neigh_list)
+ if (ipa_equal(n->ip, ip))
+ return n;
+ return NULL;
+}
+#endif
+
+
/**
* ospf_rx_hook
@@ -418,10 +432,16 @@ ospf_rx_hook(sock *sk, int size)
return 1;
}
- /* This is deviation from RFC 2328 - neighbours should be identified by
- * IP address on broadcast and NBMA networks.
- */
+#ifdef OSPFv2
+ /* In OSPFv2, neighbors are identified by either IP or Router ID, base on network type */
+ struct ospf_neighbor *n;
+ if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA))
+ n = find_neigh_by_ip(ifa, sk->faddr);
+ else
+ n = find_neigh(ifa, rid);
+#else
struct ospf_neighbor *n = find_neigh(ifa, rid);
+#endif
if(!n && (ps->type != HELLO_P))
{