gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16984 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r16984 - gnunet/src/transport
Date: Wed, 21 Sep 2011 10:42:11 +0200

Author: brodski
Date: 2011-09-21 10:42:11 +0200 (Wed, 21 Sep 2011)
New Revision: 16984

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_wlan.c
Log:
Some Fixes

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-09-21 08:06:55 UTC 
(rev 16983)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-09-21 08:42:11 UTC 
(rev 16984)
@@ -173,7 +173,7 @@
     {
     case GNUNET_MESSAGE_TYPE_HELLO:
       GST_validation_handle_hello (message);
-      break;
+      return ret;
     case GNUNET_MESSAGE_TYPE_TRANSPORT_PING:
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2011-09-21 08:06:55 UTC 
(rev 16983)
+++ gnunet/src/transport/plugin_transport_wlan.c        2011-09-21 08:42:11 UTC 
(rev 16984)
@@ -99,7 +99,7 @@
 /**
  * DEBUG switch
  */
-#define DEBUG_wlan GNUNET_NO
+#define DEBUG_wlan GNUNET_YES
 #define DEBUG_wlan_retransmission GNUNET_NO
 #define DEBUG_wlan_ip_udp_packets_on_air GNUNET_NO
 #define DEBUG_wlan_msg_dump GNUNET_NO
@@ -1407,8 +1407,7 @@
   GNUNET_assert (sizeof (struct WlanHeader) + hallo_size <= WLAN_MTU);
   size =
       sizeof (struct GNUNET_MessageHeader) + sizeof (struct Radiotap_Send) +
-      sizeof (struct ieee80211_frame) + sizeof (struct GNUNET_MessageHeader) +
-      hallo_size;
+      sizeof (struct ieee80211_frame) + hallo_size;
 
   msgheader = GNUNET_malloc (size);
   msgheader->size = htons (size);
@@ -1420,12 +1419,12 @@
   getWlanHeader (ieeewlanheader, &bc_all_mac, plugin, size);
 
   msgheader2 = (struct GNUNET_MessageHeader *) &ieeewlanheader[1];
-  msgheader2->size =
+  /*msgheader2->size =
       htons (GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello) +
              sizeof (struct GNUNET_MessageHeader));
 
-  msgheader2->type = htons (GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);
-  memcpy (&msgheader2[1], hello, hallo_size);
+  msgheader2->type = htons (GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);*/
+  memcpy (msgheader2, hello, hallo_size);
 
   bytes = GNUNET_DISK_file_write (plugin->server_stdin_handle, msgheader, 
size);
 
@@ -2316,7 +2315,7 @@
   struct FragmentMessage *fm2;
 
   //ADVERTISEMENT
-  if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT)
+  if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_HELLO)
   {
 
     //TODO better DOS protection, error handling
@@ -2331,15 +2330,7 @@
                                                                        mac, 
6));
 #endif
 
-    if (session_light->macendpoint == NULL)
-    {
-      session_light->macendpoint =
-          get_macendpoint (plugin, &session_light->addr, GNUNET_NO);
-    }
-    GNUNET_assert (GNUNET_HELLO_get_id
-                   ((const struct GNUNET_HELLO_Message *) &hdr[1],
-                    &(session_light->session->target)) != GNUNET_SYSERR);
-
+    plugin->env->receive(NULL,NULL,hdr, NULL, 0, NULL, NULL, 0);
   }
 
   //FRAGMENT
@@ -2581,7 +2572,7 @@
 
     //call wlan_process_helper with the message inside, later with wlan: 
analyze signal
     if (ntohs (hdr->size) <
-        sizeof (struct ieee80211_frame) + sizeof (struct GNUNET_MessageHeader) 
+
+        sizeof (struct ieee80211_frame) + 2*sizeof (struct 
GNUNET_MessageHeader) +
         sizeof (struct Radiotap_rx))
     {
 #if DEBUG_wlan
@@ -2595,6 +2586,7 @@
       /* FIXME: restart SUID process */
       return;
     }
+
     rxinfo = (struct Radiotap_rx *) &hdr[1];
     wlanIeeeHeader = (struct ieee80211_frame *) &rxinfo[1];
 
@@ -2633,8 +2625,18 @@
         while (pos < datasize)
         {
           temp_hdr = (struct GNUNET_MessageHeader *) &wlanIeeeHeader[1] + pos;
-
-          wlan_data_helper (plugin, session_light, temp_hdr, rxinfo);
+          if (ntohs(temp_hdr->size) <= datasize + pos)
+            {
+            wlan_data_helper (plugin, session_light, temp_hdr, rxinfo);
+            }
+          else
+            {
+#if DEBUG_wlan
+            GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
+                       "Size of packet is too small; size: %u > size of 
packet: %u\n",
+                       ntohs(temp_hdr->size),datasize + pos);
+#endif
+            }
           pos += ntohs (temp_hdr->size);
 
         }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]