diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/ospf/dbdes.c | 2 | ||||
-rw-r--r-- | proto/ospf/lsack.c | 2 | ||||
-rw-r--r-- | proto/ospf/lsreq.c | 2 | ||||
-rw-r--r-- | proto/ospf/lsupd.c | 2 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 3 | ||||
-rw-r--r-- | proto/ospf/packet.c | 10 |
6 files changed, 17 insertions, 4 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 5a5f76f8..6d33bf8e 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -194,7 +194,7 @@ ospf_do_send_dbdes(struct ospf_proto *p, struct ospf_neighbor *n) OSPF_PACKET(ospf_dump_dbdes, n->ldd_buffer, "DBDES packet sent to nbr %R on %s", n->rid, ifa->ifname); sk_set_tbuf(ifa->sk, n->ldd_buffer); - ospf_send_to(ifa, n->ip); + ospf_send_to_nbr(ifa, n); sk_set_tbuf(ifa->sk, NULL); } diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c index 1654953f..4eec536d 100644 --- a/proto/ospf/lsack.c +++ b/proto/ospf/lsack.c @@ -110,7 +110,7 @@ ospf_send_lsack_(struct ospf_proto *p, struct ospf_neighbor *n, int queue) if (queue == ACKL_DIRECT) { OSPF_PACKET(ospf_dump_lsack, pkt, "LSACK packet sent to nbr %R on %s", n->rid, ifa->ifname); - ospf_send_to(ifa, n->ip); + ospf_send_to_nbr(ifa, n); } else { diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c index 45af7533..05c0e039 100644 --- a/proto/ospf/lsreq.c +++ b/proto/ospf/lsreq.c @@ -89,7 +89,7 @@ ospf_send_lsreq(struct ospf_proto *p, struct ospf_neighbor *n) pkt->length = htons(length); OSPF_PACKET(ospf_dump_lsreq, pkt, "LSREQ packet sent to nbr %R on %s", n->rid, ifa->ifname); - ospf_send_to(ifa, n->ip); + ospf_send_to_nbr(ifa, n); } diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 66017a2e..54c4a069 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -420,7 +420,7 @@ ospf_send_lsupd(struct ospf_proto *p, struct top_hash_entry **lsa_list, uint lsa OSPF_PACKET(ospf_dump_lsupd, ospf_tx_buffer(ifa), "LSUPD packet sent to nbr %R on %s", n->rid, ifa->ifname); - ospf_send_to(ifa, n->ip); + ospf_send_to_nbr(ifa, n); } return i; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index aa7d937e..fd2347e5 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -1058,6 +1058,9 @@ void ospf_verr_hook(sock *sk, int err); void ospf_send_to(struct ospf_iface *ifa, ip_addr ip); void ospf_send_to_iface(struct ospf_iface *ifa); +static inline void ospf_send_to_nbr(struct ospf_iface *ifa, struct ospf_neighbor *n) +{ ospf_send_to(ifa, (ifa->type == OSPF_IT_PTP) ? ifa->all_routers : n->ip); } + static inline void ospf_send_to_all(struct ospf_iface *ifa) { ospf_send_to(ifa, ifa->all_routers); } diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c index 1f471d79..15242318 100644 --- a/proto/ospf/packet.c +++ b/proto/ospf/packet.c @@ -695,6 +695,14 @@ ospf_send_to_adjacent(struct ospf_iface *ifa) void ospf_send_to_iface(struct ospf_iface *ifa) { + /* + * Send packet to (relevant) neighbors on iface + * + * On broadcast networks, destination is either AllSPFRouters, or AllDRouters. + * On PtP networks, destination is always AllSPFRouters. On non-broadcast + * networks, packets are sent as unicast to every adjacent neighbor. + */ + if (ifa->type == OSPF_IT_BCAST) { if ((ifa->state == OSPF_IS_DR) || (ifa->state == OSPF_IS_BACKUP)) @@ -702,6 +710,8 @@ ospf_send_to_iface(struct ospf_iface *ifa) else ospf_send_to_designated(ifa); } + else if (ifa->type == OSPF_IT_PTP) + ospf_send_to_all(ifa); else /* Non-broadcast */ ospf_send_to_adjacent(ifa); } |