diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2010-10-25 20:25:48 +0000 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2010-10-25 20:25:48 +0000 |
commit | 31d3d15c36a696dea9d7589fb0a57f1225c109ba (patch) | |
tree | 5b52b07710631f1828f886794fcf627d7bd2d9c9 /src | |
parent | b7033e01b3afcf20828e2c5cb9e8ec15a9f760c4 (diff) | |
download | gnunet-31d3d15c36a696dea9d7589fb0a57f1225c109ba.tar.gz gnunet-31d3d15c36a696dea9d7589fb0a57f1225c109ba.zip |
Fixed udp_plugin_address_pretty_printer and gcrypt HMAC configure test.
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index b5beb157f..1f7aca59a 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1944,12 +1944,40 @@ udp_plugin_address_pretty_printer (void *cls, | |||
1944 | void *asc_cls) | 1944 | void *asc_cls) |
1945 | { | 1945 | { |
1946 | struct Plugin *plugin = cls; | 1946 | struct Plugin *plugin = cls; |
1947 | const struct sockaddr_in *v4; | ||
1948 | const struct sockaddr_in6 *v6; | ||
1949 | struct PrettyPrinterContext *ppc; | 1947 | struct PrettyPrinterContext *ppc; |
1948 | const void *sb; | ||
1949 | size_t sbs; | ||
1950 | struct sockaddr_in a4; | ||
1951 | struct sockaddr_in6 a6; | ||
1952 | const struct IPv4UdpAddress *u4; | ||
1953 | const struct IPv6UdpAddress *u6; | ||
1954 | uint16_t port; | ||
1950 | 1955 | ||
1951 | if ((addrlen != sizeof (struct sockaddr_in)) && | 1956 | if (addrlen == sizeof (struct IPv6UdpAddress)) |
1952 | (addrlen != sizeof (struct sockaddr_in6))) | 1957 | { |
1958 | u6 = addr; | ||
1959 | memset (&a6, 0, sizeof (a6)); | ||
1960 | a6.sin6_family = AF_INET6; | ||
1961 | a6.sin6_port = u6->u6_port; | ||
1962 | memcpy (&a6.sin6_addr, | ||
1963 | &u6->ipv6_addr, | ||
1964 | sizeof (struct in6_addr)); | ||
1965 | port = ntohs (u6->u6_port); | ||
1966 | sb = &a6; | ||
1967 | sbs = sizeof (a6); | ||
1968 | } | ||
1969 | else if (addrlen == sizeof (struct IPv4UdpAddress)) | ||
1970 | { | ||
1971 | u4 = addr; | ||
1972 | memset (&a4, 0, sizeof (a4)); | ||
1973 | a4.sin_family = AF_INET; | ||
1974 | a4.sin_port = u4->u_port; | ||
1975 | a4.sin_addr.s_addr = u4->ipv4_addr; | ||
1976 | port = ntohs (u4->u_port); | ||
1977 | sb = &a4; | ||
1978 | sbs = sizeof (a4); | ||
1979 | } | ||
1980 | else | ||
1953 | { | 1981 | { |
1954 | /* invalid address */ | 1982 | /* invalid address */ |
1955 | GNUNET_break_op (0); | 1983 | GNUNET_break_op (0); |
@@ -1959,21 +1987,11 @@ udp_plugin_address_pretty_printer (void *cls, | |||
1959 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext)); | 1987 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext)); |
1960 | ppc->asc = asc; | 1988 | ppc->asc = asc; |
1961 | ppc->asc_cls = asc_cls; | 1989 | ppc->asc_cls = asc_cls; |
1962 | if (addrlen == sizeof (struct sockaddr_in)) | 1990 | ppc->port = port; |
1963 | { | ||
1964 | v4 = (const struct sockaddr_in *) addr; | ||
1965 | ppc->port = ntohs (v4->sin_port); | ||
1966 | } | ||
1967 | else | ||
1968 | { | ||
1969 | v6 = (const struct sockaddr_in6 *) addr; | ||
1970 | ppc->port = ntohs (v6->sin6_port); | ||
1971 | |||
1972 | } | ||
1973 | GNUNET_RESOLVER_hostname_get (plugin->env->sched, | 1991 | GNUNET_RESOLVER_hostname_get (plugin->env->sched, |
1974 | plugin->env->cfg, | 1992 | plugin->env->cfg, |
1975 | addr, | 1993 | sb, |
1976 | addrlen, | 1994 | sbs, |
1977 | !numeric, timeout, &append_port, ppc); | 1995 | !numeric, timeout, &append_port, ppc); |
1978 | } | 1996 | } |
1979 | 1997 | ||