]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: logging behavior for area id mismatches 16759/head
authorLoïc Sang <loic.sang@6wind.com>
Fri, 6 Sep 2024 08:51:30 +0000 (10:51 +0200)
committerLoïc Sang <loic.sang@6wind.com>
Mon, 9 Sep 2024 08:36:07 +0000 (10:36 +0200)
When an ospf interface is not in the backbone area, but it receives a
packet from the backbone, no logs are generated for this mismatch.
However, the opposite scenario does generate logs.
Add a log for this case.

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
ospfd/ospf_packet.c

index e336435cbd72c1fcbdf1bb4591ee6dfcb842ed63..d35f0a13721dcdc5c2caa2d7f2aa1927f8dc2fea 100644 (file)
@@ -2806,9 +2806,7 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf)
         * or header area is backbone but ospf_interface is not
         * check for VLINK interface
         */
-       if ((oi == NULL)
-           || (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id)
-               && !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id))) {
+       if (oi == NULL) {
                if ((oi = ospf_associate_packet_vl(ospf, ifp, iph, ospfh))
                    == NULL) {
                        if (!ospf->instance && IS_DEBUG_OSPF_EVENT)
@@ -2817,6 +2815,15 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf)
                                        &iph->ip_src, ifp->name);
                        return OSPF_READ_CONTINUE;
                }
+       } else if (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id) &&
+                  !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id)) {
+               oi = ospf_associate_packet_vl(ospf, ifp, iph, ospfh);
+               if (oi == NULL) {
+                       flog_warn(EC_OSPF_PACKET,
+                                 "interface %s: ospf_read invalid Area ID %pI4",
+                                 ifp->name, &ospfh->area_id);
+                       return OSPF_READ_CONTINUE;
+               }
        }
 
        /*