diff options
| author | Loïc Sang <loic.sang@6wind.com> | 2024-09-06 10:51:30 +0200 | 
|---|---|---|
| committer | Loïc Sang <loic.sang@6wind.com> | 2024-09-09 10:36:07 +0200 | 
| commit | 770863cfcc40b444243f0a6c805d0c2c98bff6a7 (patch) | |
| tree | 437bccb77561d7e697d2282d888c2bbd48cb0640 | |
| parent | 4f185c5c9d0efe8d046aa361868e1e97108de192 (diff) | |
ospfd: logging behavior for area id mismatches
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>
| -rw-r--r-- | ospfd/ospf_packet.c | 13 | 
1 files changed, 10 insertions, 3 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index e336435cbd..d35f0a1372 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -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; +		}  	}  	/*  | 
