Browse Source

Revert "Specify the alignment of all structs"

This reverts commit d0285d6b4f.
pull/2421/head
Max Lv 5 years ago
parent
commit
59417b9779
6 changed files with 26 additions and 26 deletions
  1. 8
      src/crypto.h
  2. 10
      src/local.h
  3. 4
      src/manager.h
  4. 10
      src/redir.h
  5. 14
      src/server.h
  6. 6
      src/udprelay.h

8
src/crypto.h

@ -92,7 +92,7 @@ typedef struct buffer {
size_t len;
size_t capacity;
char *data;
} __attribute__((aligned(4))) buffer_t;
} buffer_t;
typedef struct {
int method;
@ -102,7 +102,7 @@ typedef struct {
size_t key_len;
size_t tag_len;
uint8_t key[MAX_KEY_LENGTH];
} __attribute__((aligned(4))) cipher_t;
} cipher_t;
typedef struct {
uint32_t init;
@ -114,7 +114,7 @@ typedef struct {
uint8_t salt[MAX_KEY_LENGTH];
uint8_t skey[MAX_KEY_LENGTH];
uint8_t nonce[MAX_NONCE_LENGTH];
} __attribute__((aligned(4))) cipher_ctx_t;
} cipher_ctx_t;
typedef struct crypto {
cipher_t *cipher;
@ -126,7 +126,7 @@ typedef struct crypto {
void(*const ctx_init) (cipher_t *, cipher_ctx_t *, int);
void(*const ctx_release) (cipher_ctx_t *);
} __attribute__((aligned(4))) crypto_t;
} crypto_t;
int balloc(buffer_t *, size_t);
int brealloc(buffer_t *, size_t, size_t);

10
src/local.h

@ -49,13 +49,13 @@ typedef struct listen_ctx {
int fd;
int mptcp;
struct sockaddr **remote_addr;
} __attribute__((aligned(4))) listen_ctx_t;
} listen_ctx_t;
typedef struct server_ctx {
ev_io io;
int connected;
struct server *server;
} __attribute__((aligned(4))) server_ctx_t;
} server_ctx_t;
typedef struct server {
int fd;
@ -74,7 +74,7 @@ typedef struct server {
ev_timer delayed_connect_watcher;
struct cork_dllist_item entries;
} __attribute__((aligned(4))) server_t;
} server_t;
typedef struct remote_ctx {
ev_io io;
@ -82,7 +82,7 @@ typedef struct remote_ctx {
int connected;
struct remote *remote;
} __attribute__((aligned(4))) remote_ctx_t;
} remote_ctx_t;
typedef struct remote {
int fd;
@ -100,6 +100,6 @@ typedef struct remote {
struct remote_ctx *send_ctx;
struct server *server;
struct sockaddr_storage addr;
} __attribute__((aligned(4))) remote_t;
} remote_t;
#endif // _LOCAL_H

4
src/manager.h

@ -63,7 +63,7 @@ struct manager_ctx {
#ifdef HAVE_SETRLIMIT
int nofile;
#endif
} __attribute__((aligned(4)));
};
struct server {
char port[8];
@ -75,6 +75,6 @@ struct server {
char *plugin;
char *plugin_opts;
uint64_t traffic;
} __attribute__((aligned(4)));
};
#endif // _MANAGER_H

10
src/redir.h

@ -39,13 +39,13 @@ typedef struct listen_ctx {
int mptcp;
int tos;
struct sockaddr **remote_addr;
} __attribute__((aligned(4))) listen_ctx_t;
} listen_ctx_t;
typedef struct server_ctx {
ev_io io;
int connected;
struct server *server;
} __attribute__((aligned(4))) server_ctx_t;
} server_ctx_t;
typedef struct server {
int fd;
@ -60,14 +60,14 @@ typedef struct server {
struct sockaddr_storage destaddr;
ev_timer delayed_connect_watcher;
} __attribute__((aligned(4))) server_t;
} server_t;
typedef struct remote_ctx {
ev_io io;
ev_timer watcher;
int connected;
struct remote *remote;
} __attribute__((aligned(4))) remote_ctx_t;
} remote_ctx_t;
typedef struct remote {
int fd;
@ -77,6 +77,6 @@ typedef struct remote {
struct server *server;
uint32_t counter;
struct sockaddr *addr;
} __attribute__((aligned(4))) remote_t;
} remote_t;
#endif // _REDIR_H

14
src/server.h

@ -49,14 +49,14 @@ typedef struct listen_ctx {
int timeout;
char *iface;
struct ev_loop *loop;
} __attribute__((aligned(4))) listen_ctx_t;
} listen_ctx_t;
typedef struct server_ctx {
ev_io io;
ev_timer watcher;
int connected;
struct server *server;
} __attribute__((aligned(4))) server_ctx_t;
} server_ctx_t;
#ifdef USE_NFCONNTRACK_TOS
@ -68,7 +68,7 @@ struct dscptracker {
long unsigned int mark;
unsigned int dscp;
unsigned int packet_count;
} __attribute__((aligned(4)));
};
#endif
@ -94,18 +94,18 @@ typedef struct server {
#ifdef USE_NFCONNTRACK_TOS
struct dscptracker *tracker;
#endif
} __attribute__((aligned(4))) server_t;
} server_t;
typedef struct query {
server_t *server;
char hostname[MAX_HOSTNAME_LEN];
} __attribute__((aligned(4))) query_t;
} query_t;
typedef struct remote_ctx {
ev_io io;
int connected;
struct remote *remote;
} __attribute__((aligned(4))) remote_ctx_t;
} remote_ctx_t;
typedef struct remote {
int fd;
@ -117,6 +117,6 @@ typedef struct remote {
struct remote_ctx *recv_ctx;
struct remote_ctx *send_ctx;
struct server *server;
} __attribute__((aligned(4))) remote_t;
} remote_t;
#endif // _SERVER_H

6
src/udprelay.h

@ -65,7 +65,7 @@ typedef struct server_ctx {
#ifdef MODULE_REMOTE
struct ev_loop *loop;
#endif
} __attribute__((aligned(4))) server_ctx_t;
} server_ctx_t;
#ifdef MODULE_REMOTE
typedef struct query_ctx {
@ -75,7 +75,7 @@ typedef struct query_ctx {
char addr_header[MAX_ADDR_HEADER_SIZE];
struct server_ctx *server_ctx;
struct remote_ctx *remote_ctx;
} __attribute__((aligned(4))) query_ctx_t;
} query_ctx_t;
#endif
typedef struct remote_ctx {
@ -88,6 +88,6 @@ typedef struct remote_ctx {
struct sockaddr_storage dst_addr;
#endif
struct server_ctx *server_ctx;
} __attribute__((aligned(4))) remote_ctx_t;
} remote_ctx_t;
#endif // _UDPRELAY_H
Loading…
Cancel
Save