我尝试通过VPN隧道不路由传出连接,因此我使用下一个顺序来建立TCP连接(对于UDP套接字也是如此):
#define BP$M_NETID 0xFFFF0000UL
#define BP$M_EXPLSLCTD 0x00008000UL
#define BP$M_NOVPN 0x00000400UL
#define BP$M_PERMSN 0x00000300UL
int status, fwmark = {0};
socklen_t fwmarkLen = sizeof(fwmark);
sd = socket (...)ж
if ( 0 > (status = getsockopt(sd, SOL_SOCKET, SO_MARK, &fwmark, &fwmarkLen)) )
return $LOG(STS$K_ERROR, "getsockopt(%d, SO_MARK)->%d, errno=%d", sd, status, errno);
fwmark |= BP$M_NOVPN;
if ( 0 > (status = setsockopt(sd, SOL_SOCKET, SO_MARK, &fwmark, sizeof(fwmark)) )
return $LOG(STS$K_ERROR, "setsockopt(%d, SO_MARK, %#x)->%d, errno=%d", sd, fwmark, status, errno);
我遇到下一个错误: setsockopt(76,SO_MARK,0x400)->-1, errno = 1
那么,设置“ ProtectFromVPN”的正确顺序是什么?