mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-23 23:04:23 +00:00
do not use PF_DIVERT for openbsd
This commit is contained in:
parent
eaaa1a326c
commit
70fa1dbea7
@ -911,13 +911,15 @@ int rawsend_socket_divert(sa_family_t family)
|
|||||||
// we either have to go to the link layer (its hard, possible problems arise, compat testing, ...) or use some HACKING
|
// we either have to go to the link layer (its hard, possible problems arise, compat testing, ...) or use some HACKING
|
||||||
// from my point of view disabling direct ability to send ip frames is not security. its SHIT
|
// from my point of view disabling direct ability to send ip frames is not security. its SHIT
|
||||||
|
|
||||||
int fd,err;
|
int fd;
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
// freebsd14+ way
|
// freebsd14+ way
|
||||||
|
// don't want to use ifdefs with os version to make binaries compatible with all versions
|
||||||
fd = socket(PF_DIVERT, SOCK_RAW, 0);
|
fd = socket(PF_DIVERT, SOCK_RAW, 0);
|
||||||
err=errno;
|
if (fd==-1 && (errno==EPROTONOSUPPORT || errno==EAFNOSUPPORT || errno==EPFNOSUPPORT))
|
||||||
if (fd==-1 && (err==EPROTONOSUPPORT || err==EAFNOSUPPORT || err==EPFNOSUPPORT))
|
#endif
|
||||||
// legacy way
|
// freebsd13- or openbsd way
|
||||||
fd = socket(family, SOCK_RAW, IPPROTO_DIVERT);
|
fd = socket(family, SOCK_RAW, IPPROTO_DIVERT);
|
||||||
if (fd!=-1 && !set_socket_buffers(fd,4096,RAW_SNDBUF))
|
if (fd!=-1 && !set_socket_buffers(fd,4096,RAW_SNDBUF))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user