-typo
[oweals/gnunet.git] / src / gns / gnunet-dns2gns.c
index 71511c84a1536a735fef8792ce84c888d791e1f3..8cef98489f595dbf045e65ae908aec7e6fb24162 100644 (file)
@@ -134,6 +134,12 @@ static char *fcfs_suffix;
  */
 static char *dns_ip;
 
+/**
+ * UDP Port we listen on for inbound DNS requests.
+ */
+static unsigned int listen_port = 53;
+
+
 /**
  * Task run on shutdown.  Cleans up everything.
  *
@@ -276,7 +282,7 @@ result_processor (void *cls,
   //packet->flags.opcode = GNUNET_DNSPARSER_OPCODE_STATUS; // ???
   for (i=0;i<rd_count;i++)
     {
-      rec.expiration_time.abs_value = rd[i].expiration_time;
+      rec.expiration_time.abs_value_us = rd[i].expiration_time;
       switch (rd[i].record_type)
        {
        case GNUNET_DNSPARSER_TYPE_A:
@@ -350,7 +356,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
   char *dot;
   char *nname;
   size_t name_len;
-  enum GNUNET_GNS_RecordType type;
+  int type;
   int use_gns;
   struct GNUNET_CRYPTO_ShortHashCode zone;
 
@@ -598,11 +604,12 @@ run (void *cls, char *const *args, const char *cfgfile,
 #if HAVE_SOCKADDR_IN_SIN_LEN
       v4.sin_len = sizeof (v4);
 #endif
-      v4.sin_port = htons (53);
+      v4.sin_port = htons (listen_port);
       if (GNUNET_OK !=
          GNUNET_NETWORK_socket_bind (listen_socket4,
                                      (struct sockaddr *) &v4,
-                                     sizeof (v4)))
+                                     sizeof (v4),
+                                      0))
        {
          GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
          GNUNET_NETWORK_socket_close (listen_socket4);
@@ -621,11 +628,12 @@ run (void *cls, char *const *args, const char *cfgfile,
 #if HAVE_SOCKADDR_IN_SIN_LEN
       v6.sin6_len = sizeof (v6);
 #endif
-      v6.sin6_port = htons (53);
+      v6.sin6_port = htons (listen_port);
       if (GNUNET_OK !=
          GNUNET_NETWORK_socket_bind (listen_socket6,
                                      (struct sockaddr *) &v6,
-                                     sizeof (v6)))
+                                     sizeof (v6),
+                                      0))
        {
          GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
          GNUNET_NETWORK_socket_close (listen_socket6);
@@ -669,15 +677,18 @@ main (int argc,
       char *const *argv)
 {
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'d', "dns", NULL,
-      gettext_noop ("IP of recursive dns resolver to use (required)"), 1,
+    {'d', "dns", "IP",
+      gettext_noop ("IP of recursive DNS resolver to use (required)"), 1,
       &GNUNET_GETOPT_set_string, &dns_ip},
-    {'s', "suffix", NULL,
+    {'s', "suffix", "SUFFIX",
       gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), 1,
       &GNUNET_GETOPT_set_string, &dns_suffix},
-    {'f', "fcfs", NULL,
+    {'f', "fcfs", "NAME",
       gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), 1,
       &GNUNET_GETOPT_set_string, &fcfs_suffix},
+    {'p', "port", "UDPPORT",
+      gettext_noop ("UDP port to listen on for inbound DNS requests; default: 53"), 1,
+      &GNUNET_GETOPT_set_uint, &listen_port},
     GNUNET_GETOPT_OPTION_END
   };
   int ret;
@@ -692,7 +703,7 @@ main (int argc,
                            _("GNUnet DNS-to-GNS proxy (a DNS server)"), 
                           options,
                            &run, NULL)) ? 0 : 1;
-
+  GNUNET_free ((void*) argv);
   return ret;
 }