Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-19 07:45:49 +00:00

winws2: send to interface 1.0 if no ifname given

This commit is contained in:
bol-van
2025-12-23 23:01:36 +03:00
parent 815801a7db
commit 664bc60175
3 changed files with 15 additions and 7 deletions

View File

@@ -1304,14 +1304,21 @@ bool rawsend(const struct sockaddr* dst,uint32_t fwmark,const char *ifout,const
{
WINDIVERT_ADDRESS wa;
if (!ifout) return false;
memset(&wa,0,sizeof(wa));
// pseudo interface id IfIdx.SubIfIdx
if (sscanf(ifout,"%u.%u",&wa.Network.IfIdx,&wa.Network.SubIfIdx)!=2)
if (ifout && *ifout)
{
errno = EINVAL;
return false;
if (sscanf(ifout,"%u.%u",&wa.Network.IfIdx,&wa.Network.SubIfIdx)!=2)
{
errno = EINVAL;
return false;
}
}
else
{
// 1 - typically loopback
wa.Network.IfIdx=1;
wa.Network.SubIfIdx=0;
}
wa.Outbound=1;
wa.IPChecksum=1;

View File

@@ -308,7 +308,7 @@ static bool auto_hostlist_retrans
tcp->th_win = ctrack->pos.server.winsize;
tcp_fix_checksum(tcp, sizeof(struct tcphdr), ip, ip6);
DLOG("sending RST to retransmitter\n");
DLOG("sending RST to retransmitter. ifname=%s\n", ifclient ? ifclient : "");
rawsend(client,0,ifclient,pkt,pktlen);
}
return true;
@@ -1271,6 +1271,7 @@ static uint8_t dpi_desync_tcp_packet_play(
}
process_retrans_fail(ctrack, dis, (struct sockaddr*)&src, ifin);
if (IsHttp(rdata_payload, rlen_payload))
{
DLOG("packet contains HTTP request\n");

View File

@@ -538,7 +538,7 @@ static int dvt_main(void)
DLOG("\npacket: id=%u len=%zu ifin=%s ifout=%s\n", id, len, ifin, ifout);
modlen = sizeof(buf);
verdict = processPacketData(&mark, NULL, NULL, buf, len, buf, &modlen);
verdict = processPacketData(&mark, ifin, ifout, buf, len, buf, &modlen);
switch (verdict & VERDICT_MASK)
{
case VERDICT_PASS: