From 686ff6edef6f356579a8259ac2fc6cf567c98140 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 14 Nov 2016 23:19:32 +0100 Subject: [PATCH 1/2] irc: Switched to LFNet.org IRC server This is a temporary fix until we finish #88. --- daemon/irc_announce.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/irc_announce.c b/daemon/irc_announce.c index 4f6733585..27831f305 100644 --- a/daemon/irc_announce.c +++ b/daemon/irc_announce.c @@ -224,11 +224,11 @@ static void handle_irc_command(struct ircstate *istate, const struct irccommand { struct lightningd_state *dstate = istate->dstate; char **params = tal_strsplit(cmd, cmd->params, " ", STR_NO_EMPTY); - int numparams = tal_count(params) - 1; - if (streq(cmd->command, "378")) { + if (streq(cmd->command, "338")) { dstate->external_ip = tal_strdup( - istate->dstate, params[numparams - 1]); + istate->dstate, params[3]); + log_debug(dstate->base_log, "Detected my own IP as %s", dstate->external_ip); // Add our node to the node_map for completeness add_node(istate->dstate, &dstate->id, @@ -265,7 +265,7 @@ void setup_irc_connection(struct lightningd_state *dstate) struct ircstate *state = talz(dstate, struct ircstate); state->dstate = dstate; - state->server = "irc.freenode.net"; + state->server = "irc.lfnet.org"; state->reconnect_timeout = time_from_sec(15); state->log = new_log(state, state->dstate->log_record, "%s:irc", log_prefix(state->dstate->base_log)); From 42a33df42e59c5bc7dd3c4b953dea33f06de21a5 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 16 Nov 2016 22:55:29 +0100 Subject: [PATCH 2/2] irc: Checking for param count before accessing --- daemon/irc_announce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/irc_announce.c b/daemon/irc_announce.c index 27831f305..df13cd630 100644 --- a/daemon/irc_announce.c +++ b/daemon/irc_announce.c @@ -225,7 +225,7 @@ static void handle_irc_command(struct ircstate *istate, const struct irccommand struct lightningd_state *dstate = istate->dstate; char **params = tal_strsplit(cmd, cmd->params, " ", STR_NO_EMPTY); - if (streq(cmd->command, "338")) { + if (streq(cmd->command, "338") && tal_count(params) >= 4) { dstate->external_ip = tal_strdup( istate->dstate, params[3]); log_debug(dstate->base_log, "Detected my own IP as %s", dstate->external_ip);