HomeFreeBSD

sys/netinet6/in6_pcb.c: fix compile without INET

Description

sys/netinet6/in6_pcb.c: fix compile without INET

in6_mapped_sockaddr() and in6_mapped_peeraddr() both define a local
variable named 'inp', but in the non-INET case, this variable is set
and never used, causing a compiler error:

/src/freebsd/src/lf/sys/netinet6/in6_pcb.c:547:16: error:
variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]

547 |         struct  inpcb *inp;
    |                        ^

/src/freebsd/src/lf/sys/netinet6/in6_pcb.c:573:16: error:
variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]

573 |         struct  inpcb *inp;

Fix this by guarding all the INET-specific logic, including the variable
definition, behind #ifdef INET.

While here, tweak formatting in in6_mapped_peeraddr() so both functions
are the same.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1155

(cherry picked from commit 042fb58d009e7efc5b334b68fffbef9b1f620ec8)

Details

Provenance
lexi_le-fay.orgAuthored on Apr 12 2024, 4:54 PM
impCommitted on May 21 2024, 3:12 AM
Parents
rG7aba92287947: sys/dev/irdma/irdma_cm: fix compile without INET
Branches
Unknown
Tags
Unknown