Skip to content

port netbsd openbsd freebsd - #518

Open
leonkakaowiec6 wants to merge 36 commits into
yedino:devfrom
leonkakaowiec6:lk6_netbsd_openbsd_freebsd
Open

port netbsd openbsd freebsd#518
leonkakaowiec6 wants to merge 36 commits into
yedino:devfrom
leonkakaowiec6:lk6_netbsd_openbsd_freebsd

Conversation

@leonkakaowiec6

Copy link
Copy Markdown

No description provided.

@coveralls

coveralls commented Aug 5, 2018

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.2%) to 42.613% when pulling 848cc61 on leonkakaowiec6:lk6_netbsd_openbsd_freebsd into 4847df6 on yedino:dev.

@leonkakaowiec6
leonkakaowiec6 force-pushed the lk6_netbsd_openbsd_freebsd branch 2 times, most recently from 9db626d to e660627 Compare August 15, 2018 22:54
[wip] antinet_freebsd

Fix compilation on FreeBSD and flags for tun if
Disable some piece of code
@leonkakaowiec6
leonkakaowiec6 force-pushed the lk6_netbsd_openbsd_freebsd branch 2 times, most recently from 99ae81b to e660627 Compare August 16, 2018 00:39
Comment thread CMakeLists.txt
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANTINET_macosx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANTINET_macosx")
endif()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why we need all this macros?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Comment thread contrib/config/NetBSD.sh
@@ -0,0 +1,4 @@
export CC=/usr/pkg/gcc7/bin/gcc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be cmake toolchain file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this is configuration files for env variables, to test. nothing more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.

Comment thread contrib/config/OpenBSD.sh
@@ -0,0 +1,4 @@
export CC=/usr/local/bin/egcc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be cmake toolchain file

@leonkakaowiec6 leonkakaowiec6 Sep 22, 2018

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this is configuration files for env variables, to test. nothing more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is really part of this PR?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i dont know what is it and from it is, not my commit.

Comment thread src-tools/netmodel/netmodel.cpp
Comment thread src/c_tun_device.cpp Outdated
}

size_t c_tun_device_bsd::write_to_tun(void *buf, size_t count) {
int wret = write_tun(m_tun_fd, buf, count);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wres should be size_t

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

Comment thread src/c_tun_device.cpp
Comment thread src/c_ip46_addr.hpp Outdated
#ifdef __linux__
#include "platform.hpp"

#if defined(__linux__)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if platform.hpp is included we should use ANTINET_linux, ANTINET_windows and ANTINET_macosx macros

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

Comment thread src/c_ip46_addr.hpp Outdated

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be unsigned short type (as in boost::asio)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

Comment thread src/c_peering.cpp
Comment thread src/c_tun_device.hpp Outdated

#ifdef __FreeBSD__

#if 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

delete this code if is not needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

👍

Comment thread src/c_udp_wrapper.cpp Outdated
pfp_warn("Socket is disabled, listen_port="<<listen_port);
return;
}
assert(m_socket >= 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be if() throw, not assert

Comment thread src/c_udp_wrapper.cpp Outdated
pfp_throw_error_sub( tuntap_error_devtun , errorstring.str() );
}

assert( bind_result >= 0 ); // TODO change to except

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

change to except

Comment thread src/datastore.cpp Outdated
} else {
user_home = b_fs::path(home_dir);
}
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code for net, open and free bsd are the same

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes

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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is void method, return is not needed

~c_tuntap_system_functions() = default;

int ioctl(int fd, unsigned long request, void *ifreq) override
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

move implementation to cpp file
this code is duplicated


type = htonl(AF_INET6);

iv[0].iov_base = (char *)&type;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

c-cast

u_int32_t type;
struct iovec iv[2];

iv[0].iov_base = (char *)&type;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

c-cast

Comment thread src/tuntap/openbsd/c_tuntap_openbsd_obj.cpp
Comment thread src/tuntap/openbsd/c_tuntap_openbsd_obj.hpp
Comment thread contrib/config/NetBSD.sh
@@ -0,0 +1,4 @@
export CC=/usr/pkg/gcc7/bin/gcc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.

Comment thread contrib/config/OpenBSD.sh
@@ -0,0 +1,4 @@
export CC=/usr/local/bin/egcc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, so move this info toolchain file like cmake/toolchain_netbsd.cmake.in. We will need this for future builds.

Comment thread src/c_ip46_addr.cpp
// end of: __win32 || __cygwin__ || __mach__ (multiplatform boost::asio)
#endif

#if defined(ANTINET_netbsd) || defined(ANTINET_openbsd) || defined(ANTINET_freebsd)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So do this refactoring.

Comment thread src/c_peering.cpp
Comment thread src/c_tun_device.cpp

#if defined(ANTINET_freebsd)
// TODO: clean
struct prf_ra {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I asked about the struct. Add comment.

Comment thread src/c_tun_device.cpp
#include <io.h>
#ifndef NTSTATUS
#define NTSTATUS LONG
#define NTSTATUS LONG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

restore old indent

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.

3 participants