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

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



On Fri, 14 Feb 2014 12:00:40 +0100
Fabian Keil <freebsd-listen@xxxxxxxxxxxxx> wrote:

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

Merged, it's fine to include there since some of the pts also use the
endian conversion macros.

> > Please let me know if it's still broken/if I've missed anything.
> 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; ^

This should also be fixed, left out #include <array> in
scramblesuit/client.h.

> 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 [...]

Argh.  Ok, I think I know what the issue is, although it builds fine
with: 

somme :: Development/obfsclient/build âmaster*â % clang --version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Please try the attached patch and let me know if it's *still* broken.
If it works, I'll merge the change.

On a side note, tip of tree requires updating liballium since I
switched both of liballium and obfsclient to auto[conf/make]/libtool.
Hopefully the build process is less rage inducing now.

Apologies in advance for the inconvenience, and thanks for the changes
and your patience.

-- 
Yawning Angel
diff --git a/src/schwanenlied/pt/obfs2/client.cc b/src/schwanenlied/pt/obfs2/client.cc
index 57daff4..0b567cc 100644
--- a/src/schwanenlied/pt/obfs2/client.cc
+++ b/src/schwanenlied/pt/obfs2/client.cc
@@ -46,6 +46,14 @@ namespace schwanenlied {
 namespace pt {
 namespace obfs2 {
 
+Socks5Server::Session* Client::SessionFactory::create_session(struct event_base* base,
+                                                              const evutil_socket_t sock,
+                                                              const struct sockaddr* addr,
+                                                              const int addr_len) {
+  return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
+                                                        addr_len));
+}
+
 void Client::on_outgoing_connected() {
   static constexpr ::std::array<uint8_t, 29> init_mac_key = { {
     'I', 'n', 'i', 't', 'i', 'a', 't', 'o', 'r', ' ',
diff --git a/src/schwanenlied/pt/obfs2/client.h b/src/schwanenlied/pt/obfs2/client.h
index 7528d94..0c76df6 100644
--- a/src/schwanenlied/pt/obfs2/client.h
+++ b/src/schwanenlied/pt/obfs2/client.h
@@ -60,10 +60,7 @@ class Client : public Socks5Server::Session {
     Socks5Server::Session* create_session(struct event_base* base,
                                           const evutil_socket_t sock,
                                           const struct sockaddr *addr,
-                                          const int addr_len) override {
-      return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
-                                                            addr_len));
-    }
+                                          const int addr_len) override;
   };
 
   Client(struct event_base* base,
diff --git a/src/schwanenlied/pt/obfs3/client.cc b/src/schwanenlied/pt/obfs3/client.cc
index d98f3ec..eefcb39 100644
--- a/src/schwanenlied/pt/obfs3/client.cc
+++ b/src/schwanenlied/pt/obfs3/client.cc
@@ -41,6 +41,14 @@ namespace schwanenlied {
 namespace pt {
 namespace obfs3 {
 
+Socks5Server::Session* Client::SessionFactory::create_session(struct event_base* base,
+                                                              const evutil_socket_t sock,
+                                                              const struct sockaddr* addr,
+                                                              const int addr_len) {
+  return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
+                                                        addr_len));
+}
+
 void Client::on_outgoing_connected() {
   SL_ASSERT(state_ == State::kCONNECTING);
 
diff --git a/src/schwanenlied/pt/obfs3/client.h b/src/schwanenlied/pt/obfs3/client.h
index d7a230c..86d3390 100644
--- a/src/schwanenlied/pt/obfs3/client.h
+++ b/src/schwanenlied/pt/obfs3/client.h
@@ -62,10 +62,7 @@ class Client : public Socks5Server::Session {
     Socks5Server::Session* create_session(struct event_base* base,
                                           const evutil_socket_t sock,
                                           const struct sockaddr* addr,
-                                          const int addr_len) override {
-      return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
-                                                            addr_len));
-    }
+                                          const int addr_len) override;
   };
 
   Client(struct event_base* base,
diff --git a/src/schwanenlied/pt/scramblesuit/client.cc b/src/schwanenlied/pt/scramblesuit/client.cc
index c68a704..b93d27e 100644
--- a/src/schwanenlied/pt/scramblesuit/client.cc
+++ b/src/schwanenlied/pt/scramblesuit/client.cc
@@ -48,6 +48,14 @@ namespace scramblesuit {
 
 constexpr size_t Client::kMaxPayloadLength;
 
+Socks5Server::Session* Client::SessionFactory::create_session(struct event_base* base,
+                                                              const evutil_socket_t sock,
+                                                              const struct sockaddr* addr,
+                                                              const int addr_len) {
+  return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
+                                                        addr_len));
+}
+
 bool Client::on_client_authenticate(const uint8_t* uname,
                                     const uint8_t ulen,
                                     const uint8_t* passwd,
diff --git a/src/schwanenlied/pt/scramblesuit/client.h b/src/schwanenlied/pt/scramblesuit/client.h
index ce49bd1..9d176bc 100644
--- a/src/schwanenlied/pt/scramblesuit/client.h
+++ b/src/schwanenlied/pt/scramblesuit/client.h
@@ -57,15 +57,13 @@ namespace scramblesuit {
 
 class Client : public Socks5Server::Session {
  public:
+  /** Client factory */
   class SessionFactory : public Socks5Server::SessionFactory {
    public:
     Socks5Server::Session* create_session(struct event_base* base,
                                           const evutil_socket_t sock,
                                           const struct sockaddr* addr,
-                                          const int addr_len) override {
-      return static_cast<Socks5Server::Session*>(new Client(base, sock, addr,
-                                                            addr_len));
-    }
+                                          const int addr_len) override;
   };
 
   Client(struct event_base* base,

Attachment: signature.asc
Description: PGP signature

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