-
Notifications
You must be signed in to change notification settings - Fork 124
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
base: main
Are you sure you want to change the base?
FreeBSD support #74
Conversation
b6c53d6
to
c2198d0
Compare
Makefile
Outdated
@@ -1,6 +1,6 @@ | |||
TARGET = ciadpi | |||
|
|||
CPPFLAGS = -D_XOPEN_SOURCE=500 | |||
#CPPFLAGS = -D_XOPEN_SOURCE=500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не следовало совсем убирать, можно было было изменить значение на 600 (#75)
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ни таймаут, ни фейки здесь работать не будут, поэтому поддержку объявлять не стоит.
upd: я про стр.17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Таймаут не работает (потому что не вмёржили в ядро), а фейки после починки sendfile вроде бы вполне себе работают.
struct tcp_md5sig md5 = { | ||
.tcpm_keylen = 5 | ||
}; | ||
memcpy(&md5.tcpm_addr, &addr, addr_size); | ||
|
||
#elif defined(__FreeBSD__) |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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__) |
There was a problem hiding this comment.
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__) |
There was a problem hiding this comment.
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, работать будет некорректно.
Предлагаю сначала дождаться принятия #75 с некоторыми фиксами для BSD систем, а после сделать поправки конкретно для FreeBSD. Сейчас эти PR конфликтуют. |
Closes #16