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

make it possible to specify the IP address to bind to #13

Open
ostap opened this issue Oct 4, 2012 · 1 comment
Open

make it possible to specify the IP address to bind to #13

ostap opened this issue Oct 4, 2012 · 1 comment
Labels

Comments

@ostap
Copy link
Member

ostap commented Oct 4, 2012

currently all sockets are bound to INADDR_ANY which might be insecure and even problematic in certain environments. this enhancement is to take the IP address to bind to as a command line argument.

@ostap
Copy link
Member Author

ostap commented Oct 4, 2012

since it might take a while to implement this feature for the distributed mode, here is the workaround:

diff --git a/system.c b/system.c
index beb4bc6..bf359a3 100644
--- a/system.c
+++ b/system.c
@@ -358,7 +358,7 @@ extern IO *sys_socket(int *port)
     unsigned int size = sizeof(addr);
     addr.sin_family = AF_INET;
     addr.sin_port = htons(*port);
-    addr.sin_addr.s_addr = INADDR_ANY;
+    addr.sin_addr.s_addr = inet_addr("127.0.0.1");

     if (bind(sfd, (struct sockaddr*) &addr, size) < 0)
         sys_die("sys: cannot bind a socket to port %d\n", *port);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant