gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19535 - in gnunet/src: include tun


From: gnunet
Subject: [GNUnet-SVN] r19535 - in gnunet/src: include tun
Date: Mon, 30 Jan 2012 13:57:41 +0100

Author: grothoff
Date: 2012-01-30 13:57:41 +0100 (Mon, 30 Jan 2012)
New Revision: 19535

Modified:
   gnunet/src/include/gnunet_tun_lib.h
   gnunet/src/tun/tun.c
Log:
-simplify

Modified: gnunet/src/include/gnunet_tun_lib.h
===================================================================
--- gnunet/src/include/gnunet_tun_lib.h 2012-01-30 12:54:55 UTC (rev 19534)
+++ gnunet/src/include/gnunet_tun_lib.h 2012-01-30 12:57:41 UTC (rev 19535)
@@ -132,8 +132,7 @@
   unsigned int flow_label:20 GNUNET_PACKED;
 #elif __BYTE_ORDER == __BIG_ENDIAN
   unsigned int version:4 GNUNET_PACKED;
-  unsigned int traffic_class_h:4 GNUNET_PACKED;
-  unsigned int traffic_class_l:4 GNUNET_PACKED;
+  unsigned int traffic_class:8 GNUNET_PACKED;
   unsigned int flow_label:20 GNUNET_PACKED;
 #endif
   /**

Modified: gnunet/src/tun/tun.c
===================================================================
--- gnunet/src/tun/tun.c        2012-01-30 12:54:55 UTC (rev 19534)
+++ gnunet/src/tun/tun.c        2012-01-30 12:57:41 UTC (rev 19535)
@@ -50,17 +50,14 @@
                                   const struct in_addr *dst)
 {
   GNUNET_assert (payload_length <= UINT16_MAX - sizeof (struct 
GNUNET_TUN_IPv4Header));
+  memset (&ip, 0, sizeof (struct GNUNET_TUN_IPv4Header));
   ip->header_length =  sizeof (struct GNUNET_TUN_IPv4Header) / 4;
   ip->version = 4;
-  ip->diff_serv = 0;
   ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + 
payload_length);
   ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 
(GNUNET_CRYPTO_QUALITY_WEAK, 
                                                            65536);
-  ip->flags = 0;
-  ip->fragmentation_offset = 0;
   ip->ttl = FRESH_TTL;
   ip->protocol = protocol;
-  ip->checksum = 0;
   ip->source_address = *src;
   ip->destination_address = *dst;
   ip->checksum = GNUNET_CRYPTO_crc16_n (ip, sizeof (struct 
GNUNET_TUN_IPv4Header));
@@ -84,10 +81,8 @@
                                   const struct in6_addr *dst)
 {
   GNUNET_assert (payload_length <= UINT16_MAX - sizeof (struct 
GNUNET_TUN_IPv6Header));
+  memset (&ip, 0, sizeof (struct GNUNET_TUN_IPv6Header));
   ip->version = 6;
-  ip->traffic_class_h = 0;
-  ip->traffic_class_l = 0;
-  ip->flow_label = 0;
   ip->next_header = protocol;
   ip->payload_length = htons ((uint16_t) payload_length);
   ip->hop_limit = FRESH_TTL;




reply via email to

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