channel: Die on unexpected gossipd messages

This commit is contained in:
Christian Decker
2017-06-05 23:36:32 +02:00
committed by Rusty Russell
parent 3404509928
commit 605438f213
3 changed files with 6 additions and 0 deletions

View File

@@ -118,6 +118,9 @@ static struct io_plan *gossip_client_recv(struct io_conn *conn,
if (type == WIRE_CHANNEL_ANNOUNCEMENT || type == WIRE_CHANNEL_UPDATE ||
type == WIRE_NODE_ANNOUNCEMENT)
msg_enqueue(&peer->peer_out, msg);
else
status_failed(WIRE_CHANNEL_GOSSIP_BAD_MESSAGE,
"Got bad message from gossipd: %d", type);
return daemon_conn_read_next(conn, dc);
}
@@ -1327,6 +1330,7 @@ static struct io_plan *req_in(struct io_conn *conn, struct daemon_conn *master)
case WIRE_CHANNEL_BAD_COMMAND:
case WIRE_CHANNEL_HSM_FAILED:
case WIRE_CHANNEL_CRYPTO_FAILED:
case WIRE_CHANNEL_GOSSIP_BAD_MESSAGE:
case WIRE_CHANNEL_INTERNAL_ERROR:
case WIRE_CHANNEL_PEER_WRITE_FAILED:
case WIRE_CHANNEL_PEER_READ_FAILED:

View File

@@ -4,6 +4,7 @@ channel_bad_command,0x8000
channel_hsm_failed,0x8001
channel_crypto_failed,0x8002
channel_internal_error,0x8003
channel_gossip_bad_message,0x8004
# These are due to peer.
channel_peer_write_failed,0x8010
1 # Shouldn't happen
4 channel_hsm_failed,0x8001
5 channel_crypto_failed,0x8002
6 channel_internal_error,0x8003
7 channel_gossip_bad_message,0x8004
8 # These are due to peer.
9 channel_peer_write_failed,0x8010
10 channel_peer_read_failed,0x8011

View File

@@ -1476,6 +1476,7 @@ static int channel_msg(struct subd *sd, const u8 *msg, const int *unused)
case WIRE_CHANNEL_BAD_COMMAND:
case WIRE_CHANNEL_HSM_FAILED:
case WIRE_CHANNEL_CRYPTO_FAILED:
case WIRE_CHANNEL_GOSSIP_BAD_MESSAGE:
case WIRE_CHANNEL_INTERNAL_ERROR:
case WIRE_CHANNEL_PEER_WRITE_FAILED:
case WIRE_CHANNEL_PEER_READ_FAILED: