0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

OSPF: Packets on PtP networks should be always sent to AllSPFRouters

As specified in RFC 2328 8.1: "On physical point-to-point networks,
the IP destination is always set to the address AllSPFRouters."

Note that this likely break setups with multiple neighbors on a network
configured as PtP, which worked before. These should be configured as
PtMP.

Thanks to Senthil Kumar Nagappan for the original patch and to Joakim
Tjernlund for suggestions.
This commit is contained in:
Ondrej Zajicek (work) 2021-05-09 15:16:13 +02:00
parent 1647923bd8
commit bc591061f6
6 changed files with 17 additions and 4 deletions

View File

@ -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);
}

View File

@ -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
{

View File

@ -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);
}

View File

@ -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;

View File

@ -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); }

View File

@ -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);
}