mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-23 14:51:06 +00:00
use new session per ICMP ID
restore ICMP id change and use new session instead: I always try to save memory but this wents this time bad, we do need a new session for each port/id or ICMP will never work right.
This commit is contained in:
parent
864c676dce
commit
a8bc2b4a33
1 changed files with 4 additions and 1 deletions
|
@ -115,8 +115,10 @@ void check_icmp_socket(const struct arguments *args, const struct epoll_event *e
|
||||||
icmp->icmp_type, icmp->icmp_code,
|
icmp->icmp_type, icmp->icmp_code,
|
||||||
s->icmp.id, icmp->icmp_id, icmp->icmp_seq);
|
s->icmp.id, icmp->icmp_id, icmp->icmp_seq);
|
||||||
|
|
||||||
// restore original ID
|
//restore original ID: without below hack the ICMP response will not get accepted from requestor
|
||||||
|
// have searched in "SoftEther4" source codes and they this too in "Virtual.c" for ICMP_TYPE_ECHO_RESPONSE
|
||||||
icmp->icmp_id = s->icmp.id;
|
icmp->icmp_id = s->icmp.id;
|
||||||
|
|
||||||
uint16_t csum = 0;
|
uint16_t csum = 0;
|
||||||
if (s->icmp.version == 6) {
|
if (s->icmp.version == 6) {
|
||||||
// Untested
|
// Untested
|
||||||
|
@ -174,6 +176,7 @@ jboolean handle_icmp(const struct arguments *args,
|
||||||
while (cur != NULL &&
|
while (cur != NULL &&
|
||||||
!((cur->protocol == IPPROTO_ICMP || cur->protocol == IPPROTO_ICMPV6) &&
|
!((cur->protocol == IPPROTO_ICMP || cur->protocol == IPPROTO_ICMPV6) &&
|
||||||
!cur->icmp.stop && cur->icmp.version == version &&
|
!cur->icmp.stop && cur->icmp.version == version &&
|
||||||
|
cur->icmp.id == icmp->icmp_id &&
|
||||||
(version == 4 ? cur->icmp.saddr.ip4 == ip4->saddr &&
|
(version == 4 ? cur->icmp.saddr.ip4 == ip4->saddr &&
|
||||||
cur->icmp.daddr.ip4 == ip4->daddr
|
cur->icmp.daddr.ip4 == ip4->daddr
|
||||||
: memcmp(&cur->icmp.saddr.ip6, &ip6->ip6_src, 16) == 0 &&
|
: memcmp(&cur->icmp.saddr.ip6, &ip6->ip6_src, 16) == 0 &&
|
||||||
|
|
Loading…
Reference in a new issue