aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-02 10:11:00 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-02 10:11:06 +0200
commita56b36e0450571d05fa8e97c9990d9bca66f43cc (patch)
tree3a9dc3c2092212515295eaa01468b86fa7cbd02c
parent22b6c43bb3508c0448f232429c86583ef09a991c (diff)
downloadgnunet-a56b36e0450571d05fa8e97c9990d9bca66f43cc.tar.gz
gnunet-a56b36e0450571d05fa8e97c9990d9bca66f43cc.zip
-fix warnings
-rw-r--r--src/dhtu/plugin_dhtu_ip.c67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c
index f80325cbc..8593a69ef 100644
--- a/src/dhtu/plugin_dhtu_ip.c
+++ b/src/dhtu/plugin_dhtu_ip.c
@@ -64,12 +64,12 @@ struct GNUNET_DHTU_Source
64 * Address in URL form ("ip+udp://$IP:$PORT") 64 * Address in URL form ("ip+udp://$IP:$PORT")
65 */ 65 */
66 char *address; 66 char *address;
67 67
68 /** 68 /**
69 * Hash of the IP address. 69 * Hash of the IP address.
70 */ 70 */
71 struct GNUNET_DHTU_Hash id; 71 struct GNUNET_DHTU_Hash id;
72 72
73 /** 73 /**
74 * My actual address. 74 * My actual address.
75 */ 75 */
@@ -79,12 +79,12 @@ struct GNUNET_DHTU_Source
79 * Number of bytes in @a addr. 79 * Number of bytes in @a addr.
80 */ 80 */
81 socklen_t addrlen; 81 socklen_t addrlen;
82 82
83 /** 83 /**
84 * Last generation this address was observed. 84 * Last generation this address was observed.
85 */ 85 */
86 unsigned int scan_generation; 86 unsigned int scan_generation;
87 87
88}; 88};
89 89
90 90
@@ -104,12 +104,12 @@ struct GNUNET_DHTU_Target
104 * Kept in a DLL. 104 * Kept in a DLL.
105 */ 105 */
106 struct GNUNET_DHTU_Target *prev; 106 struct GNUNET_DHTU_Target *prev;
107 107
108 /** 108 /**
109 * Application context for this target. 109 * Application context for this target.
110 */ 110 */
111 void *app_ctx; 111 void *app_ctx;
112 112
113 /** 113 /**
114 * Hash of the IP address. 114 * Hash of the IP address.
115 */ 115 */
@@ -124,7 +124,7 @@ struct GNUNET_DHTU_Target
124 * Tail of preferences expressed for this target. 124 * Tail of preferences expressed for this target.
125 */ 125 */
126 struct GNUNET_DHTU_PreferenceHandle *ph_tail; 126 struct GNUNET_DHTU_PreferenceHandle *ph_tail;
127 127
128 /** 128 /**
129 * Target IP address. 129 * Target IP address.
130 */ 130 */
@@ -134,7 +134,7 @@ struct GNUNET_DHTU_Target
134 * Number of bytes in @a addr. 134 * Number of bytes in @a addr.
135 */ 135 */
136 socklen_t addrlen; 136 socklen_t addrlen;
137 137
138 /** 138 /**
139 * Preference counter, length of the @a ph_head DLL. 139 * Preference counter, length of the @a ph_head DLL.
140 */ 140 */
@@ -170,7 +170,7 @@ struct GNUNET_DHTU_PreferenceHandle
170 */ 170 */
171struct Plugin 171struct Plugin
172{ 172{
173 /** 173 /**
174 * Callbacks into the DHT. 174 * Callbacks into the DHT.
175 */ 175 */
176 struct GNUNET_DHTU_PluginEnvironment *env; 176 struct GNUNET_DHTU_PluginEnvironment *env;
@@ -200,7 +200,7 @@ struct Plugin
200 * Map from hashes of sockaddrs to targets. 200 * Map from hashes of sockaddrs to targets.
201 */ 201 */
202 struct GNUNET_CONTAINER_MultiHashMap *dsts; 202 struct GNUNET_CONTAINER_MultiHashMap *dsts;
203 203
204 /** 204 /**
205 * Task that scans for IP address changes. 205 * Task that scans for IP address changes.
206 */ 206 */
@@ -212,7 +212,7 @@ struct Plugin
212 struct GNUNET_SCHEDULER_Task *read_task; 212 struct GNUNET_SCHEDULER_Task *read_task;
213 213
214 /** 214 /**
215 * Port we bind to. 215 * Port we bind to.
216 */ 216 */
217 char *port; 217 char *port;
218 218
@@ -290,7 +290,7 @@ create_target (struct Plugin *plugin,
290 GNUNET_CONTAINER_multihashmap_size (plugin->dsts)) 290 GNUNET_CONTAINER_multihashmap_size (plugin->dsts))
291 { 291 {
292 struct GNUNET_HashCode key; 292 struct GNUNET_HashCode key;
293 293
294 dst = NULL; 294 dst = NULL;
295 for (struct GNUNET_DHTU_Target *pos = plugin->dst_head; 295 for (struct GNUNET_DHTU_Target *pos = plugin->dst_head;
296 NULL != pos; 296 NULL != pos;
@@ -316,7 +316,7 @@ create_target (struct Plugin *plugin,
316 GNUNET_assert (NULL == dst->ph_head); 316 GNUNET_assert (NULL == dst->ph_head);
317 GNUNET_free (dst); 317 GNUNET_free (dst);
318 } 318 }
319 pk.size = htons (sizeof (pk)); 319 pk.size = htons (sizeof (pk));
320 dst = GNUNET_new (struct GNUNET_DHTU_Target); 320 dst = GNUNET_new (struct GNUNET_DHTU_Target);
321 dst->addrlen = addrlen; 321 dst->addrlen = addrlen;
322 memcpy (&dst->addr, 322 memcpy (&dst->addr,
@@ -391,10 +391,10 @@ find_target (struct Plugin *plugin,
391 addrlen); 391 addrlen);
392 GNUNET_assert (GNUNET_YES == 392 GNUNET_assert (GNUNET_YES ==
393 GNUNET_CONTAINER_multihashmap_put ( 393 GNUNET_CONTAINER_multihashmap_put (
394 plugin->dsts, 394 plugin->dsts,
395 &key, 395 &key,
396 dst, 396 dst,
397 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 397 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
398 } 398 }
399 else 399 else
400 { 400 {
@@ -429,7 +429,7 @@ ip_try_connect (void *cls,
429 .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV 429 .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV
430 }; 430 };
431 struct addrinfo *result = NULL; 431 struct addrinfo *result = NULL;
432 432
433 if (0 != 433 if (0 !=
434 strncmp (address, 434 strncmp (address,
435 "ip+", 435 "ip+",
@@ -481,7 +481,7 @@ ip_try_connect (void *cls,
481 * Request underlay to keep the connection to @a target alive if possible. 481 * Request underlay to keep the connection to @a target alive if possible.
482 * Hold may be called multiple times to express a strong preference to 482 * Hold may be called multiple times to express a strong preference to
483 * keep a connection, say because a @a target is in multiple tables. 483 * keep a connection, say because a @a target is in multiple tables.
484 * 484 *
485 * @param cls closure 485 * @param cls closure
486 * @param target connection to keep alive 486 * @param target connection to keep alive
487 */ 487 */
@@ -503,7 +503,7 @@ ip_hold (void *cls,
503 503
504/** 504/**
505 * Do no long request underlay to keep the connection alive. 505 * Do no long request underlay to keep the connection alive.
506 * 506 *
507 * @param cls closure 507 * @param cls closure
508 * @param target connection to keep alive 508 * @param target connection to keep alive
509 */ 509 */
@@ -511,7 +511,7 @@ static void
511ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) 511ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph)
512{ 512{
513 struct GNUNET_DHTU_Target *target = ph->target; 513 struct GNUNET_DHTU_Target *target = ph->target;
514 514
515 GNUNET_CONTAINER_DLL_remove (target->ph_head, 515 GNUNET_CONTAINER_DLL_remove (target->ph_head,
516 target->ph_tail, 516 target->ph_tail,
517 ph); 517 ph);
@@ -532,7 +532,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph)
532 * @param msg_size number of bytes in @a msg 532 * @param msg_size number of bytes in @a msg
533 * @param finished_cb function called once transmission is done 533 * @param finished_cb function called once transmission is done
534 * (not called if @a target disconnects, then only the 534 * (not called if @a target disconnects, then only the
535 * disconnect_cb is called). 535 * disconnect_cb is called).
536 * @param finished_cb_cls closure for @a finished_cb 536 * @param finished_cb_cls closure for @a finished_cb
537 */ 537 */
538static void 538static void
@@ -568,7 +568,7 @@ create_source (struct Plugin *plugin,
568 socklen_t addrlen) 568 socklen_t addrlen)
569{ 569{
570 struct GNUNET_DHTU_Source *src; 570 struct GNUNET_DHTU_Source *src;
571 571
572 src = GNUNET_new (struct GNUNET_DHTU_Source); 572 src = GNUNET_new (struct GNUNET_DHTU_Source);
573 src->addrlen = addrlen; 573 src->addrlen = addrlen;
574 memcpy (&src->addr, 574 memcpy (&src->addr,
@@ -731,7 +731,7 @@ find_source (struct Plugin *plugin,
731 (0 == memcmp (addr, 731 (0 == memcmp (addr,
732 &src->addr, 732 &src->addr,
733 addrlen)) ) 733 addrlen)) )
734 return src; 734 return src;
735 } 735 }
736 736
737 return create_source (plugin, 737 return create_source (plugin,
@@ -788,7 +788,7 @@ read_cb (void *cls)
788 cmsg->cmsg_len) 788 cmsg->cmsg_len)
789 { 789 {
790 struct in_pktinfo pi; 790 struct in_pktinfo pi;
791 791
792 memcpy (&pi, 792 memcpy (&pi,
793 CMSG_DATA (cmsg), 793 CMSG_DATA (cmsg),
794 sizeof (pi)); 794 sizeof (pi));
@@ -797,7 +797,7 @@ read_cb (void *cls)
797 .sin_family = AF_INET, 797 .sin_family = AF_INET,
798 .sin_addr = pi.ipi_addr 798 .sin_addr = pi.ipi_addr
799 }; 799 };
800 800
801 src = find_source (plugin, 801 src = find_source (plugin,
802 &sa, 802 &sa,
803 sizeof (sa)); 803 sizeof (sa));
@@ -814,7 +814,7 @@ read_cb (void *cls)
814 cmsg->cmsg_len) 814 cmsg->cmsg_len)
815 { 815 {
816 struct in6_pktinfo pi; 816 struct in6_pktinfo pi;
817 817
818 memcpy (&pi, 818 memcpy (&pi,
819 CMSG_DATA (cmsg), 819 CMSG_DATA (cmsg),
820 sizeof (pi)); 820 sizeof (pi));
@@ -824,7 +824,7 @@ read_cb (void *cls)
824 .sin6_addr = pi.ipi6_addr, 824 .sin6_addr = pi.ipi6_addr,
825 .sin6_scope_id = pi.ipi6_ifindex 825 .sin6_scope_id = pi.ipi6_ifindex
826 }; 826 };
827 827
828 src = find_source (plugin, 828 src = find_source (plugin,
829 &sa, 829 &sa,
830 sizeof (sa)); 830 sizeof (sa));
@@ -833,7 +833,7 @@ read_cb (void *cls)
833 } 833 }
834 else 834 else
835 GNUNET_break (0); 835 GNUNET_break (0);
836 } 836 }
837 } 837 }
838 dst = find_target (plugin, 838 dst = find_target (plugin,
839 &sa, 839 &sa,
@@ -932,7 +932,8 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
932 GNUNET_free (plugin); 932 GNUNET_free (plugin);
933 return NULL; 933 return NULL;
934 } 934 }
935 switch (af) { 935 switch (af)
936 {
936 case AF_INET: 937 case AF_INET:
937 { 938 {
938 int on = 1; 939 int on = 1;
@@ -956,7 +957,7 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
956 957
957 if (0 != 958 if (0 !=
958 bind (sock, 959 bind (sock,
959 &sa, 960 (const struct sockaddr *) &sa,
960 sizeof (sa))) 961 sizeof (sa)))
961 { 962 {
962 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, 963 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
@@ -989,10 +990,10 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
989 .sin6_family = AF_INET6, 990 .sin6_family = AF_INET6,
990 .sin6_port = htons ((uint16_t) nport) 991 .sin6_port = htons ((uint16_t) nport)
991 }; 992 };
992 993
993 if (0 != 994 if (0 !=
994 bind (sock, 995 bind (sock,
995 &sa, 996 (const struct sockaddr *) &sa,
996 sizeof (sa))) 997 sizeof (sa)))
997 { 998 {
998 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, 999 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,