diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-21 10:35:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-21 10:35:50 +0000 |
commit | 595fdf819d8c2176be841164508f9bd9985aa304 (patch) | |
tree | cf280c69eff003cc465f03cbbe640129c6a19bd5 /src/transport/plugin_transport_udp.c | |
parent | 632f930a8ecba7d0437644f4f19d187151a9e4e0 (diff) | |
download | gnunet-595fdf819d8c2176be841164508f9bd9985aa304.tar.gz gnunet-595fdf819d8c2176be841164508f9bd9985aa304.zip |
more FBSD fixes
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 322bdd1d0..4de3f2c44 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -295,9 +295,9 @@ udp_plugin_send (void *cls, | |||
295 | #endif | 295 | #endif |
296 | a6.sin6_family = AF_INET6; | 296 | a6.sin6_family = AF_INET6; |
297 | a6.sin6_port = t6->u6_port; | 297 | a6.sin6_port = t6->u6_port; |
298 | memcpy (a6.sin6_addr.s6_addr, | 298 | memcpy (&a6.sin6_addr, |
299 | &t6->ipv6_addr, | 299 | &t6->ipv6_addr, |
300 | 16); | 300 | sizeof (struct in6_addr)); |
301 | sb = &a6; | 301 | sb = &a6; |
302 | sbs = sizeof (a6); | 302 | sbs = sizeof (a6); |
303 | } | 303 | } |
@@ -380,9 +380,14 @@ process_interfaces (void *cls, | |||
380 | } | 380 | } |
381 | else if (af == AF_INET6) | 381 | else if (af == AF_INET6) |
382 | { | 382 | { |
383 | if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) | ||
384 | { | ||
385 | /* skip link local addresses */ | ||
386 | return GNUNET_OK; | ||
387 | } | ||
383 | memcpy (&t6.ipv6_addr, | 388 | memcpy (&t6.ipv6_addr, |
384 | ((struct sockaddr_in6 *) addr)->sin6_addr.s6_addr, | 389 | &((struct sockaddr_in6 *) addr)->sin6_addr, |
385 | 16); | 390 | sizeof (struct in6_addr)); |
386 | t6.u6_port = htons (plugin->adv_port); | 391 | t6.u6_port = htons (plugin->adv_port); |
387 | arg = &t6; | 392 | arg = &t6; |
388 | args = sizeof (t6); | 393 | args = sizeof (t6); |
@@ -541,8 +546,8 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
541 | s6 = (const struct sockaddr_in6*) &addr; | 546 | s6 = (const struct sockaddr_in6*) &addr; |
542 | t6.u6_port = s6->sin6_port; | 547 | t6.u6_port = s6->sin6_port; |
543 | memcpy (&t6.ipv6_addr, | 548 | memcpy (&t6.ipv6_addr, |
544 | s6->sin6_addr.s6_addr, | 549 | &s6->sin6_addr, |
545 | 16); | 550 | sizeof (struct in6_addr)); |
546 | ca = &t6; | 551 | ca = &t6; |
547 | calen = sizeof (struct IPv6UdpAddress); | 552 | calen = sizeof (struct IPv6UdpAddress); |
548 | } | 553 | } |
@@ -714,6 +719,11 @@ udp_check_address (void *cls, void *addr, size_t addrlen) | |||
714 | else | 719 | else |
715 | { | 720 | { |
716 | v6 = (struct IPv6UdpAddress *) addr; | 721 | v6 = (struct IPv6UdpAddress *) addr; |
722 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | ||
723 | { | ||
724 | GNUNET_break_op (0); | ||
725 | return GNUNET_SYSERR; | ||
726 | } | ||
717 | v6->u6_port = htons (check_port (plugin, ntohs (v6->u6_port))); | 727 | v6->u6_port = htons (check_port (plugin, ntohs (v6->u6_port))); |
718 | } | 728 | } |
719 | return GNUNET_OK; | 729 | return GNUNET_OK; |
@@ -782,9 +792,9 @@ udp_plugin_address_pretty_printer (void *cls, | |||
782 | a6.sin6_family = AF_INET6; | 792 | a6.sin6_family = AF_INET6; |
783 | a6.sin6_port = t6->u6_port; | 793 | a6.sin6_port = t6->u6_port; |
784 | port = ntohs (t6->u6_port); | 794 | port = ntohs (t6->u6_port); |
785 | memcpy (a6.sin6_addr.s6_addr, | 795 | memcpy (&a6.sin6_addr, |
786 | &t6->ipv6_addr, | 796 | &t6->ipv6_addr, |
787 | 16); | 797 | sizeof (struct in6_addr)); |
788 | sb = &a6; | 798 | sb = &a6; |
789 | sbs = sizeof (a6); | 799 | sbs = sizeof (a6); |
790 | } | 800 | } |