diff --git a/gtests/net/packetdrill/run_packet.c b/gtests/net/packetdrill/run_packet.c
index c6ad48e279c0cb002ee1a0b4b912a1b189715fd8..819587d9273d02aee86109e0df9a8e80fce8303a 100644
--- a/gtests/net/packetdrill/run_packet.c
+++ b/gtests/net/packetdrill/run_packet.c
@@ -2698,7 +2698,12 @@ static int do_inbound_script_packet(
 
 	if (live_packet->ipv6 != NULL) {
 		uint32_t null_ip[4] = {0x00, 0x00, 0x00, 0x00};
+#if defined(linux)
 		if (memcmp(&(live_packet->ipv6->src_ip.__in6_u.__u6_addr32), &null_ip, sizeof(uint32_t) * 4) == 0) {
+#elif defined(__FreeBSD__) || defined(OpenBSD) || defined(NetBSD)
+		if (memcmp(&(live_packet->ipv6->src_ip.__u6_addr.__u6_addr32), &null_ip, sizeof(uint32_t) * 4) == 0) {
+#endif
+
 			state->socket_under_test = setup_new_child_socket(state, packet);
 			struct tuple live_inbound;
 			socket_get_inbound(&state->socket_under_test->live, &live_inbound);