-fixing #2309
[oweals/gnunet.git] / src / tun / test_tun.c
index 91173c628506c3888af38349529894c4f1149b32..3539fd177ebe640122bff6ad7316e5b54c855faf 100644 (file)
@@ -39,14 +39,17 @@ test_udp (size_t pll,
   struct in_addr src;
   struct in_addr dst;
 
-  inet_pton (AF_INET, "1.2.3.4", &src);
-  inet_pton (AF_INET, "122.2.3.5", &dst);
+  GNUNET_assert (1 == inet_pton (AF_INET, "1.2.3.4", &src));
+  GNUNET_assert (1 == inet_pton (AF_INET, "122.2.3.5", &dst));
   memset (payload, pl_fill, sizeof (payload));
   GNUNET_TUN_initialize_ipv4_header (&ip,
                                     IPPROTO_UDP,
                                     pll + sizeof (udp),
                                     &src,
                                     &dst);
+  udp.source_port = htons (4242);
+  udp.destination_port = htons (4242);
+  udp.len = htons (pll);
   GNUNET_TUN_calculate_udp4_checksum (&ip,
                                      &udp,
                                      payload,
@@ -63,8 +66,9 @@ test_udp (size_t pll,
 int main (int argc,
          char **argv)
 {
-  test_udp (4, 3, 30799);
-  test_udp (4, 1, 31827);
-  test_udp (7, 17, 14879);
+  test_udp (4, 3, 22439);
+  test_udp (4, 1, 23467);
+  test_udp (7, 17, 6516);
+  test_udp (12451, 251, 42771);
   return ret;
 }