Skip to content

Commit

Permalink
add some todos
Browse files Browse the repository at this point in the history
  • Loading branch information
grkarthik committed Dec 24, 2023
1 parent 07346dc commit 5930533
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/listen.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static int dual_tcp_recv(rad_listen_t *listener)

if (listener->status != RAD_LISTEN_STATUS_KNOWN) return 0;

if (listener->proxy_protocol) {
if (listener->proxy_protocol && !sock->packet) {
// rcode = proxy_protocol_check(listener, request);
// if (rcode < 0) {
// RDEBUG("(TCP) Closing PROXY TCP socket from client port %u", sock->other_port);
Expand All @@ -823,6 +823,7 @@ static int dual_tcp_recv(rad_listen_t *listener)
// proxy_header = talloc_array(sock, uint8_t, 107);
uint8_t proxy_header[107];
len = recv(listener->fd, proxy_header, 107, MSG_PEEK);
if (len < 9) return 0;
fprintf(stderr, "received data of length: %d\n", len);

// read to make sense of the header "PROXY TCP"
Expand All @@ -831,7 +832,10 @@ static int dual_tcp_recv(rad_listen_t *listener)
// extract the fields now
p = proxy_header;
start = proxy_header;
while ((p + 1) < proxy_header + 107) {

// todo: if ctrl character isn't encountered then we need to check if we haven't received the packet completely
// how to differentiate icomplete packet and bad packet...
while ((p + 1) < proxy_header + len) {
if ((p[0] == 0x0d) && (p[1] == 0x0a)) {
eol = p;
fprintf(stderr, "found ctrl character within length: %d\n", eol - start);
Expand Down

0 comments on commit 5930533

Please sign in to comment.