aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-17 22:20:18 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-17 22:20:18 +0000
commit81b92caa24a83620032438df9c5ee3ea51663a02 (patch)
tree2b2df659c94e1ead5bbdb5082e50018c39e68796 /src/transport
parent4756cb0779daf3e4c33b6e876dce956de7ee6dd8 (diff)
downloadgnunet-81b92caa24a83620032438df9c5ee3ea51663a02.tar.gz
gnunet-81b92caa24a83620032438df9c5ee3ea51663a02.zip
simplify ATS API and plugin API by returning the network type, instead of an ATS_Information struct
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport.c27
-rw-r--r--src/transport/plugin_transport_http_client.c23
-rw-r--r--src/transport/plugin_transport_http_server.c18
-rw-r--r--src/transport/plugin_transport_tcp.c14
-rw-r--r--src/transport/plugin_transport_udp.c20
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c29
-rw-r--r--src/transport/plugin_transport_unix.c5
7 files changed, 72 insertions, 64 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 03fbc95db..2d2c0db46 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -633,36 +633,33 @@ plugin_env_session_end (void *cls, const struct GNUNET_HELLO_Address *address,
633 * 633 *
634 * @param cls closure 634 * @param cls closure
635 * @param addr binary address 635 * @param addr binary address
636 * @param addrlen length of the address 636 * @param addrlen length of the @a addr
637 * @return ATS Information containing the network type 637 * @return type of the network @a addr belongs to
638 */ 638 */
639static struct GNUNET_ATS_Information 639static enum GNUNET_ATS_Network_Type
640plugin_env_address_to_type (void *cls, const struct sockaddr *addr, 640plugin_env_address_to_type (void *cls,
641 size_t addrlen) 641 const struct sockaddr *addr,
642 size_t addrlen)
642{ 643{
643 struct GNUNET_ATS_Information ats;
644
645 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
646 ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED);
647 if (NULL == GST_ats) 644 if (NULL == GST_ats)
648 { 645 {
649 GNUNET_break(0); 646 GNUNET_break(0);
650 return ats; 647 return GNUNET_ATS_NET_UNSPECIFIED;
651 } 648 }
652 if (((addr->sa_family != AF_INET) && (addrlen != sizeof(struct sockaddr_in))) 649 if (((addr->sa_family != AF_INET) && (addrlen != sizeof(struct sockaddr_in)))
653 && ((addr->sa_family != AF_INET6) 650 && ((addr->sa_family != AF_INET6)
654 && (addrlen != sizeof(struct sockaddr_in6))) 651 && (addrlen != sizeof(struct sockaddr_in6)))
655 && (addr->sa_family != AF_UNIX)) 652 && (addr->sa_family != AF_UNIX))
656 { 653 {
657 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
658 "Malformed address with length %u `%s'\n", addrlen,
659 GNUNET_a2s (addr, addrlen));
660 GNUNET_break(0); 654 GNUNET_break(0);
661 return ats; 655 return GNUNET_ATS_NET_UNSPECIFIED;
662 } 656 }
663 return GNUNET_ATS_address_get_type (GST_ats, addr, addrlen); 657 return GNUNET_ATS_address_get_type (GST_ats,
658 addr,
659 addrlen);
664} 660}
665 661
662
666/** 663/**
667 * Notify ATS about the new address including the network this address is 664 * Notify ATS about the new address including the network this address is
668 * located in. 665 * located in.
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index cc1f39e9a..9c9af57ad 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -262,9 +262,9 @@ struct Session
262 unsigned int msgs_in_queue; 262 unsigned int msgs_in_queue;
263 263
264 /** 264 /**
265 * ATS network type in NBO 265 * ATS network type.
266 */ 266 */
267 uint32_t ats_address_network_type; 267 enum GNUNET_ATS_Network_Type ats_address_network_type;
268}; 268};
269 269
270 270
@@ -1173,9 +1173,9 @@ client_receive_mst_cb (void *cls,
1173 char *stat_txt; 1173 char *stat_txt;
1174 1174
1175 plugin = s->plugin; 1175 plugin = s->plugin;
1176 GNUNET_break (s->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
1176 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE); 1177 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1177 atsi.value = s->ats_address_network_type; 1178 atsi.value = htonl (s->ats_address_network_type);
1178 GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED));
1179 1179
1180 delay = s->plugin->env->receive (plugin->env->cls, 1180 delay = s->plugin->env->receive (plugin->env->cls,
1181 s->address, 1181 s->address,
@@ -1941,7 +1941,7 @@ static enum GNUNET_ATS_Network_Type
1941http_client_plugin_get_network (void *cls, 1941http_client_plugin_get_network (void *cls,
1942 struct Session *session) 1942 struct Session *session)
1943{ 1943{
1944 return ntohl (session->ats_address_network_type); 1944 return session->ats_address_network_type;
1945} 1945}
1946 1946
1947 1947
@@ -1998,7 +1998,7 @@ http_client_plugin_get_session (void *cls,
1998 struct HTTP_Client_Plugin *plugin = cls; 1998 struct HTTP_Client_Plugin *plugin = cls;
1999 struct Session *s; 1999 struct Session *s;
2000 struct sockaddr *sa; 2000 struct sockaddr *sa;
2001 struct GNUNET_ATS_Information ats; 2001 enum GNUNET_ATS_Network_Type net_type;
2002 size_t salen = 0; 2002 size_t salen = 0;
2003 int res; 2003 int res;
2004 2004
@@ -2021,8 +2021,7 @@ http_client_plugin_get_session (void *cls,
2021 } 2021 }
2022 2022
2023 /* Determine network location */ 2023 /* Determine network location */
2024 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); 2024 net_type = GNUNET_ATS_NET_UNSPECIFIED;
2025 ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED);
2026 sa = http_common_socket_from_address (address->address, 2025 sa = http_common_socket_from_address (address->address,
2027 address->address_length, 2026 address->address_length,
2028 &res); 2027 &res);
@@ -2039,15 +2038,15 @@ http_client_plugin_get_session (void *cls,
2039 { 2038 {
2040 salen = sizeof (struct sockaddr_in6); 2039 salen = sizeof (struct sockaddr_in6);
2041 } 2040 }
2042 ats = plugin->env->get_address_type (plugin->env->cls, sa, salen); 2041 net_type = plugin->env->get_address_type (plugin->env->cls, sa, salen);
2043 GNUNET_free (sa); 2042 GNUNET_free (sa);
2044 } 2043 }
2045 else if (GNUNET_NO == res) 2044 else if (GNUNET_NO == res)
2046 { 2045 {
2047 /* Cannot convert to sockaddr -> is external hostname */ 2046 /* Cannot convert to sockaddr -> is external hostname */
2048 ats.value = htonl (GNUNET_ATS_NET_WAN); 2047 net_type = GNUNET_ATS_NET_WAN;
2049 } 2048 }
2050 if (GNUNET_ATS_NET_UNSPECIFIED == ntohl (ats.value)) 2049 if (GNUNET_ATS_NET_UNSPECIFIED == net_type)
2051 { 2050 {
2052 GNUNET_break (0); 2051 GNUNET_break (0);
2053 return NULL; 2052 return NULL;
@@ -2056,7 +2055,7 @@ http_client_plugin_get_session (void *cls,
2056 s = GNUNET_new (struct Session); 2055 s = GNUNET_new (struct Session);
2057 s->plugin = plugin; 2056 s->plugin = plugin;
2058 s->address = GNUNET_HELLO_address_copy (address); 2057 s->address = GNUNET_HELLO_address_copy (address);
2059 s->ats_address_network_type = ats.value; 2058 s->ats_address_network_type = net_type;
2060 2059
2061 s->put.state = H_NOT_CONNECTED; 2060 s->put.state = H_NOT_CONNECTED;
2062 s->timeout = GNUNET_TIME_relative_to_absolute (HTTP_CLIENT_SESSION_TIMEOUT); 2061 s->timeout = GNUNET_TIME_relative_to_absolute (HTTP_CLIENT_SESSION_TIMEOUT);
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index aaa17b2cf..c7c145328 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -1423,23 +1423,25 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1423 conn_info->client_addr, 1423 conn_info->client_addr,
1424 sizeof (struct sockaddr_in)); 1424 sizeof (struct sockaddr_in));
1425 addr_len = http_common_address_get_size (addr); 1425 addr_len = http_common_address_get_size (addr);
1426 ats = plugin->env->get_address_type (plugin->env->cls, 1426 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1427 conn_info->client_addr, 1427 ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1428 sizeof (struct sockaddr_in)); 1428 conn_info->client_addr,
1429 sizeof (struct sockaddr_in)));
1429 break; 1430 break;
1430 case (AF_INET6): 1431 case (AF_INET6):
1431 addr = http_common_address_from_socket (plugin->protocol, 1432 addr = http_common_address_from_socket (plugin->protocol,
1432 conn_info->client_addr, 1433 conn_info->client_addr,
1433 sizeof (struct sockaddr_in6)); 1434 sizeof (struct sockaddr_in6));
1434 addr_len = http_common_address_get_size (addr); 1435 addr_len = http_common_address_get_size (addr);
1435 ats = plugin->env->get_address_type (plugin->env->cls, 1436 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1436 conn_info->client_addr, 1437 ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1437 sizeof (struct sockaddr_in6)); 1438 conn_info->client_addr,
1439 sizeof (struct sockaddr_in6)));
1438 break; 1440 break;
1439 default: 1441 default:
1440 /* external host name */ 1442 /* external host name */
1441 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); 1443 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1442 ats.type = htonl (GNUNET_ATS_NET_WAN); 1444 ats.value = htonl (GNUNET_ATS_NET_WAN);
1443 return NULL; 1445 return NULL;
1444 } 1446 }
1445 s = GNUNET_new (struct Session); 1447 s = GNUNET_new (struct Session);
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 4f7b57641..01a4eade8 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1521,7 +1521,7 @@ tcp_plugin_get_session (void *cls,
1521 const struct IPv4TcpAddress *t4; 1521 const struct IPv4TcpAddress *t4;
1522 const struct IPv6TcpAddress *t6; 1522 const struct IPv6TcpAddress *t6;
1523 unsigned int options; 1523 unsigned int options;
1524 struct GNUNET_ATS_Information ats; 1524 enum GNUNET_ATS_Network_Type net_type;
1525 unsigned int is_natd = GNUNET_NO; 1525 unsigned int is_natd = GNUNET_NO;
1526 size_t addrlen; 1526 size_t addrlen;
1527#ifdef TCP_STEALTH 1527#ifdef TCP_STEALTH
@@ -1612,7 +1612,8 @@ tcp_plugin_get_session (void *cls,
1612 return NULL; 1612 return NULL;
1613 } 1613 }
1614 1614
1615 ats = plugin->env->get_address_type (plugin->env->cls, sb, sbs); 1615 net_type = plugin->env->get_address_type (plugin->env->cls, sb, sbs);
1616
1616 1617
1617 if ((is_natd == GNUNET_YES) && (addrlen == sizeof(struct IPv6TcpAddress))) 1618 if ((is_natd == GNUNET_YES) && (addrlen == sizeof(struct IPv6TcpAddress)))
1618 { 1619 {
@@ -1645,7 +1646,7 @@ tcp_plugin_get_session (void *cls,
1645 address, 1646 address,
1646 NULL, 1647 NULL,
1647 GNUNET_YES); 1648 GNUNET_YES);
1648 session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value); 1649 session->ats_address_network_type = net_type;
1649 GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED); 1650 GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
1650 session->nat_connection_timeout = GNUNET_SCHEDULER_add_delayed (NAT_TIMEOUT, 1651 session->nat_connection_timeout = GNUNET_SCHEDULER_add_delayed (NAT_TIMEOUT,
1651 &nat_connect_timeout, 1652 &nat_connect_timeout,
@@ -1742,7 +1743,7 @@ tcp_plugin_get_session (void *cls,
1742 address, 1743 address,
1743 GNUNET_SERVER_connect_socket (plugin->server, sa), 1744 GNUNET_SERVER_connect_socket (plugin->server, sa),
1744 GNUNET_NO); 1745 GNUNET_NO);
1745 session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value); 1746 session->ats_address_network_type = net_type;
1746 GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED); 1747 GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
1747 GNUNET_SERVER_client_set_user_context(session->client, session); 1748 GNUNET_SERVER_client_set_user_context(session->client, session);
1748 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, 1749 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
@@ -2333,8 +2334,9 @@ handle_tcp_welcome (void *cls,
2333 } 2334 }
2334 session = create_session (plugin, address, client, GNUNET_NO); 2335 session = create_session (plugin, address, client, GNUNET_NO);
2335 GNUNET_HELLO_address_free (address); 2336 GNUNET_HELLO_address_free (address);
2336 ats = plugin->env->get_address_type (plugin->env->cls, vaddr, alen); 2337 session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen);
2337 session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value); 2338 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
2339 ats.value = htonl (session->ats_address_network_type);
2338 LOG(GNUNET_ERROR_TYPE_DEBUG, 2340 LOG(GNUNET_ERROR_TYPE_DEBUG,
2339 "Creating new%s session %p for peer `%s' client %p \n", 2341 "Creating new%s session %p for peer `%s' client %p \n",
2340 GNUNET_HELLO_address_check_option (session->address, 2342 GNUNET_HELLO_address_check_option (session->address,
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 48535f28b..76c9dfdec 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1799,6 +1799,7 @@ udp_plugin_create_session (void *cls,
1799 if (sizeof (struct IPv4UdpAddress) == address->address_length) 1799 if (sizeof (struct IPv4UdpAddress) == address->address_length)
1800 { 1800 {
1801 struct sockaddr_in v4; 1801 struct sockaddr_in v4;
1802
1802 udp_v4 = (struct IPv4UdpAddress *) address->address; 1803 udp_v4 = (struct IPv4UdpAddress *) address->address;
1803 memset (&v4, '\0', sizeof (v4)); 1804 memset (&v4, '\0', sizeof (v4));
1804 v4.sin_family = AF_INET; 1805 v4.sin_family = AF_INET;
@@ -1807,9 +1808,10 @@ udp_plugin_create_session (void *cls,
1807#endif 1808#endif
1808 v4.sin_port = udp_v4->u4_port; 1809 v4.sin_port = udp_v4->u4_port;
1809 v4.sin_addr.s_addr = udp_v4->ipv4_addr; 1810 v4.sin_addr.s_addr = udp_v4->ipv4_addr;
1810 s->ats = plugin->env->get_address_type (plugin->env->cls, 1811 s->ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1811 (const struct sockaddr *) &v4, 1812 s->ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1812 sizeof (v4)); 1813 (const struct sockaddr *) &v4,
1814 sizeof (v4)));
1813 } 1815 }
1814 else if (sizeof (struct IPv6UdpAddress) == address->address_length) 1816 else if (sizeof (struct IPv6UdpAddress) == address->address_length)
1815 { 1817 {
@@ -1822,8 +1824,10 @@ udp_plugin_create_session (void *cls,
1822#endif 1824#endif
1823 v6.sin6_port = udp_v6->u6_port; 1825 v6.sin6_port = udp_v6->u6_port;
1824 v6.sin6_addr = udp_v6->ipv6_addr; 1826 v6.sin6_addr = udp_v6->ipv6_addr;
1825 s->ats = plugin->env->get_address_type (plugin->env->cls, 1827 s->ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1826 (const struct sockaddr *) &v6, sizeof (v6)); 1828 s->ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1829 (const struct sockaddr *) &v6,
1830 sizeof (v6)));
1827 } 1831 }
1828 1832
1829 if (NULL == s) 1833 if (NULL == s)
@@ -2871,11 +2875,11 @@ analyze_send_error (struct Plugin *plugin,
2871 const struct sockaddr *sa, 2875 const struct sockaddr *sa,
2872 socklen_t slen, int error) 2876 socklen_t slen, int error)
2873{ 2877{
2874 struct GNUNET_ATS_Information type; 2878 enum GNUNET_ATS_Network_Type type;
2875 2879
2876 type = plugin->env->get_address_type (plugin->env->cls, sa, slen); 2880 type = plugin->env->get_address_type (plugin->env->cls, sa, slen);
2877 if (((GNUNET_ATS_NET_LAN == ntohl (type.value)) 2881 if (((GNUNET_ATS_NET_LAN == type)
2878 || (GNUNET_ATS_NET_WAN == ntohl (type.value))) 2882 || (GNUNET_ATS_NET_WAN == type))
2879 && ((ENETUNREACH == errno)|| (ENETDOWN == errno))) 2883 && ((ENETUNREACH == errno)|| (ENETDOWN == errno)))
2880 { 2884 {
2881 if (slen == sizeof (struct sockaddr_in)) 2885 if (slen == sizeof (struct sockaddr_in))
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index 6566245cd..3ef9ecaaf 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -111,21 +111,24 @@ struct Mstv4Context
111 struct Plugin *plugin; 111 struct Plugin *plugin;
112 112
113 struct IPv4UdpAddress addr; 113 struct IPv4UdpAddress addr;
114
114 /** 115 /**
115 * ATS network type in NBO 116 * ATS network type.
116 */ 117 */
117 uint32_t ats_address_network_type; 118 enum GNUNET_ATS_Network_Type ats_address_network_type;
118}; 119};
119 120
121
120struct Mstv6Context 122struct Mstv6Context
121{ 123{
122 struct Plugin *plugin; 124 struct Plugin *plugin;
123 125
124 struct IPv6UdpAddress addr; 126 struct IPv6UdpAddress addr;
127
125 /** 128 /**
126 * ATS network type in NBO 129 * ATS network type.
127 */ 130 */
128 uint32_t ats_address_network_type; 131 enum GNUNET_ATS_Network_Type ats_address_network_type;
129}; 132};
130 133
131 134
@@ -152,7 +155,7 @@ broadcast_ipv6_mst_cb (void *cls, void *client,
152 155
153 /* setup ATS */ 156 /* setup ATS */
154 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE); 157 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
155 atsi.value = mc->ats_address_network_type; 158 atsi.value = htonl (mc->ats_address_network_type);
156 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); 159 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
157 160
158 hello = (struct GNUNET_MessageHeader *) &msg[1]; 161 hello = (struct GNUNET_MessageHeader *) &msg[1];
@@ -195,7 +198,7 @@ broadcast_ipv4_mst_cb (void *cls, void *client,
195 198
196 /* setup ATS */ 199 /* setup ATS */
197 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE); 200 atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
198 atsi.value = mc->ats_address_network_type; 201 atsi.value = htonl (mc->ats_address_network_type);
199 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); 202 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
200 203
201 hello = (struct GNUNET_MessageHeader *) &msg[1]; 204 hello = (struct GNUNET_MessageHeader *) &msg[1];
@@ -221,8 +224,6 @@ udp_broadcast_receive (struct Plugin *plugin,
221 const struct sockaddr *addr, 224 const struct sockaddr *addr,
222 size_t addrlen) 225 size_t addrlen)
223{ 226{
224 struct GNUNET_ATS_Information ats;
225
226 if (addrlen == sizeof (struct sockaddr_in)) 227 if (addrlen == sizeof (struct sockaddr_in))
227 { 228 {
228 LOG (GNUNET_ERROR_TYPE_DEBUG, 229 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -235,8 +236,9 @@ udp_broadcast_receive (struct Plugin *plugin,
235 236
236 mc->addr.ipv4_addr = av4->sin_addr.s_addr; 237 mc->addr.ipv4_addr = av4->sin_addr.s_addr;
237 mc->addr.u4_port = av4->sin_port; 238 mc->addr.u4_port = av4->sin_port;
238 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen); 239 mc->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls,
239 mc->ats_address_network_type = ats.value; 240 (const struct sockaddr *) addr,
241 addrlen);
240 242
241 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst); 243 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst);
242 if (GNUNET_OK != 244 if (GNUNET_OK !=
@@ -256,8 +258,7 @@ udp_broadcast_receive (struct Plugin *plugin,
256 258
257 mc->addr.ipv6_addr = av6->sin6_addr; 259 mc->addr.ipv6_addr = av6->sin6_addr;
258 mc->addr.u6_port = av6->sin6_port; 260 mc->addr.u6_port = av6->sin6_port;
259 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen); 261 mc->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen);
260 mc->ats_address_network_type = ats.value;
261 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst); 262 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst);
262 if (GNUNET_OK != 263 if (GNUNET_OK !=
263 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, size, 264 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, size,
@@ -473,7 +474,7 @@ iface_proc (void *cls,
473{ 474{
474 struct Plugin *plugin = cls; 475 struct Plugin *plugin = cls;
475 struct BroadcastAddress *ba; 476 struct BroadcastAddress *ba;
476 struct GNUNET_ATS_Information network; 477 enum GNUNET_ATS_Network_Type network;
477 478
478 if (NULL == addr) 479 if (NULL == addr)
479 return GNUNET_OK; 480 return GNUNET_OK;
@@ -489,7 +490,7 @@ iface_proc (void *cls,
489 GNUNET_a2s (netmask, addrlen), name, netmask); 490 GNUNET_a2s (netmask, addrlen), name, netmask);
490 491
491 network = plugin->env->get_address_type (plugin->env->cls, broadcast_addr, addrlen); 492 network = plugin->env->get_address_type (plugin->env->cls, broadcast_addr, addrlen);
492 if (GNUNET_ATS_NET_LOOPBACK == ntohl(network.value)) 493 if (GNUNET_ATS_NET_LOOPBACK == network)
493 { 494 {
494 /* Broadcasting on loopback does not make sense */ 495 /* Broadcasting on loopback does not make sense */
495 return GNUNET_YES; 496 return GNUNET_YES;
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 460869181..112f15d09 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -1387,7 +1387,10 @@ unix_transport_server_start (void *cls)
1387 plugin->unix_socket_path[0] = '@'; 1387 plugin->unix_socket_path[0] = '@';
1388 un->sun_path[0] = '\0'; 1388 un->sun_path[0] = '\0';
1389 } 1389 }
1390 plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) un, un_len); 1390 plugin->ats_network.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1391 plugin->ats_network.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1392 (const struct sockaddr *) un,
1393 un_len));
1391 plugin->unix_sock.desc = 1394 plugin->unix_sock.desc =
1392 GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); 1395 GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0);
1393 if (NULL == plugin->unix_sock.desc) 1396 if (NULL == plugin->unix_sock.desc)