From fae2e926cfc2fde6c964e82b964e227511ac5b7a Mon Sep 17 00:00:00 2001 From: Senthil Kumar Nagappan Date: Tue, 27 Apr 2021 22:24:00 +0530 Subject: [PATCH] ospf ptp link sending unicast packets instead of multicast; peer address config not required --- proto/ospf/dbdes.c | 5 ++++- proto/ospf/iface.c | 3 +++ proto/ospf/lsreq.c | 5 ++++- proto/ospf/lsupd.c | 5 ++++- proto/ospf/packet.c | 11 ++++++++--- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 5a5f76f8..9a82a0af 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -194,7 +194,10 @@ 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); + if(OSPF_IT_PTP == ifa->type) + ospf_send_to(ifa, ifa->all_routers); + else + ospf_send_to(ifa, n->ip); sk_set_tbuf(ifa->sk, NULL); } diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 666140b5..669d6386 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -535,6 +535,9 @@ ospf_iface_stubby(struct ospf_iface_patt *ip, struct ifa *addr) if (ip->type == OSPF_IT_VLINK) return 0; + if (ip->type == OSPF_IT_PTP) + return 0; + /* a host address */ if (addr->flags & IA_HOST) return 1; diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c index 45af7533..271a1994 100644 --- a/proto/ospf/lsreq.c +++ b/proto/ospf/lsreq.c @@ -89,7 +89,10 @@ 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); + if(OSPF_IT_PTP == ifa->type) + ospf_send_to(ifa, ifa->all_routers); + else + ospf_send_to(ifa, n->ip); } diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index fafe4872..b9daf5de 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -428,7 +428,10 @@ 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); + if(OSPF_IT_PTP == ifa->type) + ospf_send_to(ifa, ifa->all_routers); + else + ospf_send_to(ifa, n->ip); } return i; diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c index 85cbbdf0..bc77fe4a 100644 --- a/proto/ospf/packet.c +++ b/proto/ospf/packet.c @@ -415,7 +415,7 @@ ospf_rx_hook(sock *sk, uint len) * that (src_local || dst_local), therefore we are eliminating all * such cases. */ - if (dst_mcast && !src_local) + if (dst_mcast && (OSPF_IT_PTP != ifa->type) && !src_local) return 1; if (!dst_mcast && !dst_local) return 1; @@ -492,7 +492,7 @@ ospf_rx_hook(sock *sk, uint len) return 1; /* It is real iface, source should be local (in OSPFv2) */ - if (ospf_is_v2(p) && !src_local) + if (ospf_is_v2(p) && (OSPF_IT_PTP != ifa->type) && !src_local) DROP1("strange source address"); goto found; @@ -671,7 +671,12 @@ ospf_send_to_agt(struct ospf_iface *ifa, u8 state) WALK_LIST(n, ifa->neigh_list) if (n->state >= state) - ospf_send_to(ifa, n->ip); + { + if(OSPF_IT_PTP == ifa->type) + ospf_send_to(ifa, ifa->all_routers); + else + ospf_send_to(ifa, n->ip); + } } void -- 2.20.1