Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD support #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

FreeBSD support #74

wants to merge 1 commit into from

Conversation

er2off
Copy link

@er2off er2off commented Aug 11, 2024

Closes #16

@er2off er2off force-pushed the main branch 2 times, most recently from b6c53d6 to c2198d0 Compare August 11, 2024 10:33
desync.c Outdated Show resolved Hide resolved
Makefile Outdated
@@ -1,6 +1,6 @@
TARGET = ciadpi

CPPFLAGS = -D_XOPEN_SOURCE=500
#CPPFLAGS = -D_XOPEN_SOURCE=500
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не следовало совсем убирать, можно было было изменить значение на 600 (#75)

Copy link
Author

@er2off er2off Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этого мало, надо ещё __BSD_VISIBLE для desync.c, иначе netinet/in.h не дефайнит IP_* и TCP_* макросы

#ifdef __FreeBSD__
#include <netinet/in.h>
#endif

Copy link
Owner

@hufrea hufrea Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ни таймаут, ни фейки здесь работать не будут, поэтому поддержку объявлять не стоит.
upd: я про стр.17

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Таймаут не работает (потому что не вмёржили в ядро), а фейки после починки sendfile вроде бы вполне себе работают.

proxy.c Outdated Show resolved Hide resolved
params.h Outdated Show resolved Hide resolved
struct tcp_md5sig md5 = {
.tcpm_keylen = 5
};
memcpy(&md5.tcpm_addr, &addr, addr_size);

#elif defined(__FreeBSD__)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Следует вовсе убрать поддержку md5sig. Так работать корректно не будет.

@@ -24,6 +24,10 @@
#define close(fd) closesocket(fd)
#endif

#ifdef __FreeBSD__
#include <netinet/in.h>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно поместить в #ifndef _win32

@@ -15,6 +15,10 @@
#include <arpa/inet.h>
#endif

#ifdef __FreeBSD__
#include <strings.h>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь #ifdef можно вовсе убрать.

@@ -82,7 +82,7 @@ static inline char addr_equ(

static inline int nb_socket(int domain, int type)
{
#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пусть accept4 будет только на Linux (ниже все равно вызывается fcntl).

@@ -83,7 +84,7 @@ static inline void delay(long ms)
#define delay(ms) Sleep(ms)
#endif

#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Структура tcp_info, определенная в desync.h, несовместима с FreeBSD, работать будет некорректно.

@hufrea
Copy link
Owner

hufrea commented Aug 12, 2024

Предлагаю сначала дождаться принятия #75 с некоторыми фиксами для BSD систем, а после сделать поправки конкретно для FreeBSD. Сейчас эти PR конфликтуют.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FreeBSD target binary?
2 participants