aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-04-04 09:43:10 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-04-04 09:43:10 +0000
commitc303b97bd731aef372ec24ebe8b47ee014ada23b (patch)
treeaa287d7443434a9147cfb08fe0caa12e9c8de9e4
parented18131bd038617c03e0b3b83e3eb56c31dc3e4a (diff)
downloadgnunet-c303b97bd731aef372ec24ebe8b47ee014ada23b.tar.gz
gnunet-c303b97bd731aef372ec24ebe8b47ee014ada23b.zip
changes for mantis 0002676
-rw-r--r--src/hello/gnunet-hello.c9
-rw-r--r--src/hello/hello.c65
-rw-r--r--src/include/gnunet_hello_lib.h11
-rw-r--r--src/include/gnunet_protocols.h9
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c1
-rw-r--r--src/peerinfo/peerinfo.conf.in2
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c3
-rw-r--r--src/topology/gnunet-daemon-topology.c1
-rw-r--r--src/transport/gnunet-service-transport.c1
-rw-r--r--src/transport/gnunet-service-transport_clients.c2
-rw-r--r--src/transport/gnunet-service-transport_validation.c19
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c11
-rw-r--r--src/transport/plugin_transport_wlan.c1
-rw-r--r--src/transport/transport_api.c4
14 files changed, 55 insertions, 84 deletions
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
index b20279c1d..816a89936 100644
--- a/src/hello/gnunet-hello.c
+++ b/src/hello/gnunet-hello.c
@@ -110,7 +110,6 @@ main (int argc, char *argv[])
110 struct GNUNET_HELLO_Message *result; 110 struct GNUNET_HELLO_Message *result;
111 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk; 111 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk;
112 uint64_t fsize; 112 uint64_t fsize;
113 int friend_only;
114 113
115 GNUNET_log_setup ("gnunet-hello", "INFO", NULL); 114 GNUNET_log_setup ("gnunet-hello", "INFO", NULL);
116 if (argc != 2) 115 if (argc != 2)
@@ -168,12 +167,8 @@ main (int argc, char *argv[])
168 argv[1]); 167 argv[1]);
169 return 1; 168 return 1;
170 } 169 }
171 friend_only = GNUNET_NO; 170 result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig,
172 if (GNUNET_MESSAGE_TYPE_HELLO == GNUNET_HELLO_get_type (orig)) 171 GNUNET_HELLO_is_friend_only (orig));
173 friend_only = GNUNET_NO;
174 if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == GNUNET_HELLO_get_type (orig))
175 friend_only = GNUNET_YES;
176 result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig, friend_only);
177 GNUNET_assert (NULL != result); 172 GNUNET_assert (NULL != result);
178 fh = GNUNET_DISK_file_open (argv[1], 173 fh = GNUNET_DISK_file_open (argv[1],
179 GNUNET_DISK_OPEN_WRITE, 174 GNUNET_DISK_OPEN_WRITE,
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 382edf3d9..fc27e446b 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -52,9 +52,9 @@ struct GNUNET_HELLO_Message
52 struct GNUNET_MessageHeader header; 52 struct GNUNET_MessageHeader header;
53 53
54 /** 54 /**
55 * Always zero (for alignment). 55 * Use in F2F mode: Do not gossip this HELLO message
56 */ 56 */
57 uint32_t reserved GNUNET_PACKED; 57 uint32_t friend_only GNUNET_PACKED;
58 58
59 /** 59 /**
60 * The public key of the peer. 60 * The public key of the peer.
@@ -104,23 +104,21 @@ struct GNUNET_HELLO_ParseUriContext
104}; 104};
105 105
106 106
107/** 107/** Return HELLO type
108 * Return HELLO type
109 * 108 *
110 * @param h HELLO Message to test 109 * @param h HELLO Message to test
111 * @return GNUNET_MESSAGE_TYPE_HELLO or GNUNET_MESSAGE_TYPE_FRIEND_HELLO or 0 on error 110 * @return GNUNET_YES or GNUNET_NO
112 */ 111 */
113uint16_t 112int
114GNUNET_HELLO_get_type (const struct GNUNET_HELLO_Message *h) 113GNUNET_HELLO_is_friend_only (const struct GNUNET_HELLO_Message *h)
115{ 114{
116 if (GNUNET_MESSAGE_TYPE_HELLO == ntohs(h->header.type)) 115 if (GNUNET_YES == ntohl(h->friend_only))
117 return GNUNET_MESSAGE_TYPE_HELLO; 116 return GNUNET_YES;
118 if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == ntohs(h->header.type)) 117 return GNUNET_NO;
119 return GNUNET_MESSAGE_TYPE_FRIEND_HELLO;
120 return 0;
121} 118}
122 119
123 120
121
124/** 122/**
125 * Copy the given address information into 123 * Copy the given address information into
126 * the given buffer using the format of HELLOs. 124 * the given buffer using the format of HELLOs.
@@ -231,6 +229,9 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
231 size_t ret; 229 size_t ret;
232 struct GNUNET_HELLO_Message *hello; 230 struct GNUNET_HELLO_Message *hello;
233 231
232 GNUNET_assert (NULL != publicKey);
233 GNUNET_assert ((GNUNET_YES == friend_only) || (GNUNET_NO == friend_only));
234
234 max = sizeof (buffer); 235 max = sizeof (buffer);
235 used = 0; 236 used = 0;
236 if (addrgen != NULL) 237 if (addrgen != NULL)
@@ -242,11 +243,10 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
242 } 243 }
243 } 244 }
244 hello = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Message) + used); 245 hello = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Message) + used);
245 if (GNUNET_NO == friend_only) 246 hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO);
246 hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO);
247 else
248 hello->header.type = htons (GNUNET_MESSAGE_TYPE_FRIEND_HELLO);
249 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used); 247 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
248 hello->friend_only = htonl (friend_only);
249
250 memcpy (&hello->publicKey, publicKey, 250 memcpy (&hello->publicKey, publicKey,
251 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)); 251 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
252 memcpy (&hello[1], buffer, used); 252 memcpy (&hello[1], buffer, used);
@@ -282,8 +282,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
282 282
283 msize = GNUNET_HELLO_size (msg); 283 msize = GNUNET_HELLO_size (msg);
284 if ((msize < sizeof (struct GNUNET_HELLO_Message)) || 284 if ((msize < sizeof (struct GNUNET_HELLO_Message)) ||
285 ((ntohs (msg->header.type) != GNUNET_MESSAGE_TYPE_HELLO) && 285 (ntohs (msg->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
286 (ntohs (msg->header.type) != GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
287 return NULL; 286 return NULL;
288 ret = NULL; 287 ret = NULL;
289 if (return_modified) 288 if (return_modified)
@@ -431,21 +430,11 @@ GNUNET_HELLO_merge (const struct GNUNET_HELLO_Message *h1,
431{ 430{
432 struct MergeContext mc = { h1, h2, NULL, NULL, 0, 0, 0 }; 431 struct MergeContext mc = { h1, h2, NULL, NULL, 0, 0, 0 };
433 int friend_only; 432 int friend_only;
434 if (h1->header.type != h2->header.type) 433
435 { 434 if (h1->friend_only != h2->friend_only)
436 /* Trying to merge different HELLO types */ 435 friend_only = GNUNET_YES; /* One of the HELLOs is friend only */
437 GNUNET_break (0);
438 return NULL;
439 }
440 if (GNUNET_MESSAGE_TYPE_HELLO == (ntohs(h1->header.type)))
441 friend_only = GNUNET_NO;
442 else if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == (ntohs(h1->header.type)))
443 friend_only = GNUNET_YES;
444 else 436 else
445 { 437 friend_only = ntohl (h1->friend_only); /* Both HELLO's have the same type */
446 GNUNET_break (0);
447 return NULL;
448 }
449 438
450 return GNUNET_HELLO_create (&h1->publicKey, &merge_addr, &mc, friend_only); 439 return GNUNET_HELLO_create (&h1->publicKey, &merge_addr, &mc, friend_only);
451} 440}
@@ -526,8 +515,7 @@ GNUNET_HELLO_size (const struct GNUNET_HELLO_Message *hello)
526 uint16_t ret = ntohs (hello->header.size); 515 uint16_t ret = ntohs (hello->header.size);
527 516
528 if ((ret < sizeof (struct GNUNET_HELLO_Message)) || 517 if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
529 ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) && 518 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
530 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
531 return 0; 519 return 0;
532 return ret; 520 return ret;
533} 521}
@@ -547,8 +535,7 @@ GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
547 uint16_t ret = ntohs (hello->header.size); 535 uint16_t ret = ntohs (hello->header.size);
548 536
549 if ((ret < sizeof (struct GNUNET_HELLO_Message)) || 537 if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
550 ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) && 538 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
551 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
552 return GNUNET_SYSERR; 539 return GNUNET_SYSERR;
553 *publicKey = hello->publicKey; 540 *publicKey = hello->publicKey;
554 return GNUNET_OK; 541 return GNUNET_OK;
@@ -569,8 +556,7 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello,
569 uint16_t ret = ntohs (hello->header.size); 556 uint16_t ret = ntohs (hello->header.size);
570 557
571 if ((ret < sizeof (struct GNUNET_HELLO_Message)) || 558 if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
572 ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) && 559 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
573 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
574 return GNUNET_SYSERR; 560 return GNUNET_SYSERR;
575 GNUNET_CRYPTO_hash (&hello->publicKey, 561 GNUNET_CRYPTO_hash (&hello->publicKey,
576 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), 562 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
@@ -593,8 +579,7 @@ GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello)
593 uint16_t ret = ntohs (hello->header.size); 579 uint16_t ret = ntohs (hello->header.size);
594 580
595 if ((ret < sizeof (struct GNUNET_HELLO_Message)) || 581 if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
596 ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) && 582 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
597 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
598 return NULL; 583 return NULL;
599 584
600 return &hello->header; 585 return &hello->header;
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index d62638c14..b60353ee7 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -145,14 +145,15 @@ GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address);
145 */ 145 */
146struct GNUNET_HELLO_Message; 146struct GNUNET_HELLO_Message;
147 147
148/** 148
149 * Return HELLO type 149/** Return HELLO type
150 * 150 *
151 * @param h HELLO Message to test 151 * @param h HELLO Message to test
152 * @param GNUNET_MESSAGE_TYPE_HELLO or GNUNET_MESSAGE_TYPE_FRIEND_HELLO or 0 on error 152 * @return GNUNET_YES or GNUNET_NO
153 */ 153 */
154uint16_t 154int
155GNUNET_HELLO_get_type (const struct GNUNET_HELLO_Message *h); 155GNUNET_HELLO_is_friend_only (const struct GNUNET_HELLO_Message *h);
156
156 157
157/** 158/**
158 * Copy the given address information into 159 * Copy the given address information into
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index a012a7c53..7179914af 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -107,16 +107,17 @@ extern "C"
107 ******************************************************************************/ 107 ******************************************************************************/
108 108
109/** 109/**
110 * HELLO message used for communicating peer addresses. 110 * Previously used for HELLO messages used for communicating peer addresses.
111 * Managed by libgnunethello. 111 * Managed by libgnunethello.
112 */ 112 */
113#define GNUNET_MESSAGE_TYPE_HELLO 16 113#define GNUNET_MESSAGE_TYPE_HELLO_LEGACY 16
114 114
115/** 115/**
116 * HELLO message used for communicating peer addresses with friends only. 116 * HELLO message with friend only flag used for communicating peer addresses.
117 * Managed by libgnunethello.
117 */ 118 */
118 119
119#define GNUNET_MESSAGE_TYPE_FRIEND_HELLO 17 120#define GNUNET_MESSAGE_TYPE_HELLO 17
120 121
121/******************************************************************************* 122/*******************************************************************************
122 * FRAGMENTATION message types 123 * FRAGMENTATION message types
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index f7a4b5536..68024a90a 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -769,7 +769,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
769 const struct GNUNET_CONFIGURATION_Handle *cfg) 769 const struct GNUNET_CONFIGURATION_Handle *cfg)
770{ 770{
771 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 771 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
772 {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_FRIEND_HELLO, 0},
773 {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_HELLO, 0}, 772 {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_HELLO, 0},
774 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET, 773 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET,
775 sizeof (struct ListPeerMessage)}, 774 sizeof (struct ListPeerMessage)},
diff --git a/src/peerinfo/peerinfo.conf.in b/src/peerinfo/peerinfo.conf.in
index 1420da844..23c8ec30a 100644
--- a/src/peerinfo/peerinfo.conf.in
+++ b/src/peerinfo/peerinfo.conf.in
@@ -18,7 +18,7 @@ UNIX_MATCH_GID = YES
18# REJECT_FROM = 18# REJECT_FROM =
19# REJECT_FROM6 = 19# REJECT_FROM6 =
20# PREFIX = 20# PREFIX =
21HOSTS = $SERVICEHOME/data/hosts/ 21HOSTS = $SERVICEHOME/peerinfo/
22 22
23# Option to disable all disk IO; only useful for testbed runs 23# Option to disable all disk IO; only useful for testbed runs
24# (large-scale experiments); disables persistence of HELLOs! 24# (large-scale experiments); disables persistence of HELLOs!
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index bc4ab31c7..7fdf14586 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -1514,8 +1514,7 @@ GST_handle_remote_overlay_connect (void *cls,
1514 } 1514 }
1515 msg = (const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *) message; 1515 msg = (const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *) message;
1516 if ((NULL == msg->hello) || 1516 if ((NULL == msg->hello) ||
1517 ((GNUNET_MESSAGE_TYPE_HELLO != ntohs (msg->hello->type)) && 1517 ((GNUNET_MESSAGE_TYPE_HELLO != ntohs (msg->hello->type))))
1518 (GNUNET_MESSAGE_TYPE_FRIEND_HELLO != ntohs (msg->hello->type))))
1519 { 1518 {
1520 GNUNET_break (0); 1519 GNUNET_break (0);
1521 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1520 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index cb43ee261..c36108823 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -1274,7 +1274,6 @@ run (void *cls, char *const *args, const char *cfgfile,
1274{ 1274{
1275 static struct GNUNET_CORE_MessageHandler handlers[] = { 1275 static struct GNUNET_CORE_MessageHandler handlers[] = {
1276 {&handle_encrypted_hello, GNUNET_MESSAGE_TYPE_HELLO, 0}, 1276 {&handle_encrypted_hello, GNUNET_MESSAGE_TYPE_HELLO, 0},
1277 {&handle_encrypted_hello, GNUNET_MESSAGE_TYPE_FRIEND_HELLO, 0},
1278 {NULL, 0, 0} 1277 {NULL, 0, 0}
1279 }; 1278 };
1280 unsigned long long opt; 1279 unsigned long long opt;
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 63b2ced88..e0d3b3b23 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -242,7 +242,6 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
242 switch (type) 242 switch (type)
243 { 243 {
244 case GNUNET_MESSAGE_TYPE_HELLO: 244 case GNUNET_MESSAGE_TYPE_HELLO:
245 case GNUNET_MESSAGE_TYPE_FRIEND_HELLO:
246 GST_validation_handle_hello (message); 245 GST_validation_handle_hello (message);
247 return ret; 246 return ret;
248 case GNUNET_MESSAGE_TYPE_TRANSPORT_PING: 247 case GNUNET_MESSAGE_TYPE_TRANSPORT_PING:
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index be05e027a..db2718f4e 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -978,8 +978,6 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server)
978 GNUNET_MESSAGE_TYPE_TRANSPORT_START, sizeof (struct StartMessage)}, 978 GNUNET_MESSAGE_TYPE_TRANSPORT_START, sizeof (struct StartMessage)},
979 {&clients_handle_hello, NULL, 979 {&clients_handle_hello, NULL,
980 GNUNET_MESSAGE_TYPE_HELLO, 0}, 980 GNUNET_MESSAGE_TYPE_HELLO, 0},
981 {&clients_handle_hello, NULL,
982 GNUNET_MESSAGE_TYPE_FRIEND_HELLO, 0},
983 {&clients_handle_send, NULL, 981 {&clients_handle_send, NULL,
984 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0}, 982 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0},
985 {&clients_handle_request_connect, NULL, 983 {&clients_handle_request_connect, NULL,
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index dbe5adf4f..a6c0b7f9d 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -1283,11 +1283,11 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
1283 (const struct GNUNET_HELLO_Message *) hello; 1283 (const struct GNUNET_HELLO_Message *) hello;
1284 struct ValidateAddressContext vac; 1284 struct ValidateAddressContext vac;
1285 struct GNUNET_HELLO_Message *h; 1285 struct GNUNET_HELLO_Message *h;
1286 int type;
1287 int friend; 1286 int friend;
1288 1287
1289 1288 friend = GNUNET_HELLO_is_friend_only (hm);
1290 if ((GNUNET_OK != GNUNET_HELLO_get_id (hm, &vac.pid)) || 1289 if (((GNUNET_YES != friend) && (GNUNET_NO != friend)) ||
1290 (GNUNET_OK != GNUNET_HELLO_get_id (hm, &vac.pid)) ||
1291 (GNUNET_OK != GNUNET_HELLO_get_key (hm, &vac.public_key))) 1291 (GNUNET_OK != GNUNET_HELLO_get_key (hm, &vac.public_key)))
1292 { 1292 {
1293 /* malformed HELLO */ 1293 /* malformed HELLO */
@@ -1298,19 +1298,6 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
1298 memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity))) 1298 memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity)))
1299 return; 1299 return;
1300 /* Add peer identity without addresses to peerinfo service */ 1300 /* Add peer identity without addresses to peerinfo service */
1301 type = ntohs(hello->type);
1302 switch (type) {
1303 case GNUNET_MESSAGE_TYPE_HELLO:
1304 friend = GNUNET_NO;
1305 break;
1306 case GNUNET_MESSAGE_TYPE_FRIEND_HELLO:
1307 friend = GNUNET_YES;
1308 break;
1309 default:
1310 GNUNET_break (0);
1311 friend = GNUNET_NO;
1312 break;
1313 }
1314 h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL, friend); 1301 h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL, friend);
1315 GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL); 1302 GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL);
1316 1303
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index e8e087276..a2278f293 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -394,6 +394,17 @@ iface_proc (void *cls, const char *name, int isDefault,
394void 394void
395setup_broadcast (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct sockaddr_in *serverAddrv4) 395setup_broadcast (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct sockaddr_in *serverAddrv4)
396{ 396{
397 const struct GNUNET_MessageHeader *hello;
398 hello = plugin->env->get_our_hello ();
399
400 if (GNUNET_YES == GNUNET_HELLO_is_friend_only((const struct GNUNET_HELLO_Message *) hello))
401 {
402 LOG (GNUNET_ERROR_TYPE_WARNING,
403 _("Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"));
404 return;
405 }
406
407
397 /* create IPv4 broadcast socket */ 408 /* create IPv4 broadcast socket */
398 plugin->broadcast_ipv4 = GNUNET_NO; 409 plugin->broadcast_ipv4 = GNUNET_NO;
399 if (plugin->sockv4 != NULL) 410 if (plugin->sockv4 != NULL)
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index eb635615f..9e2a0ff77 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1149,7 +1149,6 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1149 1149
1150 switch (ntohs (hdr->type)) 1150 switch (ntohs (hdr->type))
1151 { 1151 {
1152 case GNUNET_MESSAGE_TYPE_FRIEND_HELLO:
1153 case GNUNET_MESSAGE_TYPE_HELLO: 1152 case GNUNET_MESSAGE_TYPE_HELLO:
1154 if (GNUNET_OK != 1153 if (GNUNET_OK !=
1155 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) 1154 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource))
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index d8fb7d520..8dc4c7a42 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -497,7 +497,6 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
497 switch (ntohs (msg->type)) 497 switch (ntohs (msg->type))
498 { 498 {
499 case GNUNET_MESSAGE_TYPE_HELLO: 499 case GNUNET_MESSAGE_TYPE_HELLO:
500 case GNUNET_MESSAGE_TYPE_FRIEND_HELLO:
501 if (GNUNET_OK != 500 if (GNUNET_OK !=
502 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) msg, &me)) 501 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) msg, &me))
503 { 502 {
@@ -1293,8 +1292,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
1293 if (NULL == handle->client) 1292 if (NULL == handle->client)
1294 return NULL; 1293 return NULL;
1295 1294
1296 GNUNET_break ((ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO) || 1295 GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO);
1297 (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_FRIEND_HELLO));
1298 size = ntohs (hello->size); 1296 size = ntohs (hello->size);
1299 GNUNET_break (size >= sizeof (struct GNUNET_MessageHeader)); 1297 GNUNET_break (size >= sizeof (struct GNUNET_MessageHeader));
1300 if (GNUNET_OK != 1298 if (GNUNET_OK !=