Add tcp.islocal to rtr (#9508)

1. Currently, tcp server binds any interface. The option
    allows to restrict the binding to loopback interface only.
    e tcp.islocal=true.
This commit is contained in:
Siarhei Siniak 2018-02-27 15:11:26 +03:00 committed by radare
parent c12418f05f
commit a792aaafbe
2 changed files with 5 additions and 0 deletions

View File

@ -2711,6 +2711,9 @@ R_API int r_core_config_init(RCore *core) {
free (tmpdir);
r_config_desc (cfg, "http.uproot", "Path where files are uploaded");
/* tcp */
SETPREF ("tcp.islocal", "false", "Bind a loopback for tcp command server");
/* graph */
SETPREF ("graph.comments", "true", "Show disasm comments in graph");
SETPREF ("graph.cmtright", "false", "Show comments at right");

View File

@ -1847,6 +1847,8 @@ R_API int r_core_rtr_cmds (RCore *core, const char *port) {
}
s = r_socket_new (0);
s->local = r_config_get_i(core->config, "tcp.islocal");
if (!r_socket_listen (s, port, NULL)) {
eprintf ("Error listening on port %s\n", port);
r_socket_free (s);