Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't build on 13-CURRENT since some kernel APIs were changed #5

Open
Math2 opened this issue Dec 18, 2019 · 2 comments
Open

doesn't build on 13-CURRENT since some kernel APIs were changed #5

Math2 opened this issue Dec 18, 2019 · 2 comments

Comments

@Math2
Copy link

Math2 commented Dec 18, 2019

Some new APIs related to interface low-level addresses management were introduced starting from r353419 and the old APIs were deleted at r353868. And this module doesn't build since then.

This is a tentative patch; I'm not sure that this is correct (and I have no way to test it right now). It's just based on how the other drivers seem to have been changed for the new APIs. Hopefully this helps a little bit.

diff --git a/aq_main.c b/aq_main.c
index 206c3a2..7d47b20 100644
--- a/aq_main.c
+++ b/aq_main.c
@@ -735,18 +735,28 @@ static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_counter cnt)
 	}
 }
 
+#if __FreeBSD__ < 13
 static int aq_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count)
+#else
+static u_int aq_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count)
+#endif
 {
 	struct aq_dev *softc = arg;
 	struct aq_hw *hw = &softc->hw;
 	u8 *mac_addr = NULL;
 
+#if __FreeBSD__ < 13
 	if (ifma->ifma_addr->sa_family != AF_LINK)
 		return (0);
+#endif
 	if (count == AQ_HW_MAC_MAX)
 		return (0);
 
+#if __FreeBSD__ < 13
 	mac_addr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
+#else
+	mac_addr = LLADDR(sdl);
+#endif
 	aq_hw_mac_addr_set(hw, mac_addr, count + 1);
 
 	aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":");
@@ -765,14 +775,22 @@ static void aq_if_multi_set(if_ctx_t ctx)
 	struct aq_hw  *hw = &softc->hw;
 	AQ_DBG_ENTER();
 
+#if __FreeBSD__ < 13
 	softc->mcnt = if_multiaddr_count(iflib_get_ifp(ctx), AQ_HW_MAC_MAX);
+#else
+	softc->mcnt = if_llmaddr_count(iflib_get_ifp(ctx));
+#endif
 	if (softc->mcnt >= AQ_HW_MAC_MAX)
 	{
 		aq_hw_set_promisc(hw, !!(ifp->if_flags & IFF_PROMISC),
 				  aq_is_vlan_promisc_required(softc),
 				  !!(ifp->if_flags & IFF_ALLMULTI) || aq_is_mc_promisc_required(softc));
 	}else{
+#if __FreeBSD__ < 13
 		if_multi_apply(iflib_get_ifp(ctx), aq_mc_filter_apply, softc);
+#else
+		if_foreach_llmaddr(iflib_get_ifp(ctx), aq_mc_filter_apply, softc);
+#endif
 	}
 	AQ_DBG_EXIT(0);
 }
@opsec
Copy link

opsec commented Jun 26, 2022

See this PR where a fix like this was committed.

I think this can be closed.

@marklapointe
Copy link

It still doesn't on 13.1:
`Warning: Object directory not changed from original /root/git/aqtion-freebsd
cc -O2 -pipe -DIFLIB -ferror-limit=1 -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I/usr/include -include /root/git/aqtion-freebsd/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -MD -MF.depend.aq_main.o -MTaq_main.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=freebsd_kprintf -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length -mno-aes -mno-avx -std=iso9899:1999 -c aq_main.c -o aq_main.o
In file included from aq_main.c:43:
In file included from /usr/include/sys/bus.h:744:
./bus_if.h:1260:50: error: unknown type name 'device_property_type_t'
size_t _size, device_property_type_t type);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
*** Error code 1

Stop.
make: stopped in /root/git/aqtion-freebsd
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants