[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] Call for testing/review: obfsclient



Yawning Angel <yawning@xxxxxxxxxxxxxxx> wrote:

> On Thu, 13 Feb 2014 14:06:39 +0100
> Fabian Keil <freebsd-listen@xxxxxxxxxxxxx> wrote:
> > Trying to build it on FreeBSD 11.0-CURRENT I get (after a couple
> > of other issues):
> 
> FreeBSD has Clang as the default compiler right?

Right. ATM, I'm using:

fk@r500 ~ $clang --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd11.0
Thread model: posix

> > fk@r500 ~/git/obfsclient $make obfsclient
> > [ 91%] Built target obfsclient_lib
> > [100%] Building CXX object src/CMakeFiles/obfsclient.dir/main.cc.o
> > In file included from /home/fk/git/obfsclient/src/main.cc:49:
> > /home/fk/git/obfsclient/src/schwanenlied/pt/scramblesuit/client.h:145:60:
> > error: implicit instantiation of undefined template
> > 'std::__1::array<unsigned char, 1448>' ::std::array<uint8_t,
> > kHeaderLength + kMaxPayloadLength> decode_buf_;
> > ^ /usr/include/c++/v1/__tuple:69:60: note: template is declared here
> > template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS array; ^
> > In file included from /home/fk/git/obfsclient/src/main.cc:49:
> > /home/fk/git/obfsclient/src/schwanenlied/pt/scramblesuit/client.h:64:14:
> > error: cannot initialize return object of type 'Socks5Server::Session
> > *' with an rvalue of type 'schwanenlied::pt::scramblesuit::Client *'
> > return new Client(base, sock, addr, addr_len);
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated.
> 
> I've installed Clang, so I locally fixed all the other minor issues[0]
> you probably encountered but I didn't encounter the last error, I think
> I know why it's unhappy and believe it's fixed.
> 
> commit 581bb2ac42be529b7bb5f8617a3c362ac38e47f9
> commit 218c86b501f897a6c6b6e0bd14bde9ada5488b5d
> commit 594caa7f36ae9f5a465324eda983b70c6289fcfb <- master

Thanks. On FreeBSD, I also had to include <netinet/in.h> to prevent:

/home/fk/git/obfsclient/src/schwanenlied/socks5_server.h:359:22: error: field has incomplete type 'struct sockaddr_in'
  struct sockaddr_in listener_addr_;  /**< The SOCKS server socket address */
                     ^
/home/fk/git/obfsclient/src/schwanenlied/socks5_server.h:327:26: note: forward declaration of 'schwanenlied::sockaddr_in'
  const bool addr(struct sockaddr_in& addr) const;
                         ^
/home/fk/git/obfsclient/src/schwanenlied/pt/obfs2/client.cc:90:19: error: use of undeclared identifier 'htonl'
  pad_hdr.at(0) = htonl(kMagicValue);
                  ^
/home/fk/git/obfsclient/src/schwanenlied/pt/obfs2/client.cc:91:19: error: use of undeclared identifier 'htonl'
  pad_hdr.at(1) = htonl(padlen);
                  ^
/home/fk/git/obfsclient/src/schwanenlied/pt/obfs2/client.cc:185:9: error: use of undeclared identifier 'ntohl'
    if (ntohl(pad_hdr.at(0)) != kMagicValue)
        ^
/home/fk/git/obfsclient/src/schwanenlied/pt/obfs2/client.cc:187:21: error: use of undeclared identifier 'ntohl'
    resp_pad_len_ = ntohl(pad_hdr.at(1));
                    ^
5 errors generated.

Patch attached. Maybe client.cc should get its own #include, though.

> Please let me know if it's still broken/if I've missed anything.

The problem still exists:

fk@r500 ~/git/obfsclient $make obfsclient
[  8%] Building CXX object src/CMakeFiles/obfsclient_lib.dir/schwanenlied/crypto/base32.cc.o
[...]
[ 91%] Building CXX object src/CMakeFiles/obfsclient_lib.dir/schwanenlied/socks5_server.cc.o
Linking CXX static library libobfsclient_lib.a
[ 91%] Built target obfsclient_lib
[100%] Building CXX object src/CMakeFiles/obfsclient.dir/main.cc.o
In file included from /home/fk/git/obfsclient/src/main.cc:49:
/home/fk/git/obfsclient/src/schwanenlied/pt/scramblesuit/client.h:146:60: error: implicit instantiation of undefined template 'std::__1::array<unsigned char, 1448>'
  ::std::array<uint8_t, kHeaderLength + kMaxPayloadLength> decode_buf_;
                                                           ^
/usr/include/c++/v1/__tuple:69:60: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS array;
                                                           ^
In file included from /home/fk/git/obfsclient/src/main.cc:49:
/home/fk/git/obfsclient/src/schwanenlied/pt/scramblesuit/client.h:64:14: error: static_cast from 'schwanenlied::pt::scramblesuit::Client *' to 'Socks5Server::Session *' is not allowed
      return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
*** Error code 1
[...]

Fabian
From 01f1fc5f789bb9417acfb61547bf5e16cd42747e Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@xxxxxxxxxxxxx>
Date: Thu, 13 Feb 2014 12:25:26 +0100
Subject: [PATCH] Include <netinet/in.h> for struct sockaddr_storage, htonl()
 and ntohl()

---
 src/schwanenlied/socks5_server.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/schwanenlied/socks5_server.h b/src/schwanenlied/socks5_server.h
index 3e79287..4c9dcde 100644
--- a/src/schwanenlied/socks5_server.h
+++ b/src/schwanenlied/socks5_server.h
@@ -34,6 +34,8 @@
 #ifndef SCHWANENLIED_SOCKS5_SERVER_H__
 #define SCHWANENLIED_SOCKS5_SERVER_H__
 
+#include <netinet/in.h>
+
 #include <list>
 #include <memory>
 
-- 
1.8.5.4

Attachment: signature.asc
Description: PGP signature

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev