From 29c1cc5dfe548e6811793e0697192925083480d2 Mon Sep 17 00:00:00 2001 From: Julian Cordes <julian.cordes@gmail.com> Date: Thu, 18 Feb 2016 21:23:31 +0100 Subject: [PATCH] adjustment for ipv6 --- gtests/net/packetdrill/run_packet.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/gtests/net/packetdrill/run_packet.c b/gtests/net/packetdrill/run_packet.c index 55d2b1f6..c6ad48e2 100644 --- a/gtests/net/packetdrill/run_packet.c +++ b/gtests/net/packetdrill/run_packet.c @@ -2686,12 +2686,24 @@ static int do_inbound_script_packet( packet_payload_len(live_packet); } - if (live_packet->ipv4->src_ip.s_addr == 0) { - DEBUGP("live_packet->ipv4->src_ip.s_addr == 0\n"); - state->socket_under_test = setup_new_child_socket(state, packet); - struct tuple live_inbound; - socket_get_inbound(&state->socket_under_test->live, &live_inbound); - set_packet_tuple(live_packet, &live_inbound); + if (live_packet->ipv4 != NULL) { + if (live_packet->ipv4->src_ip.s_addr == 0) { + DEBUGP("live_packet->ipv4->src_ip.s_addr == 0\n"); + state->socket_under_test = setup_new_child_socket(state, packet); + struct tuple live_inbound; + socket_get_inbound(&state->socket_under_test->live, &live_inbound); + set_packet_tuple(live_packet, &live_inbound); + } + } + + if (live_packet->ipv6 != NULL) { + uint32_t null_ip[4] = {0x00, 0x00, 0x00, 0x00}; + if (memcmp(&(live_packet->ipv6->src_ip.__in6_u.__u6_addr32), &null_ip, sizeof(uint32_t) * 4) == 0) { + state->socket_under_test = setup_new_child_socket(state, packet); + struct tuple live_inbound; + socket_get_inbound(&state->socket_under_test->live, &live_inbound); + set_packet_tuple(live_packet, &live_inbound); + } } /* Inject live packet into kernel. */ -- GitLab