diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-18 21:55:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:41:01 +0100 |
commit | 5e041b56a98c49a944804420ad53e18707c9f823 (patch) | |
tree | de2bf458bb44c86bff53f0a5a73d7f1d4fdef0c2 /src/hello | |
parent | 0bd15d392c8c1c4dab56c794ec88fdbd7245cc51 (diff) | |
download | gnunet-5e041b56a98c49a944804420ad53e18707c9f823.tar.gz gnunet-5e041b56a98c49a944804420ad53e18707c9f823.zip |
-got basics to work with dhtu and udp+ip underlay
Diffstat (limited to 'src/hello')
-rw-r--r-- | src/hello/hello-uri.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/hello/hello-uri.c b/src/hello/hello-uri.c index e57d49e86..bacaf697e 100644 --- a/src/hello/hello-uri.c +++ b/src/hello/hello-uri.c | |||
@@ -605,9 +605,13 @@ GNUNET_HELLO_builder_to_dht_hello_msg ( | |||
605 | priv, | 605 | priv, |
606 | buf, | 606 | buf, |
607 | &blen)); | 607 | &blen)); |
608 | msg = GNUNET_malloc (sizeof (*msg) + blen); | 608 | msg = GNUNET_malloc (sizeof (*msg) |
609 | + blen | ||
610 | - sizeof (*block)); | ||
609 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO); | 611 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO); |
610 | msg->header.size = htons (sizeof (*msg) + blen); | 612 | msg->header.size = htons (sizeof (*msg) |
613 | + blen | ||
614 | - sizeof (*block)); | ||
611 | memcpy (&msg[1], | 615 | memcpy (&msg[1], |
612 | &block[1], | 616 | &block[1], |
613 | blen - sizeof (*block)); | 617 | blen - sizeof (*block)); |
@@ -745,6 +749,9 @@ GNUNET_HELLO_builder_add_address (struct GNUNET_HELLO_Builder *builder, | |||
745 | "://"))) | 749 | "://"))) |
746 | { | 750 | { |
747 | GNUNET_break_op (0); | 751 | GNUNET_break_op (0); |
752 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
753 | "Invalid address `%s'\n", | ||
754 | address); | ||
748 | return GNUNET_SYSERR; | 755 | return GNUNET_SYSERR; |
749 | } | 756 | } |
750 | if (e == address) | 757 | if (e == address) |
@@ -847,7 +854,7 @@ GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello, | |||
847 | } | 854 | } |
848 | if (len < sizeof (*msg)) | 855 | if (len < sizeof (*msg)) |
849 | { | 856 | { |
850 | GNUNET_break (0); | 857 | GNUNET_break_op (0); |
851 | return GNUNET_SYSERR; | 858 | return GNUNET_SYSERR; |
852 | } | 859 | } |
853 | len -= sizeof (*msg); | 860 | len -= sizeof (*msg); |
@@ -863,6 +870,13 @@ GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello, | |||
863 | len); | 870 | len); |
864 | b = GNUNET_HELLO_builder_from_block (*block, | 871 | b = GNUNET_HELLO_builder_from_block (*block, |
865 | *block_size); | 872 | *block_size); |
873 | if (NULL == b) | ||
874 | { | ||
875 | GNUNET_break_op (0); | ||
876 | GNUNET_free (*block); | ||
877 | *block_size = 0; | ||
878 | return GNUNET_SYSERR; | ||
879 | } | ||
866 | ret = verify_hello (b, | 880 | ret = verify_hello (b, |
867 | *block_expiration, | 881 | *block_expiration, |
868 | &msg->sig); | 882 | &msg->sig); |