Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ INSTALL
sniproxy-*.tar.gz
tags
test-driver
.DS_Store
6 changes: 5 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ sniproxy_SOURCES = sniproxy.c \
table.c \
table.h \
tls.c \
tls.h
tls.h \
dtls.c \
dtls.h \
sni.c \
sni.h

sniproxy_LDADD = $(LIBEV_LIBS) $(LIBPCRE_LIBS) $(LIBUDNS_LIBS)
6 changes: 4 additions & 2 deletions src/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static int parse_ancillary_data(struct msghdr *);


struct binder_request {
int type;
size_t address_len;
struct sockaddr address[];
};
Expand Down Expand Up @@ -82,7 +83,7 @@ start_binder() {
}

int
bind_socket(const struct sockaddr *addr, size_t addr_len) {
bind_socket(int type, const struct sockaddr *addr, size_t addr_len) {
struct binder_request *request;
struct msghdr msg;
struct iovec iov[1];
Expand All @@ -99,6 +100,7 @@ bind_socket(const struct sockaddr *addr, size_t addr_len) {
if (request_len > sizeof(data_buf))
fatal("bind_socket: request length %zu exceeds buffer", request_len);
request = (struct binder_request *)data_buf;
request->type = type;
request->address_len = addr_len;
memcpy(&request->address, addr, addr_len);

Expand Down Expand Up @@ -159,7 +161,7 @@ binder_main(int sockfd) {

struct binder_request *req = (struct binder_request *)buffer;

int fd = socket(req->address[0].sa_family, SOCK_STREAM, 0);
int fd = socket(req->address[0].sa_family, req->type, 0);
if (fd < 0) {
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer), "socket(): %s", strerror(errno));
Expand Down
2 changes: 1 addition & 1 deletion src/binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <sys/socket.h>

void start_binder();
int bind_socket(const struct sockaddr *, size_t);
int bind_socket(int type, const struct sockaddr *, size_t);
void stop_binder();

#endif
Loading