| 911 | } |
| 912 | |
| 913 | static bool handle_custommsg(struct daemon *daemon, |
| 914 | struct peer *peer, |
| 915 | const u8 *msg) |
| 916 | { |
| 917 | enum peer_wire type = fromwire_peektype(msg); |
| 918 | |
| 919 | /* Messages we expect to handle ourselves. */ |
| 920 | if (peer_wire_is_internal(type)) |
| 921 | return false; |
| 922 | |
| 923 | /* We log it, since it's not going to a subdaemon */ |
| 924 | status_peer_io(LOG_IO_IN, &peer->id, msg); |
| 925 | |
| 926 | /* Even unknown messages must be explicitly allowed */ |
| 927 | if (type % 2 == 0 && !find_custom_msg(daemon->custom_msgs, type)) { |
| 928 | send_warning(peer, "Invalid unknown even msg %s", |
| 929 | tal_hex(msg, msg)); |
| 930 | /* We "handled" it... */ |
| 931 | return true; |
| 932 | } |
| 933 | |
| 934 | /* The message is not part of the messages we know how to |
| 935 | * handle. Assuming this is a custommsg, we just forward it to the |
| 936 | * master. */ |
| 937 | daemon_conn_send(daemon->master, |
| 938 | take(towire_connectd_custommsg_in(NULL, |
| 939 | &peer->id, |
| 940 | msg))); |
| 941 | return true; |
| 942 | } |
| 943 | |
| 944 | void custommsg_completed(struct daemon *daemon, const u8 *msg) |
| 945 | { |
no test coverage detected