git: a11f080e8682 - main - ofed/infiniband: fix ifdefs for new INET changes, fixing LINT-NOIP
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Jul 2022 13:03:08 UTC
The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=a11f080e8682971cee931b7add0dc4902c06b08b commit a11f080e8682971cee931b7add0dc4902c06b08b Author: Mike Karels <karels@FreeBSD.org> AuthorDate: 2022-07-16 21:05:58 +0000 Commit: Mike Karels <karels@FreeBSD.org> CommitDate: 2022-07-18 13:02:01 +0000 ofed/infiniband: fix ifdefs for new INET changes, fixing LINT-NOIP Some of the ofed/infiniband code has INET and INET6 address handling code without using ifdefs. This failed with a recent change to INET, in which IN_LOOPBACK() started using a VNET variable, and which is not present if INET is not configured. Add #ifdef INET, and INET6 for good measure, in cma_loopback_addr(), along with inclusion of the options headers in ib_cma.c. Reviewed by: hselasky rgrimes bz Differential Revision: https://reviews.freebsd.org/D35835 (cherry picked from commit 752b7632776237f9c071783acdd1136ebf5f287d) --- sys/ofed/drivers/infiniband/core/ib_cma.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 586524ac88bb..10dedf96f0e6 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ +#include "opt_inet.h" +#include "opt_inet6.h" + #include <linux/completion.h> #include <linux/in.h> #include <linux/in6.h> @@ -1048,10 +1051,18 @@ static inline int cma_zero_addr(struct sockaddr *addr) static inline int cma_loopback_addr(struct sockaddr *addr) { switch (addr->sa_family) { +#ifdef INET + /* + * ipv4_is_loopback() requires an inet variable via vnet, + * not present if INET is not included. + */ case AF_INET: return ipv4_is_loopback(((struct sockaddr_in *) addr)->sin_addr.s_addr); +#endif +#ifdef INET6 case AF_INET6: return ipv6_addr_loopback(&((struct sockaddr_in6 *) addr)->sin6_addr); +#endif case AF_IB: return ib_addr_loopback(&((struct sockaddr_ib *) addr)->sib_addr); default: