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

fix ICMPv6 echo response

This commit is contained in:
Christian Giese
2022-01-13 10:02:59 +01:00
parent 9800a43deb
commit 86a37509e3

View File

@ -115,6 +115,14 @@ swap_ipv4_src_dst(bbl_ipv4_t *ipv4)
ipv4->src = dst; ipv4->src = dst;
} }
static void
swap_ipv6_src_dst(bbl_ipv6_t *ipv6)
{
uint8_t *dst = ipv6->dst;
ipv6->dst = ipv6->src;
ipv6->src = dst;
}
static void static void
update_eth(bbl_interface_s *interface, update_eth(bbl_interface_s *interface,
bbl_session_s *session, bbl_session_s *session,
@ -198,12 +206,7 @@ bbl_send_icmpv6_echo_reply(bbl_interface_s *interface,
bbl_icmpv6_t *icmpv6) bbl_icmpv6_t *icmpv6)
{ {
update_eth(interface, session, eth); update_eth(interface, session, eth);
ipv6->dst = ipv6->src; swap_ipv6_src_dst(ipv6);
if(session) {
ipv6->src = session->ipv6_address;
} else {
ipv6->src = interface->ip6.address;
}
ipv6->ttl = 255; ipv6->ttl = 255;
icmpv6->type = IPV6_ICMPV6_ECHO_REPLY; icmpv6->type = IPV6_ICMPV6_ECHO_REPLY;
return bbl_send_to_buffer(interface, eth); return bbl_send_to_buffer(interface, eth);