Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use port number passed into make and fix uploads #2

Merged
merged 4 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 5 additions & 2 deletions tcp_bridge/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS ?= -Wall -Werror -pedantic -DPORT=$(PORT)
CFLAGS ?= -Wall -Werror -pedantic -D LISTEN_PORT=$(PORT)

tcp_bridge: tcp_bridge.c
$(CC) $(CFLAGS) -o $@ $^
Expand All @@ -8,4 +8,7 @@ tcp_bridge: tcp_bridge.c

setcap: tcp_bridge
@echo "Please enter your sudo password to grant $< access to ports below 1024."
sudo setcap CAP_NET_BIND_SERVICE=+eip "$<"
sudo setcap CAP_NET_BIND_SERVICE=+eip "$<"

clean:
rm -f tcp_bridge
3 changes: 1 addition & 2 deletions tcp_bridge/tcp_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define IP_TO_INT(A, B, C, D) (((A) & 0xFF) << 24 | ((B) & 0xFF) << 16 | ((C) & 0xFF) << 8 | ((D) & 0xFF))

#define LISTEN_ADDRESS IP_TO_INT(127,0,0,1)
#define LISTEN_PORT 23
#define BUFFER_SIZE 1024
#define MAX_CLIENTS 1

Expand Down Expand Up @@ -130,4 +129,4 @@ int main()
close(server_socket);

return 0;
}
}