Skip to content

bgpd,zebra: EVPNv6 addressing coverity warnings - #20680

Merged
ton31337 merged 1 commit into
FRRouting:masterfrom
Manpreet-k0:evpnv6_coverity_fix
Feb 10, 2026
Merged

bgpd,zebra: EVPNv6 addressing coverity warnings#20680
ton31337 merged 1 commit into
FRRouting:masterfrom
Manpreet-k0:evpnv6_coverity_fix

Conversation

@Manpreet-k0

Copy link
Copy Markdown
Contributor

Fixed coverity warnings in evpnv6 code
UNINIT
UNINIT_VAR
MISSING_INITIALIZATION
NULL_RETURNS

@greptile-apps

greptile-apps Bot commented Feb 4, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR addresses Coverity static analysis warnings (UNINIT, UNINIT_VAR, MISSING_INITIALIZATION, NULL_RETURNS) in the EVPNv6 codebase. The changes focus on proper initialization and error handling:

  • Error handling for stream reads: Added return value checking for stream_get_ipaddr() calls in bgp_zebra.c, preventing use of uninitialized IP addresses when stream reads fail
  • Proper structure initialization: Changed vtep_ip initialization from {0} to {.ipa_type = IPADDR_NONE} across multiple files to explicitly set the IP address type field, preventing use of uninitialized union members
  • Coverity annotation: Added a suppression comment for a false positive NULL_RETURNS warning in zebra_vty.c where zebra_vrf_get_evpn() always returns a valid pointer (either zrouter.evpn_vrf or the default VRF)

All changes are defensive programming improvements that make the code more robust without altering functional behavior.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes are defensive improvements addressing legitimate static analysis warnings. The error handling additions prevent potential bugs, and the explicit structure initializations ensure deterministic behavior. The Coverity suppression is justified based on code analysis.
  • No files require special attention

Important Files Changed

Filename Overview
bgpd/bgp_zebra.c Added error handling for stream_get_ipaddr() return value and proper initialization of vtep_ip structure
zebra/zebra_dplane.c Properly initialized vtep_ip structures with IPADDR_NONE type
zebra/zebra_evpn_mac.c Fixed uninitialized vtep_ip structure initialization
zebra/zebra_evpn_neigh.c Fixed uninitialized vtep_ip structure initialization
zebra/zebra_vty.c Added Coverity annotation to suppress false positive NULL_RETURNS warning

Sequence Diagram

sequenceDiagram
    participant Zebra as Zebra Process
    participant Stream as Stream Buffer
    participant BGP as BGP Process
    participant EVPN as EVPN Subsystem
    
    Note over Zebra,BGP: L3VNI/VNI Add Flow
    
    Zebra->>Stream: Write L3VNI/VNI data
    Stream->>BGP: ZEBRA_L3VNI_ADD/ZEBRA_VNI_ADD callback
    BGP->>Stream: stream_get_ipaddr(s, &originator_ip)
    
    alt Stream read successful
        Stream-->>BGP: return true
        BGP->>BGP: Initialize vtep_ip with IPADDR_NONE
        BGP->>EVPN: Process L3VNI/VNI with valid IP
        EVPN-->>BGP: Success
    else Stream read failed
        Stream-->>BGP: return false
        BGP->>BGP: Log error message
        BGP-->>Zebra: return 0 (error)
    end
    
    Note over Zebra,EVPN: MAC/Neighbor Processing
    
    Zebra->>EVPN: Add/Update local MAC
    EVPN->>EVPN: Initialize vtep_ip = {.ipa_type = IPADDR_NONE}
    EVPN->>EVPN: Process MAC with initialized structure
    
    Zebra->>EVPN: Update local neighbor
    EVPN->>EVPN: Initialize vtep_ip = {.ipa_type = IPADDR_NONE}
    EVPN->>EVPN: Process neighbor with initialized structure
Loading

Comment thread bgpd/bgp_zebra.c Outdated
Comment thread zebra/zebra_vty.c Outdated
Fixed coverity warnings in evpnv6 code
UNINIT
UNINIT_VAR
MISSING_INITIALIZATION

Ticket: #4782248

Signed-off-by: Manpreet Kaur <manpreetk@nvidia.com>
@Manpreet-k0

Copy link
Copy Markdown
Contributor Author

ci:rerun

@Manpreet-k0
Manpreet-k0 requested a review from ton31337 February 5, 2026 16:01
@ton31337
ton31337 merged commit ea773c3 into FRRouting:master Feb 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants