From 0ce65c790cb56b140da5966547535758aae182bf Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 3 Feb 2011 16:28:52 +0000 Subject: [PATCH] fix compiler error for newer MHD API --- src/transport/Makefile.am | 2 +- src/transport/plugin_transport_http.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index c3b90cc9d..579ee7998 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -35,7 +35,7 @@ endif if HAVE_PCAP if LINUX if HAVE_EXPERIMENTAL - WANBIN = gnunet-transport-wlan-helper +# WANBIN = gnunet-transport-wlan-helper WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la WLAN_API_TEST = test_transport_api_wlan endif diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index f879012c9..a90cc9f0d 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -996,9 +996,9 @@ mhd_access_cb (void *cls, struct Plugin *plugin = cls; struct MHD_Response *response; const union MHD_ConnectionInfo * conn_info; - - struct sockaddr_in *addrin; - struct sockaddr_in6 *addrin6; + const struct sockaddr *client_addr; + const struct sockaddr_in *addrin; + const struct sockaddr_in6 *addrin6; char address[INET6_ADDRSTRLEN+14]; struct GNUNET_PeerIdentity pi_in; @@ -1077,9 +1077,11 @@ mhd_access_cb (void *cls, conn_info = MHD_get_connection_info(mhd_connection, MHD_CONNECTION_INFO_CLIENT_ADDRESS ); /* Incoming IPv4 connection */ - if ( AF_INET == conn_info->client_addr->sin_family) + /* cast required for legacy MHD API < 0.9.6 */ + client_addr = (const struct sockaddr *) conn_info->client_addr; + if ( AF_INET == client_addr->sa_family) { - addrin = conn_info->client_addr; + addrin = (const struct sockaddr_in*) client_addr; inet_ntop(addrin->sin_family, &(addrin->sin_addr),address,INET_ADDRSTRLEN); memcpy(&ipv4addr.ipv4_addr,&(addrin->sin_addr),sizeof(struct in_addr)); ipv4addr.u_port = addrin->sin_port; @@ -1087,9 +1089,9 @@ mhd_access_cb (void *cls, addr_len = sizeof(struct IPv4HttpAddress); } /* Incoming IPv6 connection */ - if ( AF_INET6 == conn_info->client_addr->sin_family) + if ( AF_INET6 == client_addr->sa_family) { - addrin6 = (struct sockaddr_in6 *) conn_info->client_addr; + addrin6 = (const struct sockaddr_in6 *) client_addr; inet_ntop(addrin6->sin6_family, &(addrin6->sin6_addr),address,INET6_ADDRSTRLEN); memcpy(&ipv6addr.ipv6_addr,&(addrin6->sin6_addr),sizeof(struct in6_addr)); ipv6addr.u6_port = addrin6->sin6_port; -- 2.25.1