1
0
mirror of https://github.com/rtbrick/bngblaster.git synced 2024-05-06 15:54:57 +00:00

Respond to IPv6 PING

This commit is contained in:
Christian Giese
2021-10-28 14:16:19 +02:00
parent cc33597301
commit a65f1ecade
3 changed files with 30 additions and 0 deletions

View File

@ -495,6 +495,8 @@ bbl_rx_icmpv6(bbl_ethernet_header_t *eth, bbl_ipv6_t *ipv6, bbl_interface_s *int
}
} else if(icmpv6->type == IPV6_ICMPV6_NEIGHBOR_SOLICITATION) {
session->send_requests |= BBL_SEND_ICMPV6_NA;
} else if(icmpv6->type == IPV6_ICMPV6_ECHO_REQUEST) {
bbl_send_icmpv6_echo_reply(interface, session, eth, ipv6, icmpv6);
}
}
@ -1736,6 +1738,8 @@ bbl_rx_network_icmpv6(bbl_ethernet_header_t *eth, bbl_interface_s *interface) {
secondary_ip6 = secondary_ip6->next;
}
}
} else if(icmpv6->type == IPV6_ICMPV6_ECHO_REQUEST) {
bbl_send_icmpv6_echo_reply(interface, NULL, eth, ipv6, icmpv6);
}
}

View File

@ -188,4 +188,23 @@ bbl_send_icmp_reply(bbl_interface_s *interface,
ipv4->ttl = 64;
icmp->type = ICMP_TYPE_ECHO_REPLY;
return bbl_send_to_buffer(interface, eth);
}
bbl_send_result_t
bbl_send_icmpv6_echo_reply(bbl_interface_s *interface,
bbl_session_s *session,
bbl_ethernet_header_t *eth,
bbl_ipv6_t *ipv6,
bbl_icmpv6_t *icmpv6)
{
update_eth(interface, session, eth);
ipv6->dst = ipv6->src;
if(session) {
ipv6->src = session->ipv6_address;
} else {
ipv6->src = interface->ip6.address;
}
ipv6->ttl = 255;
icmpv6->type = IPV6_ICMPV6_ECHO_REPLY;
return bbl_send_to_buffer(interface, eth);
}

View File

@ -62,4 +62,11 @@ bbl_send_icmp_reply(bbl_interface_s *interface,
bbl_ipv4_t *ipv4,
bbl_icmp_t *icmp);
bbl_send_result_t
bbl_send_icmpv6_echo_reply(bbl_interface_s *interface,
bbl_session_s *session,
bbl_ethernet_header_t *eth,
bbl_ipv6_t *ipv6,
bbl_icmpv6_t *icmpv6);
#endif