winws2: send to interface 1.0 if no ifname given

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

No files matched your search

+12 -5
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;