summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index a778a50b..5f0d99da 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -765,24 +765,6 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh,
return;
}
- /* If incoming interface is passive one, ignore Hello. */
- if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE) {
- char buf[3][INET_ADDRSTRLEN];
- zlog_debug ("ignoring HELLO from router %s sent to %s, "
- "received on a passive interface, %s",
- inet_ntop(AF_INET, &ospfh->router_id, buf[0], sizeof(buf[0])),
- inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
- inet_ntop(AF_INET, &oi->address->u.prefix4,
- buf[2], sizeof(buf[2])));
- if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS))
- {
- /* Try to fix multicast membership. */
- OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS);
- ospf_if_set_multicast(oi);
- }
- return;
- }
-
/* get neighbor prefix. */
p.family = AF_INET;
p.prefixlen = ip_masklen (hello->network_mask);
@@ -2393,6 +2375,32 @@ ospf_read (struct thread *thread)
/* associate packet with ospf interface */
oi = ospf_if_lookup_recv_if (ospf, iph->ip_src);
+ /* If incoming interface is passive one, ignore it. */
+ if (oi && OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE)
+ {
+ char buf[3][INET_ADDRSTRLEN];
+
+ if (IS_DEBUG_OSPF_EVENT)
+ zlog_debug ("ignoring packet from router %s sent to %s, "
+ "received on a passive interface, %s",
+ inet_ntop(AF_INET, &ospfh->router_id, buf[0], sizeof(buf[0])),
+ inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
+ inet_ntop(AF_INET, &oi->address->u.prefix4,
+ buf[2], sizeof(buf[2])));
+
+ if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS))
+ {
+ /* Try to fix multicast membership.
+ * Some OS:es may have problems in this area,
+ * make sure it is removed.
+ */
+ OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS);
+ ospf_if_set_multicast(oi);
+ }
+ return 0;
+ }
+
+
/* if no local ospf_interface,
* or header area is backbone but ospf_interface is not
* check for VLINK interface
@@ -3151,7 +3159,10 @@ ospf_db_desc_send (struct ospf_neighbor *nbr)
op->length = length;
/* Decide destination address. */
- op->dst = nbr->address.u.prefix4;
+ if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ op->dst.s_addr = htonl (OSPF_ALLSPFROUTERS);
+ else
+ op->dst = nbr->address.u.prefix4;
/* Add packet to the interface output queue. */
ospf_packet_add (oi, op);
@@ -3210,7 +3221,10 @@ ospf_ls_req_send (struct ospf_neighbor *nbr)
op->length = length;
/* Decide destination address. */
- op->dst = nbr->address.u.prefix4;
+ if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ op->dst.s_addr = htonl (OSPF_ALLSPFROUTERS);
+ else
+ op->dst = nbr->address.u.prefix4;
/* Add packet to the interface output queue. */
ospf_packet_add (oi, op);
@@ -3326,7 +3340,10 @@ ospf_ls_upd_queue_send (struct ospf_interface *oi, struct list *update,
op->length = length;
/* Decide destination address. */
- op->dst.s_addr = addr.s_addr;
+ if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ op->dst.s_addr = htonl (OSPF_ALLSPFROUTERS);
+ else
+ op->dst.s_addr = addr.s_addr;
/* Add packet to the interface output queue. */
ospf_packet_add (oi, op);
@@ -3403,13 +3420,12 @@ ospf_ls_upd_send (struct ospf_neighbor *nbr, struct list *update, int flag)
/* Decide destination address. */
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
p.prefix = oi->vl_data->peer_addr;
+ else if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
else if (flag == OSPF_SEND_PACKET_DIRECT)
p.prefix = nbr->address.u.prefix4;
else if (oi->state == ISM_DR || oi->state == ISM_Backup)
p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
- else if ((oi->type == OSPF_IFTYPE_POINTOPOINT)
- && (flag == OSPF_SEND_PACKET_INDIRECT))
- p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
else if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT)
p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
else