port netbsd openbsd freebsd - #518
Conversation
Fix build on macos Fix build on macos Fix build on macos
9db626d to
e660627
Compare
[wip] antinet_freebsd Fix compilation on FreeBSD and flags for tun if
Disable some piece of code
99ae81b to
e660627
Compare
fix MacOSX readlink name fix MacOSX readlink name
…nd add condition for compile tuntap driver dependency of OS
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANTINET_macosx") | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANTINET_macosx") | ||
| endif() | ||
|
|
There was a problem hiding this comment.
why we need all this macros?
There was a problem hiding this comment.
i think on configuration stage, not on compilation time and after clean "platform.hpp" in include directives, speed of compilation time going up. We need check this.
| @@ -0,0 +1,4 @@ | |||
| export CC=/usr/pkg/gcc7/bin/gcc | |||
There was a problem hiding this comment.
this should be cmake toolchain file
There was a problem hiding this comment.
this is configuration files for env variables, to test. nothing more.
There was a problem hiding this comment.
ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.
| @@ -0,0 +1,4 @@ | |||
| export CC=/usr/local/bin/egcc | |||
There was a problem hiding this comment.
this should be cmake toolchain file
There was a problem hiding this comment.
this is configuration files for env variables, to test. nothing more.
There was a problem hiding this comment.
ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.
| export FAKETIME="$REFERENCE_DATETIME" | ||
|
|
||
| # import functions | ||
| . "${GALAXY_DIR}"/share/script/lib/fail.sh |
There was a problem hiding this comment.
this is really part of this PR?
There was a problem hiding this comment.
i dont know what is it and from it is, not my commit.
| } | ||
|
|
||
| size_t c_tun_device_bsd::write_to_tun(void *buf, size_t count) { | ||
| int wret = write_tun(m_tun_fd, buf, count); |
| #ifdef __linux__ | ||
| #include "platform.hpp" | ||
|
|
||
| #if defined(__linux__) |
There was a problem hiding this comment.
if platform.hpp is included we should use ANTINET_linux, ANTINET_windows and ANTINET_macosx macros
|
|
||
| t_ip_data m_ip_data; ///< current ip either ipv4, or ipv6, including the port too | ||
| boost::asio::ip::address m_address; | ||
| int m_port = 9042; |
There was a problem hiding this comment.
this should be unsigned short type (as in boost::asio)
|
|
||
| #ifdef __FreeBSD__ | ||
|
|
||
| #if 0 |
There was a problem hiding this comment.
delete this code if is not needed
| pfp_warn("Socket is disabled, listen_port="<<listen_port); | ||
| return; | ||
| } | ||
| assert(m_socket >= 0); |
There was a problem hiding this comment.
this should be if() throw, not assert
| pfp_throw_error_sub( tuntap_error_devtun , errorstring.str() ); | ||
| } | ||
|
|
||
| assert( bind_result >= 0 ); // TODO change to except |
| } else { | ||
| user_home = b_fs::path(home_dir); | ||
| } | ||
| #endif |
There was a problem hiding this comment.
code for net, open and free bsd are the same
| auto asio_handler = [data, handler](const boost::system::error_code& error, std::size_t bytes_transferred) { | ||
| handler(data, bytes_transferred, error); | ||
| }; | ||
| return m_tun_stream.async_read_some(boost::asio::buffer(data, size), asio_handler); |
There was a problem hiding this comment.
this is void method, return is not needed
| ~c_tuntap_system_functions() = default; | ||
|
|
||
| int ioctl(int fd, unsigned long request, void *ifreq) override | ||
| { |
There was a problem hiding this comment.
move implementation to cpp file
this code is duplicated
|
|
||
| type = htonl(AF_INET6); | ||
|
|
||
| iv[0].iov_base = (char *)&type; |
| u_int32_t type; | ||
| struct iovec iv[2]; | ||
|
|
||
| iv[0].iov_base = (char *)&type; |
| @@ -0,0 +1,4 @@ | |||
| export CC=/usr/pkg/gcc7/bin/gcc | |||
There was a problem hiding this comment.
ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.
| @@ -0,0 +1,4 @@ | |||
| export CC=/usr/local/bin/egcc | |||
There was a problem hiding this comment.
ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.
| // end of: __win32 || __cygwin__ || __mach__ (multiplatform boost::asio) | ||
| #endif | ||
|
|
||
| #if defined(ANTINET_netbsd) || defined(ANTINET_openbsd) || defined(ANTINET_freebsd) |
|
|
||
| #if defined(ANTINET_freebsd) | ||
| // TODO: clean | ||
| struct prf_ra { |
There was a problem hiding this comment.
I asked about the struct. Add comment.
| #include <io.h> | ||
| #ifndef NTSTATUS | ||
| #define NTSTATUS LONG | ||
| #define NTSTATUS LONG |
No description provided.